[FFmpeg-devel] Before I *fix this*, please confirm that it is in fact a *bug*

Chris Stones chris.stones
Tue Feb 23 14:11:48 CET 2010

Hey guys.

I suspect that I have found a bug, but am unsure on how you guys
would prefer I fixed it.. or if you even consider it a bug to begin with.

I am converting two collections of images ( input format image2, png
encoding) into a nut containing two snow videos.

ffmpeg -i anim1%d.png -strict -2 -vcodec snow out.nut -i anim2%d.png -strict
-2 -vcodec snow -newvideo

gives: Error while opening encoder for output stream 0.0 - maybe incorrect
parameters such as bit_rate, width, or height.

Okay no, problem... turns out I'm missing pixel format, so I set pixel
format to yuv420p for snow.

ffmpeg -i anim1%d.png -strict -2 -vcodec snow  -pix_fmt yuv420p out.nut -i
anim2%d.png -strict -2 -vcodec snow -newvideo

gives: Input Stream #1.0 frame size changed to 1024x768, bgra.

Okay, no problem.. after a poke around with my debugger, i noticed
ost->resample_pix_fmt is NOT same as ist->st->codes_pix_fmt.. and resample
flag is not set.

In other words, the second input is trying to read image2, png, yuv420p....
the pix_fmt setting I applied for the first output processing is still in

the solution here, is to add -pix_fmt bgra to the input options,
then another -pix_fmt yuv420p to the second output options.

A working command line is.....

ffmpeg \
  -fimage2 -pix_fmt bgra -i anim1%d.png \
  -strict -2 -vcodec snow  -pix_fmt yuv420p out.nut \
  -fimage2 -pix_fmt bgra -i anim2%d.png \
  -strict -2 -vcodec snow -pix_fmt yuv420p -newvideo

What I would consider a *bug* here, is the need for us to specify
the input pixel format of the images.. png's could be bgra or rgb24.
The user needs to know detailed information about the source images, even
though ffmpeg is completely able to figure it out for itself.

What do you guys think? Bug?

Secondly, if you agree that there is anything here to fix, how would
you prefer i go about it ???

I see 3 solutions.

1) Make yuv420p default for the snow video codec... don't error out if
pix_fmt is not specified

2) Prevent a user supplied -pix_fmt from taking effect outside of its
context.. for example, in this case, when supplied as part of the first
encode option, it should not take effect on the following image2 import

3) Add a -pix_fmt auto option to discard any user selected pixel format, and
return to automatically detecting pixel formats.

I have tested both official release 0.5, and the latest SVN as of 22nd
February 2010.Both produce described fault.

More information about the ffmpeg-devel mailing list