Which pixel format for web mp4 video?

前端 未结 1 795
囚心锁ツ
囚心锁ツ 2021-01-18 05:43

I have to create video in mp4 format, and it seems that I can encode it with different pixel formats like yuv420p, yuv422p, yuvj422p.

相关标签:
1条回答
  • 2021-01-18 06:03

    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
    
    0 讨论(0)
提交回复
热议问题