FFmpeg: How to Change Video Pixel Format

Updated

Learn how to change the pixel format of a video using FFmpeg

FFmpeg: How to Change Video Pixel Format

All you need for this tutorial is FFmpeg installed on your computer and a terminal window opened to the folder containing your video.

First, let's check the current pixel format and details of your video by running:

ffmpeg -i input.mp4

Look at the video stream information line in the output, and you'll see the current pixel format listed next to the video codec.

Now, to convert your video to a widely supported pixel format like yuv420p, run:

ffmpeg -i input.mp4 -pix_fmt yuv420p output.mp4

Depending on your file size and computer speed, FFmpeg will take a few moments to re-encode the video.

Once the command finishes, let's verify that the pixel format updated properly by running:

ffmpeg -i output.mp4

Check the stream details again, and you should now see yuv420p listed as the pixel format.

Just remember: yuv420p is the standard pixel format required by QuickTime Player, modern web browsers, and most video editors, so converting to it will fix most black screen or playback issues.