Esempio n. 1
0
        public FFmpegCLI SetSelectedTracks(List <Track> selectedTracks, FFmpegTrackIndexer indexer)
        {
            _selectedTracks = selectedTracks;
            _indexer        = indexer;

            MapSelectedTracks();

            return(this);
        }
Esempio n. 2
0
        public FFmpeg(Job job, Playlist playlist, string outputMKVPath, IJobObjectManager jobObjectManager, ITempFileRegistrar tempFileRegistrar)
            : base(jobObjectManager)
        {
            _playlistLength = playlist.Length;
            _inputM2TSPaths = playlist.StreamClips.Select(clip => clip.FileInfo.FullName).ToList();
            _selectedTracks = playlist.Tracks.Where(track => track.Keep).ToList();
            _outputMKVPath = outputMKVPath;
            _jobObjectManager = jobObjectManager;
            _tempFileRegistrar = tempFileRegistrar;

            _progressFilePath = _tempFileRegistrar.CreateTempFile(GetType(), "progress.log");
            _inputFileListPath = _tempFileRegistrar.CreateTempFile(GetType(), "inputFileList.txt");
            _indexer = new FFmpegTrackIndexer(playlist);

            VerifyInputPaths();
            VerifySelectedTracks();

            SetExePath();

            SetFFmpegLogLevel();
            RedirectProgressToFile();
            ReplaceExistingFiles();
            SetInputFiles();
            SetMovieTitle(job);
            MapSelectedTracks();
            CopyAllCodecs();
            ConvertLPCM();
            SetOutputMKVPath();

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

            foreach (var track in playlist.Tracks)
            {
                var index = _indexer[track];
                Logger.InfoFormat("Track w/ stream PID {0} (0x{0:x4}): index {1} => {2} ({3})",
                    track.PID, index.InputIndex, index.OutputIndex, track.Codec);
            }
        }
Esempio n. 3
0
        public FFmpeg(Job job, Playlist playlist, string outputMKVPath, IJobObjectManager jobObjectManager, ITempFileRegistrar tempFileRegistrar)
            : base(jobObjectManager)
        {
            _playlistLength    = playlist.Length;
            _inputM2TSPaths    = playlist.StreamClips.Select(clip => clip.FileInfo.FullName).ToList();
            _selectedTracks    = playlist.Tracks.Where(track => track.Keep).ToList();
            _outputMKVPath     = outputMKVPath;
            _jobObjectManager  = jobObjectManager;
            _tempFileRegistrar = tempFileRegistrar;

            _progressFilePath  = _tempFileRegistrar.CreateTempFile(GetType(), "progress.log");
            _inputFileListPath = _tempFileRegistrar.CreateTempFile(GetType(), "inputFileList.txt");
            _indexer           = new FFmpegTrackIndexer(playlist);

            VerifyInputPaths();
            VerifySelectedTracks();

            SetExePath();

            SetFFmpegLogLevel();
            RedirectProgressToFile();
            ReplaceExistingFiles();
            SetInputFiles();
            SetMovieTitle(job);
            MapSelectedTracks();
            CopyAllCodecs();
            ConvertLPCM();
            SetOutputMKVPath();

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

            foreach (var track in playlist.Tracks)
            {
                var index = _indexer[track];
                Logger.InfoFormat("Track w/ stream PID {0} (0x{0:x4}): index {1} => {2} ({3})",
                                  track.PID, index.InputIndex, index.OutputIndex, track.Codec);
            }
        }
Esempio n. 4
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;
        }