[Mplayer-advusers] [BUG?] MEncoder/lavc assertion failed in ratecontrol.c:587

Dominik 'Rathann' Mierzejewski dominik at rangers.eu.org
Fri Dec 5 19:36:56 CET 2003


Hello.
I'm trying to encode the 2001: A Space Odyssey DVD to mpeg4 using lavc
on to 2 CDs, preserving original audio stream.
Unfortunately, mencoder seems to be unable to complete the second pass,
the assertion
libavcodec/ratecontrol.c:587:
[...]
    if(s->flags&CODEC_FLAG_PASS2){
        assert(picture_number>=0);
        assert(picture_number<rcc->num_entries);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        rce= &rcc->entry[picture_number];
        wanted_bits= rce->expected_bits;
    }else{
        rce= &local_rce;
        wanted_bits= (uint64_t)(s->bit_rate*(double)picture_number/fps);
    }
[...]
always fails on the last frame.
Even stranger, this happens only if I encode chapters 1-16 or 1-17. If
I encode only chapter 16 or 17, all is fine.

I've tried MEncoder-CVS 2003/11/30 and 2003/12/02 (with the same
libavcodec versions), both exhibit the same behaviour

$ mplayer -identify -frames 0 dvd://1
MPlayer dev-RPM-CVS-031202-20:02-3.2.2 (C) 2000-2003 MPlayer Team

CPU: Advanced Micro Devices Athlon Thunderbird 1173 MHz (Family: 6, Stepping: 2)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx

Reading config file /etc/mplayer/mplayer.conf
Reading config file /home/dominik/.mplayer/config
Reading /home/dominik/.mplayer/codecs.conf: 60 audio & 151 video codecs
font: can't open file: /home/dominik/.mplayer/font/font.desc
font: can't open file: /usr/share/mplayer/font/font.desc
Using Linux hardware RTC timing (1024Hz).
Can't open input config file /home/dominik/.mplayer/input.conf: Nie ma takiego pliku ani katalogu
Input config file /etc/mplayer/input.conf parsed: 53 binds

Playing dvd://1.
libdvdread: Couldn't find device name.
Reading disc structure, please wait...
There are 3 titles on this DVD.
There are 32 chapters in this DVD title.
There are 1 angles in this DVD title.
DVD successfully opened.
Selected DVD audio channel: 128 language: en
Cache fill: 19,24% (1613824 bytes)    MPEG-PS file format detected.
VIDEO:  MPEG2  720x576  (aspect 3)  25,000 fps  7500,0 kbps (937,5 kbyte/s)
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using 3DNowEx optimized IMDCT transform
AC3: 5.1 (3f+2r+lfe)  48000 Hz  384,0 kbit/s
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, 16 bit (0x10), ratio: 48000->192000 (384,0 kbit)
Selected audio codec: [a52] afm:liba52 (AC3-liba52)
==========================================================================
ID_FILENAME=dvd://1
ID_VIDEO_FORMAT=0x10000002
ID_VIDEO_BITRATE=7500000
ID_VIDEO_WIDTH=720
ID_VIDEO_HEIGHT=576
ID_VIDEO_FPS=25,000
ID_VIDEO_ASPECT=1,7778
ID_AUDIO_CODEC=a52
ID_AUDIO_FORMAT=8192
ID_AUDIO_BITRATE=384000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_LENGTH=7217
vo: X11 running at 1024x768 with depth 24 and 32 bpp (":0" => local display)
Disabling DPMS
==========================================================================
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.3.1
Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2 (libmpeg2))
==========================================================================
Checking audio filter chain for 48000Hz/2ch/16bit -> 48000Hz/2ch/16bit...
AF_pre: af format: 2 bps, 2 ch, 48000 hz, little endian signed int 
AF_pre: 48000Hz 2ch Signed 16-bit (Little-Endian)
AO: [oss] 44100Hz 2ch Signed 16-bit (Little-Endian) (2 bps)
Building audio filter chain for 48000Hz/2ch/16bit -> 44100Hz/2ch/16bit...
Starting playback...


Exiting... (End of file)

This:

nice mencoder dvd://1 -chapter 1-16 -noaspect -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1032000:vqmin=2:vqmax=12:vqcomp=0.7:keyint=120:psnr:naq:v4mv:vlelim=-2:vcelim=7:lumi_mask=0.05:dark_mask=0.01:trell:mbd=2:mv0:cbp:qpel:precmp=2:cmp=2:subcmp=2:mbcmp=2:vmax_b_frames=1:vqdiff=5:vqblur=0.3:vpass=1 -sws 10 -vf crop=716:472:2:52,scale=640:352 -oac copy -o 2001.part1.avi

completes fine, but this doesn't:
nice mencoder dvd://1 -chapter 1-16 -noaspect -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1032000:vqmin=2:vqmax=12:vqcomp=0.7:keyint=120:psnr:naq:v4mv:vlelim=-2:vcelim=7:lumi_mask=0.05:dark_mask=0.01:trell:mbd=2:mv0:cbp:qpel:precmp=2:cmp=2:subcmp=2:mbcmp=2:vmax_b_frames=1:vpass=2 -sws 10 -vf crop=716:472:2:52,scale=640:352 -oac copy -o 2001.part1.avi

MEncoder dev-RPM-CVS-031202-20:02-3.2.2 (C) 2000-2003 MPlayer Team

CPU: Advanced Micro Devices Athlon Thunderbird 1000 MHz (Family: 6, Stepping: 2)
Detected cache-line size is 64 bytes
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx

Reading /home/dominik/.mplayer/codecs.conf: 60 audio & 151 video codecs
File not found: 'frameno.avi'
Failed to open frameno.avi
Reading config file /home/dominik/.mplayer/mencoder
libdvdread: Couldn't find device name.
Reading disc structure, please wait...
There are 3 titles on this DVD.
There are 32 chapters in this DVD title.
There are 1 angles in this DVD title.
DVD successfully opened.
success: format: 0  data: 0x720000 - 0xC6EB8800
Selected DVD audio channel: 128 language: en
MPEG-PS file format detected.
VIDEO:  MPEG2  720x576  (aspect 3)  25,000 fps  7500,0 kbps (937,5 kbyte/s)
[V] filefmt:2  fourcc:0x10000002  size:720x576  fps:25,00  ftime:=0,0400
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using 3DNowEx optimized IMDCT transform
AC3: 5.1 (3f+2r+lfe)  48000 Hz  384,0 kbit/s
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, 16 bit (0x10), ratio: 48000->192000 (384,0 kbit)
Selected audio codec: [a52] afm:liba52 (AC3-liba52)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1  (-1=autodetect) osd: 1
Opening video filter: [scale w=640 h=352]
Opening video filter: [crop w=716 h=472 x=2 y=52]
Crop: 716 x 472, 2 ; 52
==========================================================================
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.3.1
Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2 (libmpeg2))
==========================================================================
audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 bps=48000 sample=1)
Writing AVI header...
VDec: vo config request - 720 x 576 (preferred csp: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
SwScaler: reducing / aligning filtersize 24 -> 12
SwScaler: reducing / aligning filtersize 24 -> 12
SwScaler: reducing / aligning filtersize 28 -> 13
SwScaler: reducing / aligning filtersize 28 -> 13

SwScaler: Bicubic spline scaler, from Planar YV12 to Planar YV12 using MMX2
videocodec: libavcodec (640x352 fourcc=58564944 [DIVX])
High quality encoding selected (non real time)!
Pos:   0,8s     22f ( 0%)   1fps Trem:   0min   0mb  A-V:0,084 [0:384]
Skipping frame!
Pos:   1,7s     44f ( 0%)   2fps Trem:   0min   0mb  A-V:0,080 [23:384]
Skipping frame!
mencoder: ratecontrol.c:587: ff_rate_estimate_qscale: `picture_number<rcc->num_entries' assertion failed.
/home/dominik/bin/dvd2divx: line 37: 28260 Interrupted               (core dumped) $NICE mencoder $OPTS -ovc lavc -lavcopts $LAVCOPTS:vpass=2 $VOPTS -oac copy -o "$OUT"

Sorry for not giving -v output, but I'd have to wait about 12 hours to get it,
because I'm encoding over a slow 10Mbit SMB mount. :( Any clues?

Additional information:

RedHat 7.3
$ uname -a
Linux rathann.pekin.net.pl 2.4.23-lm2-lv #8 wto gru 2 04:57:28 CET 2003 i686 unknown
$ ls -l /lib/libc[.-]*
-rwxr-xr-x    1 root     root      1260480 lis  5 18:07 /lib/libc-2.2.5.so
lrwxrwxrwx    1 root     root           13 lis 16 12:06 /lib/libc.so.6 -> libc-2.2.5.so
$ gcc32 -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
$ ld -v
GNU ld version 2.13.90.0.2 20020802
$ as --version
GNU assembler 2.13.90.0.2 20020802
$ cat /proc/cpuinfo 
processor	: 0
vendor_id	: AuthenticAMD
cpu family	: 6
model		: 4
model name	: AMD Athlon(tm) processor
stepping	: 2
cpu MHz		: 1000.073
cache size	: 256 KB
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 1
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr syscall mmxext 3dnowext 3dnow
bogomips	: 1992.29
$ lspci
[...]
01:00.0 VGA compatible controller: nVidia Corporation NV10 [GeForce 256 SDR] (rev 10)
$ cat /proc/driver/nvidia/version 
NVRM version: NVIDIA Linux x86 nvidia.o Kernel Module  1.0-4496  Wed Jul 16 19:03:09 PDT 2003
$ cat /proc/isapnp 
Card 1 'CTL0044:Creative SB32 PnP' PnP version 1.0 Product version 1.0
$ grep SB /var/log/dmesg
sb: Creative SB32 PnP detected
sb: ISAPnP reports 'Creative SB32 PnP' at i/o 0x220, irq 5, dma 1, 5

-- 
MPlayer RPMs maintainer: http://www.piorunek.pl/~dominik/linux/pkgs/mplayer/
"The Universe doesn't give you any points for doing things that are easy."
        -- Sheridan to Garibaldi in Babylon 5:"The Geometry of Shadows"



More information about the MPlayer-advusers mailing list