简体   繁体   English

增加录制视频ffmpeg中的fps

[英]Increase fps in record video ffmpeg

I need to record 2 videos from 2 cameras in full hd 30 fps. 我需要以全高清30 fps录制2个摄像机的2个视频。 I use ffmpeg and wrapper - Aforge for c#. 我使用ffmpeg和包装器-Aforge for c#。

init device: 初始化设备:

        _videoCaptureDevice = new VideoCaptureDevice(deviceName);
        _videoCaptureDevice.VideoResolution = _videoCaptureDevice.VideoCapabilities[0];
        _videoCaptureDevice.DesiredFrameRate = _fps;
        _videoSourcePlayer.VideoSource = _videoCaptureDevice;
        _videoCaptureDevice.NewFrame += _videoCaptureDevice_NewFrame;
        _videoSourcePlayer.Start();

saving frames 保存框架

        if (_videoRecordStatus == VideoRecordStatus.Recording)
        {
            _videoFileWriter.WriteVideoFrame(eventArgs.Frame);
        }

and init file writer 和初始化文件编写器

            _videoFileWriter = new VideoFileWriter();
            _videoFileWriter.Open(_fileName, _videoCaptureDevice.VideoResolution.FrameSize.Width,
                _videoCaptureDevice.VideoResolution.FrameSize.Height, 30, VideoCodec.MPEG4, 10 * 1000 * 1000);

now _videoCaptureDevice.VideoResolution.FrameSize equals 1280x720 and 640x480 (for second device). 现在_videoCaptureDevice.VideoResolution.FrameSize等于1280x720和640x480(对于第二个设备)。 But I already have problems with recording. 但是我已经在录制方面遇到问题了。 Maximum fps is 24 for 480p and 13-14 for 720p (when I try to record videos from 2 cameras in the same time) 对于480p,最大fps是24;对于720p,最大fps是13-14(当我尝试同时记录两个摄像机的视频时)

How to increase it? 如何增加呢? Or it isn't possible? 还是不可能? Maybe more powerfull computer will solve this problem (I have Pentium(R) Dual-Core CPU 2.50Ghz and usual videocart (Geforse 8500 GT) for working with two displays, usual hdd, usb 2.0)? 也许功能更强大的计算机可以解决此问题(我有奔腾®双核CPU 2.50Ghz和常用的视频购物车(Geforse 8500 GT),可以与两个显示器(常用的硬盘,USB 2.0)一起工作吗?

I will glad any help (maybe another library, but not language (c#)) 我会很乐意提供帮助(也许是其他库,但不是语言(c#))

PS I already used Emgu.CV and faced with simular problems.. PS我已经使用过Emgu.CV并面临类似的问题。

The framerate is limited by the hardware. 帧速率受硬件限制。

Use AMCap or GraphEdit to check what your camera really supports. 使用AMCapGraphEdit检查相机真正支持的功能。 It will depend on the choosen resolution and ouput format (higher resolution -> lower framerater). 这将取决于所选的分辨率和输出格式(高分辨率->较低帧速率)。

Be aware that AForge always uses the highest value for all resolutions which can lead to oversampling (eg: AForge produces the rames at 60Hz, but the camera only supports 15Hz at the given resolution, so the images will mostly be duplicates. See here 请注意,AForge始终对所有分辨率使用最高值,这可能会导致过采样(例如:AForge产生60Hz的光圈,但相机在给定的分辨率下仅支持15Hz,因此图像大部分是重复的。请参见此处。

Also use process explorer and a profiler to see how busy your CPU really is and what it is doing. 还可以使用进程资源管理器和事件探查器查看CPU的实际繁忙程度以及它在做什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM