Which pixel format for web mp4 video?

人盡茶涼 提交于 2019-12-01 16:35:52

问题


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?


回答1:


Use yuv420p

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.

Example

ffmpeg -i input -c:v libx264 -crf 23 -preset medium -vf format=yuv420p -c:a copy -movflags +faststart output.mp4
  • For web video the -movflags +faststart option is also recommended.
  • The audio is being stream copied (re-muxed) in this example instead of being re-encoded. Useful if the input is already AAC.
  • See FFmpeg Wiki: H.264 & H.265 for more info on the encoder specific settings (-crf and -preset).

Determining the pixel format of a video

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


来源:https://stackoverflow.com/questions/32829514/which-pixel-format-for-web-mp4-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!