[Ffmpeg-devel] lavc crash & qprd plus bframes = low quality

Trent Piepho xyzzy
Sat Dec 9 03:14:14 CET 2006

On Fri, 8 Dec 2006, Corey Hickey wrote:
> > Ok, I've simplified the lavcopts:
> > vcodec=mpeg4:vbitrate=6950:mbd=2 + vmax_b_frames=2 and/or qprd
> ...and vpass=1/vpass=2, I presume?

I was trying to simplify, so I just did one pass encoding.

I have produced a sample clip compressed with ffv1 that can be used to see
these problems.  It also works for the crash I posted about earlier.  It's
156MB, but if I re-scale, compress with mjpeg or nuv, clip more out, etc.
the same problems don't happen.  It was a major PITA just to get it this
small.  I've uploaded it to:


Using latest svn mencoder, unmodified, I get a crash with this command:
mencoder -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=7000:dia=-4:v4mv:qpel:vqmin=2:mbd=2:trell:cbp:sc_factor=4:vmax_b_frames=2:qprd -o /dev/null crash_in_mvsearch.avi

About 16 seconds in, lavc crashes with:
mencoder: motion_est_template.c:1044: epzs_motion_search_internal: Assertion `(P[3][0]>>shift) <= xmax' failed.

I also tried, again using unmodified mencoder, these options:
mencoder -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=7000:mbd=2 -o test.avi crash_in_mvsearch.avi
with qprd, or vmax_b_frames=2, or vmax_b_frames=2:qprd

I also made a sample with xvid (1.1.2):
mencoder -ovc xvid -xvidencopts bitrate=7000:vhq=2:notrellis:noqpel:me_quality=5:bvhq=1:bquant_offset=50:quant_type=mpeg

I turned off stuff like trellis to try to make the comparison more fair,
since the lavc options were simlified to the minimum needed.  Still, xvid
does considerably better than lavc.

You can see the sample frames made from encoding the ffv1 file at
http://www.speakeasy.org/~xyzzy/qprd_b.html now.  There are the three lavc
version (qprd, b-frames, qprd+b-frames) as well as xvid and the original
frame.  The example frame's pts is about 2.314.  The flash from the gun is
just one frame long, so it's easy to find.

As for mencoder output, there isn't much to see there.  Here's an example:
MEncoder dev-SVN-r21539-4.0.1 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) MP Processor 1800+ (Family: 6, Model: 6, Stepping: 2)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE

success: format: 0  data: 0x0 - 0x9bd0ff8
AVI file format detected.
AVI: No audio stream found -> no sound.
VIDEO:  [FFV1]  1280x720  24bpp  23.976 fps  56664.1 kbps (6917.0 kbyte/s)
[V] filefmt:3  fourcc:0x31564646  size:1280x720  fps:23.98  ftime:=0.0417
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffv1] vfm: ffmpeg (FFV1 (lossless codec))
VDec: vo config request - 1280 x 720 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 3)
Movie-Aspect is undefined - no prescaling applied.
videocodec: libavcodec (1280x720 fourcc=34504d46 [FMP4])
Video stream: 6493.494 kbit/s  (811686 B/s)  size: 18721317 bytes  23.065 secs  553 frames [qprd]
Video stream: 6220.051 kbit/s  (777506 B/s)  size: 17932958 bytes  23.065 secs  553 frames [b-frames]
Video stream: 5787.822 kbit/s  (723477 B/s)  size: 16686802 bytes  23.065 secs  553 frames [both]

More information about the ffmpeg-devel mailing list