コード例 #1
0
        /// <summary>
        /// Starts the processing.
        /// </summary>
        void StartProcessing()
        {
            movie = new Movie();
            movie.sourceStream = File.OpenRead(srcPath);

            dstStream = File.OpenWrite(dstPath);
            remux     = new AviRemux();

            // create and initialize demux for the source data
            movie.demux = Demux.forSource(movie.sourceStream);
            movie.demux.Init(movie.sourceStream);

            // create video stream and decoder too. without a decoder we can't access pixels to compare
            if (!movie.demux.hasVideo)
            {
                throw new MpException("Remux needs video stream inside an AVI");
            }
            movie.videoDecoder = VideoDecoder.CreateFor(movie.demux.videoStreamInfo);
            movie.videoDecoder.Init(out framebuffer, movie.demux);

            // create a remux. this will write into dstStream
            bool outputHasAudio = movie.demux.hasAudio && !discardAudio;

            remux.Init(dstStream, movie.demux.videoStreamInfo, outputHasAudio ? movie.demux.audioStreamInfo : null);

            // create a duplicate finder. most of the options control how the frames are actually compared
            options.otherStreamsAvailable = outputHasAudio;
            dupFinder = new DuplicateFrameFinder(movie.videoDecoder, framebuffer, 0, movie.demux.videoStreamInfo.frameCount, options);

            // if we want a to log the duplicate indexes into a file, then clear the file first
            if (!string.IsNullOrEmpty(logDuplicatesPath))
            {
                File.WriteAllText(logDuplicatesPath, "# Duplicate frame index for " + srcPath + "\n");
            }
        }
コード例 #2
0
        /// <summary>
        /// Starts the processing.
        /// </summary>
        void StartProcessing()
        {
            movie = new Movie ();
            movie.sourceStream = File.OpenRead (srcPath);

            dstStream = File.OpenWrite (dstPath);
            remux = new AviRemux ();

            // create and initialize demux for the source data
            movie.demux = Demux.forSource (movie.sourceStream);
            movie.demux.Init (movie.sourceStream);

            // create video stream and decoder too. without a decoder we can't access pixels to compare
            if (!movie.demux.hasVideo) {
                throw new MpException ("Remux needs video stream inside an AVI");
            }
            movie.videoDecoder = VideoDecoder.CreateFor (movie.demux.videoStreamInfo);
            movie.videoDecoder.Init (out framebuffer, movie.demux);

            // create a remux. this will write into dstStream
            bool outputHasAudio = movie.demux.hasAudio && !discardAudio;
            remux.Init (dstStream, movie.demux.videoStreamInfo, outputHasAudio ? movie.demux.audioStreamInfo : null);

            // create a duplicate finder. most of the options control how the frames are actually compared
            options.otherStreamsAvailable = outputHasAudio;
            dupFinder = new DuplicateFrameFinder (movie.videoDecoder, framebuffer, 0, movie.demux.videoStreamInfo.frameCount, options);

            // if we want a to log the duplicate indexes into a file, then clear the file first
            if (!string.IsNullOrEmpty (logDuplicatesPath)) {
                File.WriteAllText (logDuplicatesPath, "# Duplicate frame index for " + srcPath + "\n");
            }
        }