I have to create video in mp4 format, and it seems that I can encode it with different pixel formats like yuv420p, yuv422p, yuvj422p. Which one I should use to maximize compatibility with most browsers/players?
You can use the -vf format=yuv420p (or the alias -pix_fmt yuv420p) output option to make sure your output is YUV 4:2:0.
ffmpeg -i input -c:v libx264 -crf 23 -preset medium -vf format=yuv420p -c:a copy -movflags +faststart output.mp4
-movflags +faststart option is also recommended.-crf and -preset).You can check the pixel format of a video with ffprobe:
$ ffprobe -loglevel error -show_entries stream=pix_fmt -of csv=p=0 input.mp4
yuv420p
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With