[Ffmpeg-devel] r6338 broke snow encoding

Luca Abeni lucabe72
Sat Oct 7 00:36:37 CEST 2006

Hi all,

it seems that r6338 broke rate control in snow encoding. Something like
./ffmpeg -y -i /tmp/test.avi -strict -2 -vcodec snow /tmp/out.avi
always returns
FFmpeg version SVN-r6569, Copyright (c) 2000-2006 Fabrice Bellard, et al.
  libavutil version: 49.0.1
  libavcodec version: 51.16.0
  libavformat version: 50.5.0
  built on Oct  7 2006 00:16:13, gcc: 3.3.5 (Debian 1:3.3.5-13)
Input #0, avi, from '/tmp/noncioilcasco.avi':
  Duration: 00:00:23.1, start: 0.000000, bitrate: 1034 kb/s
  Stream #0.0: Video: msmpeg4v2, yuv420p, 360x288, 25.00 fps(r)
  Stream #0.1: Audio: mp3, 44100 Hz, mono, 64 kb/s
Output #0, avi, to '/tmp/c.avi':
  Stream #0.0: Video: snow, yuv420p, 360x288, q=2-31, 200 kb/s, 25.00 fps(c)
  Stream #0.1: Audio: mp2, 44100 Hz, mono, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
Video encoding failed

It looks like ratecontrol_1pass(s, pict) at line 4186 returns a negative
delta_qlog, so encode_frame() fails. Now, I do not fully understand the
ratecontol stuff in snow.c, but it seems to me that a negative
delta_qlog is valid...
On the other hand, encode_frame() does not really seem to use
delta_qlog, but it only needs to check if such value is different from
0, or if ratecontrol_1pass() failed. So, I think the attached patch is
It works correctly for me, but someone with more experience than me in
this field should check the correctness of the patch.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_snow_rc.diff
Type: text/x-patch
Size: 434 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061007/33899234/attachment.bin>

More information about the ffmpeg-devel mailing list