Exemple #1
0
        void HandleStandOutput(StreamReader reader)
        {
            JObject jsonObj;

            using (JsonTextReader jsonReader = new JsonTextReader(reader))
            {
                jsonObj   = JObject.Load(jsonReader);
                _metadata = new VideoMetadata(jsonObj);
            }
        }
        public async Task <bool> OpenAsync(string videoUrl)
        {
            _videoUrl = Path.GetFullPath(videoUrl);

            FFprobeClient ffprobeClient = new FFprobeClient(_ffprobeToolPath, _videoUrl);
            bool          ret           = await ffprobeClient.RunAsync();

            _metadata  = ffprobeClient.Metadata;
            _framePool = new VideoFramesPool(_metadata, (start) => new FFmpegClient(_ffmpegToolPath, _videoUrl, _metadata.Width, _metadata.Height, start));
            return(ret);
        }
        public VideoFramesPool(VideoMetadata metadata, Func <float, FFmpegClient> ffmpegClientFactory)
        {
            _bufferCount         = 0x40000000 / metadata.Width / metadata.Height / 3;
            _metadata            = metadata;
            _ffmpegClientFactory = ffmpegClientFactory;
            _framesQueue         = new BufferBlock <VideoFrame>();
            _asyncLock           = new AsyncLock();
            _backgroundWorker    = new BackgroundWorker()
            {
                WorkerSupportsCancellation = true
            };
            _headTime = 0.0f;
            _tailTime = 0.0f;

            _backgroundWorker.DoWork += BackgroundVideoDecoding;
            _backgroundWorker.RunWorkerAsync();
        }
 public VideoProperties(VideoMetadata metadata)
 {
     _metadata = metadata;
 }