[Ffmpeg-devel] Rate control and H.264

Juan Jose Galvez jjgalvez
Fri Dec 2 11:46:29 CET 2005


Hello,

As I pointed out, I was having some strange issues encoding a file.

I've found one source of the problem. I've seen that using Quicktime files 
(movie trailers for Quicktime encoded as SVQ3/MP2 or SVQ3/QDM2) as input 
sources for encoding, FFMPEG reports that the framerate of the SVQ3 input 
video stream is 600 fps. Thus, if I don't explicitly define the target 
framerate, the encoding process doesn't work well, and the generated file 
isn't playable (VLC says video framerate of the output file is 600fps).

If a specify a target framerate it works:
./ffmpeg.exe -i video.mov -r 25 -vcodec mpeg4 -b 1000 test.avi

This problem obtaining the framerate from a Quicktime file doesn't happen in 
a snapshot I have from 2005-04-16.


But now I'm having another issue with ratecontrol. When encoding H.264, 
ffmpeg seems to have a hard time mantaining the desired bitrate, specially 
at low bitrates (this doesn't happen encoding with MPEG4). Using the 
-maxrate, -minrate and -bufsize options helps, but doesn't achieve the 
desired bitrate. If I don't use the -maxrate, -minrate and -bufsize options 
the encoder seems to ignore the bitrate I specify, and depending on the 
video source, it seems to converge to some bitrate. I tested encoding the 
video with the same parameters using VLC and I get the desired bitrate.


Is this a known issue?


Here are some examples:

Video input sample 1 (quicktime mov, SVQ3/QDM2). Audio output is MP2 64kbps:
- If I specify 512 kbps without rate control options, the resulting average 
bitrate is 1000 kbps (summing audio and video)
- If I specify 512 kbps with rc options, the resulting average bitrate is 
700 kbps
	(-maxrate 512 -minrate 0 -bufsize 50)
- If I specify 2000 kbps without rc options, the resulting average bitrate 
is 1000 kbps.
- If I specify 2000 kbps with rc options, the resulting average bitrate is 
2000 kbps.
	-maxrate 2000 -minrate 0 -bufsize 50
- If I specify 300 kbps without rc options, the resulting average bitrate is 
1000 kbps.
- If I specify 300 kbps with rc options, the resulting average bitrate is 
540 kbps.
	-maxrate 300 -minrate 0 -bufsize 20

Video input sample 2 (avi encoded with MPEG4/MP3). Audio output is MP2 
64kbps:
- If I specify 512 kbps without rc options, the resulting average bitrate is 
733 kbps (summing audio and video)
- If I specify 512 kbps with rc options, the resulting average bitrate is 
600 kbps
	(-maxrate 512 -minrate 0 -bufsize 50)
- If I specify 2000 kbps without rc options, the resulting average bitrate 
is 720 kbps.
- If I specify 2000 kbps with rc options, the resulting average bitrate is 
2000 kbps.
	-maxrate 2000 -minrate 0 -bufsize 50
- If I specify 300 kbps without rc options, the resulting average bitrate is 
750 kbps.
- If I specify 300 kbps with rc options, the resulting average bitrate is 
450 kbps.
	-maxrate 300 -minrate 0 -bufsize 20

Regards,
Juan Jose

_________________________________________________________________
?Est?s pensando en cambiar de coche? Todas los modelos de serie y extras en 
MSN Motor. http://motor.msn.es/researchcentre/





More information about the ffmpeg-devel mailing list