[FFmpeg-user] Capturing video using ffmpeg in source format
Dhananjay Umap
Dhananjay.Umap at sigos.com
Wed Dec 6 17:58:28 EET 2017
Hi,
We want to capture the 4K video without ffmpeg scaling the video to 4K. The input signal is at HDMI 4K and the capture card is a 4K card.
We want to capture the video without scaling introduced by ffmpeg to 4K i.e. if video stream is HD then HD video capture, if the video is 4K then 4K video would be captured.
Hence I prefer to use this command:
ffmpeg -f video4linux2 -i /dev/video0 -start_number 1 -vframes 250 -c:v mpeg4 -qscale:v 1 test1.avi
I am using SuSE Sled 12, kernel 4.4.73 kernel version. The installed rpm libraries for Video4Linux2 on our system.
libv4lconvert0-0.8.9-6.107.x86_64
libv4l-0.8.9-6.107.x86_64
libv4l-devel-0.8.9-6.107.x86_64
libv4l2-0-0.8.9-6.107.x86_64
libv4l1-0-0.8.9-6.107.x86_64
I believe the installed libraries support 4K content by default
./ffmpeg -f v4l2 -list_formats all -i /dev/video0
ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.8 (SUSE Linux)
configuration: --enable-gpl --enable-version3 --enable-debug --enable-ffplay --enable-fontconfig --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libxvid
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
[video4linux2,v4l2 @ 0x20a4980] Raw : yuyv422 : YUYV 4:2:2 : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : uyvy422 : UYVY 4:2:2 : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : nv12 : Y/CbCr 4:2:0 : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : yuv420p : Planar YVU 4:2:0 : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : yuv420p : Planar YUV 4:2:0 : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : rgb24 : 24-bit RGB 8-8-8 : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : 0rgb : 32-bit A/XRGB 8-8-8-8 : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : bgr24 : 24-bit BGR 8-8-8 : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : bgr0 : 32-bit BGRA/X 8-8-8-8 : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : gray : 8-bit Greyscale : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : gray16le : 16-bit Greyscale : {48-4096, 1}x{32-2160, 1}
[video4linux2,v4l2 @ 0x20a4980] Raw : Unsupported : 32-bit A/XYUV 8-8-8-8 : {48-4096, 1}x{32-2160, 1}
If I use the following command, I capture HD video with 25 fps:
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.
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 75555.202508, bitrate: 622080 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 622080 kb/s, 25 fps, 25 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, avi, to 'test.avi':
Metadata:
ISFT : Lavf57.83.100
Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 mpeg4
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame= 44 fps= 25 q=1.0 Lsize= 5607kB time=00:00:01.76 bitrate=26097.0kbits/s speed=1.01x
video:5600kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.117881%
Exiting normally, received signal 2.
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.
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 73446.222527, bitrate: 622080 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 622080 kb/s, 25 fps, 25 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, avi, to 'netflixtest4.avi':
Metadata:
ISFT : Lavf57.83.100
Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 3840x2160, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 mpeg4
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame= 32 fps= 11 q=1.0 Lsize= 7127kB time=00:00:01.28 bitrate=45610.7kbits/s speed=0.45x
video:7120kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.088695%
Q: How can I capture a video in default format at which it is transmitted without ffmpeg upscaling downscaling the captured content?
The default format meaning if its HD video then HD capturing and if it is 4K video then 4K capture. No processing done by ffmpeg during the capture of the video content.
Kind Regards
Dhananjay Umap
Software Engineer
--
SIGOS
Klingenhofstrasse 50d
90411 Nuernberg
GERMANY
Tel.: +49 911 95168-0
www.sigos.com<http://www.sigos.com>
HRB 9323 Nuernberg
Gerichtsstand: Nuernberg
Geschaeftsfuehrer: Adil Kaya, John van Siclen, Kevin Burns
Follow us on: linkedin<https://www.linkedin.com/company/253905?trk=tyah&trkInfo=clickedVertical%3Acompany%2CclickedEntityId%3A253905%2Cidx%3A2-1-2%2CtarId%3A1453450966999%2Ctas%3Asigos> | xing<https://www.xing.com/companies/sigosgmbh/> | twitter<https://twitter.com/sigos_global/> | facebook<https://www.facebook.com/sigos.global/>
More information about the ffmpeg-user
mailing list