I have one video with ‘ yuv422p ’ pixel format and I want to change the pixel format of the video ‘ yuv420p ’ with transcoding, is there any parameter in FFmpeg that can help me to specify the pixel format.
Try this one if it works.
-i DJI_0090.MOV -pix_format yuv420p
It doesn’t work for me
Getting the same issue again
$ ffmpeg -i DJI_0090.MOV -pixel_format yuv420p test.mp4
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe2d0002600] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1920x1080): unspecified pixel format.
Consider increasing the value for the ‘analyzeduration’ and ‘probesize’ options.
According to me, FFmpeg provides a
-pix_fmt option for specifying pixel format if you add
-pix_fmt before the input file or
-i parameter then the frame will be read in the specified pixel format input file.
You can also try:
ffmpeg -pix fmts
If you want to see the list of pixel formats.
Got it! Thank you all for your help. It really works.
From the discussion thread, it seems you are trying to change the pixel format of a video file using FFmpeg but encountering some issues. Based on the responses, I’d like to provide a more detailed solution.
The correct syntax for specifying the pixel format is
-pixel_format). To change the pixel format to ‘yuv420p’, you should use the following command:
ffmpeg -i DJI_0090.MOV -pix_fmt yuv420p test.mp4
However, if you’re still encountering the error mentioning ‘unspecified pixel format,’ you might need to increase the ‘analyzeduration’ and ‘probesize’ options, as suggested above. This can be done using the following command:
ffmpeg -probesize 50M -analyzeduration 100M -i DJI_0090.MOV -pix_fmt yuv420p test.mp4
Adjust the values for ‘probesize’ and ‘analyzeduration’ as needed. These options help FFmpeg analyze more data from the input file, enabling it to correctly identify the codec parameters and pixel format.
Additionally, it’s mentioned above that you can use the
ffmpeg -pix_fmts command to see a list of supported pixel formats in FFmpeg, which can be helpful if you need to choose a different format in the future.
I hope this helps you successfully change the pixel format of your video file using FFmpeg. Let me know if you have any further questions or need additional assistance.
Can I convert a video to a specific pixel format without re-encoding the entire video stream?
Yes, without re-encoding the entire video stream, it is possible to convert a video to a particular pixel format, although there are some restrictions. The video codec used in the original video, the source and target pixel formats, and other factors strongly influence whether this is possible.
If the source and desired target pixel formats are both supported and compatible with the video codec, FFmpeg can convert the pixel formats without having to re-encode the entire video. A
bitstream copy is what FFmpeg refers to as this procedure.
Follow these methods to see if your video can be converted to pixel format without re-encoding:
To view comprehensive details about the video file, including the pixel format, use the FFmpeg command:
ffmpeg -i input.mp4
pix_fmt field on the line that begins with `Stream #0:0 (or something similar). This displays the video stream’s current pixel format.
Although FFmpeg supports a large variety of pixel formats, not all of them can be converted without re-encoding. The following command can be used to list the supported pixel formats for a particular codec:
You can proceed with the conversion without re-encoding if the codec supports and is compatible with the chosen target pixel format.
Use the following FFmpeg command to perform the pixel format conversion:
ffmpeg -i input.mp4 -c:v copy -pix_fmt target_format output.mp4
target_format with the desired pixel format (e.g., yuv420p, yuv444p, rgb24, etc.).