I make screen recordings with ffmpeg
, using avfoundation
on Mac OS X, x11grab
on Linux and gdigrab
on Windows.
The resulting files should be compatible with modern web browsers (<video/>
), so I use H.264 codec and request YUV 4:2:0 Planar pixel format.
On Mac OS X, however (unlike Linux and Windows), I receive the following logging:
/usr/local/bin/ffmpeg -y -v error -f avfoundation -threads 0 -hide_banner -i 1:none -f mp4 -vcodec h264 -pix_fmt yuv420p -r 25/1 -qscale:v 1 -vf scale=-1:1080 target.mp4
[avfoundation @ 0x7fdba2003a00] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7fdba2003a00] Supported pixel formats:
[avfoundation @ 0x7fdba2003a00] uyvy422
[avfoundation @ 0x7fdba2003a00] yuyv422
[avfoundation @ 0x7fdba2003a00] nv12
[avfoundation @ 0x7fdba2003a00] 0rgb
[avfoundation @ 0x7fdba2003a00] bgr0
Still, according to mplayer
, the resulting MP4 file seems to have YUV 4:2:0 Planar color model:
[h264 @ 0x1048a8ac0]Format yuv420p chosen by get_format().
[h264 @ 0x1048a8ac0]Reinit context to 1728x1088, pix_fmt: yuv420p
[h264 @ 0x1048a8ac0]Format yuv420p chosen by get_format().
[h264 @ 0x1048a8ac0]Reinit context to 1728x1088, pix_fmt: yuv420p
[swscaler @ 0x1048c3cc0]bicubic scaler, from yuv420p to yuyv422 using MMXEXT
*** [scale] Exporting mp_image_t, 1728x1080x12bpp YUV planar, 2799360 bytes
*** [vo] Allocating mp_image_t, 1728x1080x16bpp YUV packed, 3732480 bytes
the same confirmed by ffmpeg
:
$ ffmpeg -i target.mp4 -hide_banner
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'target.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:00:04.72, start: 0.000000, bitrate: 201 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1728x1080, 197 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Questions:
- Can someone explain the above
ffmpeg
logging? - If I still need to convert the
avfoundation
video stream toyuv420p
, how do I make it on the fly (in a singleffmpeg
pass)?