public static bool MergeChunks(Job job)
        {
            if (CheckOutputs(job) == false)
            {
                job.ErrorStatus = JobErrorStatus.JES_OUTPUTFILE_COUNT_MISMATCH;
                return(false);
            }

            SavePreviewImage(job);

            if (job.Production.IsZipProduction)
            {
                return(true);
            }

            CreateChunklistFile(job);

            string cmd = "-y -loglevel panic -safe 0 -f concat -i " + JobPathHelper.GetChunkListPath(job) + " -c copy ";

            cmd += JobPathHelper.GetJobClipPath(job);

            Encode(job, cmd);

            return(true);
        }
        private static void CreateChunklistFile(Job job)
        {
            //get chunk files
            string[] chunkFiles = Directory.GetFiles(JobPathHelper.GetLocalJobDirectory(job), "clip_" + job.Position + "_chunk_*.mp4");
            chunkFiles = chunkFiles.OrderBy(x => x).ToArray();

            //create cliplist file
            string       clipListFilename = JobPathHelper.GetChunkListPath(job);
            StreamWriter writer           = new StreamWriter(clipListFilename, false);

            writer.WriteLine(@"# chunklist");

            foreach (string chunkFile in chunkFiles)
            {
                writer.WriteLine("file '" + chunkFile + "'");
            }
            writer.Close();
        }