[FFmpeg-user] Capturing video using ffmpeg in source format

Moritz Barsnick barsnick at gmx.net
Thu Dec 7 17:25:58 EET 2017


On Wed, Dec 06, 2017 at 15:58:28 +0000, Dhananjay Umap wrote:

> ffmpeg -f video4linux2 -i /dev/video0 -start_number 1 -vframes 250 -c:v mpeg4 -qscale:v 1 test1.avi
> As I can see below the rawvideo is at 1920x1080 format, but the input to the card is 4K as well as the card is 4K capable.

> If I use the following command, I capture 4K video with 25 fps.
> ./ffmpeg -f video4linux2 -i /dev/video0 -s 3840x2160 -start_number 1 -vframes 250 -c:v mpeg4 -qscale:v 1 test.avi
> In this case scaling is performed by the ffmpeg to 4K which affects
> the KPI of the captured video. This also affect the speed of the
> capture since ffmpeg is processing the video to 4K during capture
> which eventually affects the KPI for the captured video.

You need to tell the v4l2 device to choose the correct input
resolution. The input option "-video_size <resolution>" should work.
(You may also want to choose the correct "-pixel_format".)

Yet even then, ffmpeg will convert 3840x2160 (raw) to 3840x2160
(mpeg4), and take about as much CPU as when it does soft upscaling
1920x1080 -> 3840x2160). Only that the quality will be better. You need
to find encoding settings which are faster (at the cost of quality or
size/compression ratio). With x264, I would try various presets, such
as "-preset fast". I'm not sure what to do for the mpeg4 codec, Google
or others on this list should help you. The default of 200 kb/s is
probably the issue, I'm guessing that the codec many be trying really
hard to compress the hell out of your HD images (and won't succeed).

Cheers,
Gruß nach Nürnberg,
Moritz


More information about the ffmpeg-user mailing list