Beispiel #1
0
        public void ReadVideo(FFprobeSerializerResult ffprobeSerializerResult)
        {
            VideoStream = FFprobeVideoStream.Create();

            int w, h;
            var fw = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "width") as FFprobeObject;
            var fh = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "height") as FFprobeObject;

            if (fw != null && int.TryParse(fw.Value.ToString(), out w))
            {
                VideoStream.Width = w;
            }
            if (fh != null && int.TryParse(fh.Value.ToString(), out h))
            {
                VideoStream.Height = h;
            }

            double d;
            var    fd = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "duration") as FFprobeObject;

            if (fd != null && double.TryParse(fd.Value.ToString(), out d))
            {
                VideoStream.Duration = TimeSpan.FromSeconds(d);
            }

            long br;
            var  fbr = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "bit_rate") as FFprobeObject;

            if (fbr != null && long.TryParse(fbr.Value.ToString(), out br))
            {
                VideoStream.BitRate = br;
            }

            var tb = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "time_base") as FFprobeFraction;

            if (tb != null)
            {
                VideoStream.TimeBase = tb;
            }

            var fr = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "avg_frame_rate") as FFprobeFraction;

            if (fr != null)
            {
                VideoStream.FrameRate = fr;
            }
        }
 internal static MetadataInfo Create(FFprobeVideoStream loader)
 {
     return new MetadataInfo
     {
         HasVideo = true,
         HasAudio = false,
         BitRate = loader.BitRate,
         Duration = loader.Duration,
         Timebase = FFmpegFraction.Create(loader.TimeBase),
         FrameRate = FFmpegFraction.Create(loader.FrameRate),
         Dimensions = new Size(loader.Width, loader.Height),
     };
 }
Beispiel #3
0
        public void ReadVideo(FFprobeSerializerResult ffprobeSerializerResult)
        {
            VideoStream = FFprobeVideoStream.Create();

            int w, h;
            var fw = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "width") as FFprobeObject;
            var fh = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "height") as FFprobeObject;
            if (fw != null && int.TryParse(fw.Value.ToString(), out w)) VideoStream.Width = w;
            if (fh != null && int.TryParse(fh.Value.ToString(), out h)) VideoStream.Height = h;

            double d;
            var fd = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "duration") as FFprobeObject;
            if (fd != null && double.TryParse(fd.Value.ToString(), out d)) VideoStream.Duration = TimeSpan.FromSeconds(d);

            long br;
            var fbr = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "bit_rate") as FFprobeObject;
            if (fbr != null && long.TryParse(fbr.Value.ToString(), out br)) VideoStream.BitRate = br;

            var tb = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "time_base") as FFprobeFraction;
            if (tb != null) VideoStream.TimeBase = tb;

            var fr = ffprobeSerializerResult.Get(FFprobeCodecTypes.Video, 0, "avg_frame_rate") as FFprobeFraction;
            if (fr != null) VideoStream.FrameRate = fr;
        }