3
2
Why does FFmpeg decode a raw video in the YUV420 planar 8 bits pixel format, when it's also encoding the video using the same YUV420p pixel format?
I've ran a couple benchmark tests encoding only raw YUV420p video using the MPEG2 encoder on a FreeScale PowerPC using the following settings:
ffmpeg -f rawvideo -pix_fmt yuv420p -s cif -r 25 -i YUV420p_cif.yuv -vcodec mpeg2video -pix_fmt yuv420p -r 25 -g 25 -s cif -b:v 1024k Output.mp4
The video sequence is 15 minutes long. I found out the entire proces uses:
- 3.9% of time reading the file;
- 3.7% of time decoding;
- 91.2% of time encoding;
- 0.7% of time muxing + writing the file;
- 0.5% of time is initializing / closing ffmpeg
The total process was done in 382 seconds (58.9 fps), so decoding took 14.1 seconds in total. That seems a lot to me!
Since the encoding process is using the YUV420p pixel format, why does FFmpeg needs 3.7% of the time decoding the raw YUV420p to the same format?
I thought YUV420p was the internal format. When I input a raw YUV422 video, it takes like 30 seconds, making like twice the decoding time as YUV420. So, I actually want to know in what form or type the internal data is described then, if it is not subsampled/planar. – Nick van Tilborg – 2013-03-19T17:13:17.517
1Scratch that – each frame can take a different pixel format. What you're seeing is the overhead used for allocating the data and reading it from the file. – slhck – 2013-03-19T18:01:55.480