Exemplo n.º 1
0
        private FFmpeg(ArgumentList arguments, IJobObjectManager jobObjectManager)
            : base(jobObjectManager)
        {
            Arguments = arguments;

            var cli = new FFmpegCLI(Arguments);

            ExePath = cli.ExePath;
        }
Exemplo n.º 2
0
        public FFmpeg(Job job, Playlist playlist, string outputMKVPath, IJobObjectManager jobObjectManager, ITempFileRegistrar tempFileRegistrar)
            : base(jobObjectManager)
        {
            _jobObjectManager  = jobObjectManager;
            _tempFileRegistrar = tempFileRegistrar;

            _progressFilePath  = _tempFileRegistrar.CreateTempFile(GetType(), "progress.log");
            _inputFileListPath = _tempFileRegistrar.CreateTempFile(GetType(), "inputFileList.txt");
            _reportDumpFileDir = Path.GetDirectoryName(_progressFilePath);

            _playlistLength = playlist.Length;

            var inputM2TSPaths = playlist.StreamClips.Select(clip => clip.FileInfo.FullName).ToList();
            var selectedTracks = playlist.Tracks.Where(track => track.Keep).ToList();
            var trackIndexer   = new FFmpegTrackIndexer(playlist);

            var cli = new FFmpegCLI(Arguments)
                      .DumpLogFile()
                      .SetLogLevel(FFmpegLogLevel.Error)
                      .RedirectProgressToFile(_progressFilePath)
                      .GenPTS()
                      .ReplaceExistingFiles()
                      .SetInputPaths(inputM2TSPaths, _inputFileListPath)
                      .SetMovieTitle(job)
                      .SetSelectedTracks(selectedTracks, trackIndexer)
                      .CopyAllCodecs()
                      .ConvertLPCM()
                      .SetOutputPath(outputMKVPath)
            ;

            ExePath = cli.ExePath;

            BeforeStart += OnBeforeStart;
            StdErr      += OnStdErr;
            Exited      += (state, code, exception, time) => OnExited(state, code, job.SelectedReleaseMedium, playlist, outputMKVPath);

            CleanExit = false;
        }