Пример #1
0
        /// <summary>
        /// Special function to run Scan Type detection using the IDET video filter.
        /// By default, this will skip 300 seconds into the video and then analyze it for 120 seconds to collect data about the field frames.
        /// You can override the default <paramref name="skipSeconds"/> and <paramref name="analyzeSeconds"/> by putting non 0 values in the respective parameters.
        /// The results are stored in the MFInterlaceDetectionResults (Multi Frame MORE reliable) and SFInterlaceDetectionResults (Single Frame).
        /// When this mode is active, ONLY interlace detection is done, the rest of the MediaInfo is NOT available (null)
        /// Run automatically on initialization
        /// </summary>
        /// <param name="skipSeconds">Number of seconds of the initial video to skip before starting interlace detection (0 for default)</param>
        /// <param name="analyzeSeconds">Number of seconds of the video to analyze for interlace detection (0 for default)</param>
        public FFmpegMediaInfo(string fileName, JobStatus jobStatus, Log jobLog, ulong skipSeconds, ulong analyzeSeconds, bool ignoreSuspend = false)
            : base(fileName, FFMPEG_APP_PATH, jobStatus, jobLog, ignoreSuspend)
        {
            mediaInfo = null; // In this mode, there is no media info
            idetMode = true; // We are running a special mode
            useFFProbe = false; // We are using FFMPEG here not FFProbe
            parseError = true; // In this mode parse error is default until we find what we need
            _success = true; // information always suceeds unless we find an error in the output

            // Check for custom overrides
            if (skipSeconds > 0)
                IDET_SKIP_SECONDS = skipSeconds;

            if (analyzeSeconds > 0)
                IDET_ANALYZE_SECONDS = analyzeSeconds;

            // -probesize 100M -analyzeduration 300M are important to identify broken audio streams in some files
            _Parameters = " -probesize 100M -analyzeduration 300M -y -ss " + IDET_SKIP_SECONDS.ToString(CultureInfo.InvariantCulture) + " -i " + Util.FilePaths.FixSpaces(fileName) + " -vf idet -an -sn -t " + IDET_ANALYZE_SECONDS.ToString(CultureInfo.InvariantCulture) + " -f rawvideo NUL"; // create the format for run the command
            Run();
        }
Пример #2
0
        /// <summary>
        /// Gets information about the video file and stores it.
        /// The ParseError flag is set if there is an error trying to parse the video information, in which the information available in not reliable.
        /// Run automatically on initialization
        /// </summary>
        /// <param name="ignoreSuspend">Set this if you want to ignore the suspend/pause command, typically used when this function is called from a GUI to prevent a deadlock/hang</param>
        public FFmpegMediaInfo(string fileName, JobStatus jobStatus, Log jobLog, bool ignoreSuspend = false)
            : base(fileName, FFPROBE_APP_PATH, jobStatus, jobLog, ignoreSuspend)
        {
            // Check if FFProbe exists, if not then fallback to FFMpeg
            if (useFFProbe && !File.Exists(_ApplicationPath))
            {
                jobLog.WriteEntry(this, "FFProbe not found, switching to FFMpeg", Log.LogEntryType.Warning);
                _ApplicationPath = Path.Combine(GlobalDefs.AppPath, FFMPEG_APP_PATH);
                useFFProbe = false;
            }

            mediaInfo = new MediaInfo();
            mediaInfo.VideoInfo = new MediaInfo.Video(); // We have only 1 video track per file, audio/subtitle tracks are created and added as detected
            _success = true; // information always suceeds unless we find an error in the output
            // -probesize 100M -analyzeduration 300M are important to identify broken audio streams in some files
            // TODO: FFPROBE -> For now we only process independent streams and ignore streams embedded within programs (-show_programs). This is because streams embedded within programs do not have unique stream ID's and PID's (they repeat within each program). How does MCEBuddy handle mpegts_service_id (programs)?
            if (useFFProbe) // FFPROBE
                _Parameters = " -probesize 100M -analyzeduration 300M -v quiet -print_format json -show_format -show_streams -i " + Util.FilePaths.FixSpaces(fileName); // FFPROBE create the format for run the command
            else // FFMPEG
                _Parameters = " -probesize 100M -analyzeduration 300M -i " + Util.FilePaths.FixSpaces(fileName); // FFMPEG create the format for run the command
            Run();
        }