[MPlayer-users] BUG REPORT - divx 2-pass encode audio sync problem

Steven Adeff adeffs at rpi.edu
Sun Apr 20 18:33:25 CEST 2003


First the system information
-	Mandrake 9.1
-	Linux indierocksteve.schwamp.net 2.4.21pre4-6mdk #1 Thu Feb 13 19:33:56 CET 
2003 i686 unknown unknown GNU/Linux
- 	/lib/libc-2.3.1.so*
	/lib/libc.so.6 -> libc-2.3.1.so*
-	XFree86 Version 4.3.0
	Release Date: 27 February 2003
	X Protocol Version 11, Revision 0, Release 6.6
	Build Operating System: Linux 2.4.21-0.13mdksmp i686 [ELF]
	Build Date: 12 March 2003
 	       Before reporting problems, check http://www.XFree86.Org/
	        to make sure that you have the latest version.
	Module Loader present
-	Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2.2/specs
	Configured with: ../configure --prefix=/usr --libdir=/usr/lib 
--with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info 
--enable-shared --enable-threads=posix --disable-checking --enable-long-long 
--enable-__cxa_atexit --enable-languages=c,c++,ada,f77,objc,java 
--host=i586-mandrake-linux-gnu --with-system-zlib
	Thread model: posix
	gcc version 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)
-	GNU ld version 2.13.90.0.18 20030121
-	GNU assembler 2.13.90.0.18 20030121
	Copyright 2002 Free Software Foundation, Inc.
	This program is free software; you may redistribute it under the terms of
	the GNU General Public License.  This program has absolutely no warranty.
	This assembler was configured for a target of `i586-mandrake-linux-gnu'.
-	CPU info
	processor       : 0
	vendor_id       : AuthenticAMD
	cpu family      : 6
	model           : 6
	model name      : AMD Athlon(tm) XP 1600+
	stepping        : 2
	cpu MHz         : 1394.086
	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 apic sep mtrr pge mca 
cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow
	bogomips        : 2785.28

ok, I have a script that I use to create divx files. It used to work 
fine(6months ago or so), the only thing to change is the version of mencoder 
I'm using. I used to be able to encode 30+minute mpegs with no desync. Now 
when I encode 30mins(for archiving tivo'd shows) there is a noticable lag by 
the end of the video. There is no lag at the begining, it gets worse over the 
course of the video. This makes me think the audio and video are at a 
different time rate(if that makes sense to anyone but me). Here is the output 
during a regular encoding process of a ~30min video. I'll then paste the bash 
script code.

----------------------------------OUTPUT--------------------------------------------------
[adeffs at indierocksteve FamilyBusiness]$ mpeg2divx 
FamilyBusiness-S01E01-Personal_Ads.mpg 16000
using bitrate of 16000

We will now convert "FamilyBusiness-S01E01-Personal_Ads.mpg" to a divx file...

frameno.avi not found, not a problem, it just means we have nothing to delete.

lavc_stats.txt not found, not a problem, it just means we have nothing to 
delete.

Beginning Audio Encoding...

Using GNU internationalization
Original domain: messages
Original dirname: /usr/share/locale
Current domain: mplayer
Current dirname: /usr/local/share/locale


MEncoder 0.90rc5-3.2.2 (C) 2000-2003 Arpad Gereoffy (see DOCS)

CPU: Advanced Micro Devices Athlon 4 PM Palomino/Athlon MP 
Multiprocessor/Athlon XP eXtreme Performance (Family: 
6, Stepping: 2)
Detected cache-line size is 64 bytes
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Reading /home/adeffs/.mplayer/codecs.conf: can't open 
'/home/adeffs/.mplayer/codecs.conf': No such file or 
directory
Reading /usr/local/etc/mplayer/codecs.conf: 50 audio & 136 video codecs
File not found: 'frameno.avi'
Reading config file /home/adeffs/.mplayer/mencoder: No such file or directory
success: format: 0  data: 0x0 - 0x55CDC000
MPEG-PS file format detected.
VIDEO:  MPEG2  480x480  (aspect 2)  29.97 fps  5800.0 kbps (725.0 kbyte/s)
[V] filefmt:2  fourcc:0x10000002  size:480x480  fps:29.97  ftime:=0.0334
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
MP3lib: init layer2&3 finished, tables done
AUDIO: 44100 Hz, 2 ch, 16 bit (0x10), ratio: 28000->176400 (224.0 kbit)
Selected audio codec: [mp3] afm:mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
MP3 audio selected
Building audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
Writing AVI header...
Pos:   0.9s     28f ( 0%)   0fps Trem:   0min   0mb  A-V:0.069 [0:145]
Skipping frame!
Pos:   2.2s     66f ( 0%)   0fps Trem:   5min  32mb  A-V:0.067 [0:148]
Skipping frame!
Pos:1878.5s  56301f (100%) 235fps Trem:   0min  33mb  A-V:-0.005 [0:144]
Writing AVI index...
Fixing AVI header...
Recommended video bitrate for 650MB CD: 2743
Recommended video bitrate for 700MB CD: 2967
Recommended video bitrate for 800MB CD: 3413
Recommended video bitrate for 2 x 650MB CD: 5646
Recommended video bitrate for 2 x 700MB CD: 6093
Recommended video bitrate for 2 x 800MB CD: 6986

Video stream:    0.959 kbit/s  (119 bps)  size: 225196 bytes  1878.518 secs  
56301 frames

Audio stream:  144.406 kbit/s  (18050 bps)  size: 33918068 bytes  1879.040 
secs
Audio encoding done, starting video encoding pass 1

Using GNU internationalization
Original domain: messages
Original dirname: /usr/share/locale
Current domain: mplayer
Current dirname: /usr/local/share/locale


MEncoder 0.90rc5-3.2.2 (C) 2000-2003 Arpad Gereoffy (see DOCS)

CPU: Advanced Micro Devices Athlon 4 PM Palomino/Athlon MP 
Multiprocessor/Athlon XP eXtreme Performance (Family: 
6, Stepping: 2)
Detected cache-line size is 64 bytes
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Reading /home/adeffs/.mplayer/codecs.conf: can't open 
'/home/adeffs/.mplayer/codecs.conf': No such file or 
directory
Reading /usr/local/etc/mplayer/codecs.conf: 50 audio & 136 video codecs
AVI file format detected.
VIDEO:  [FrNo]  480x480  24bpp  29.97 fps    1.0 kbps ( 0.1 kbyte/s)
Using pass3 control  frameno.avi
Reading config file /home/adeffs/.mplayer/mencoder: No such file or directory
success: format: 0  data: 0x0 - 0x55CDC000
MPEG-PS file format detected.
VIDEO:  MPEG2  480x480  (aspect 2)  29.97 fps  5800.0 kbps (725.0 kbyte/s)
[V] filefmt:2  fourcc:0x10000002  size:480x480  fps:29.97  ftime:=0.0334
Opening video filter: [expand=-1:-1:-1:-1:1]
Expand: -1 x -1, -1 ; -1  (-1=autodetect) osd: 1
Opening video filter: [pp=ci]
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 480 x 480 (preferred csp: Mpeg PES)
[PP] Using external postprocessing filter, max q = 6.
Could not find matching colorspace - retrying with -vop scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder v2.0
libmpeg2: Using MMXEXT for IDCT transform
libmpeg2: Using MMXEXT for motion compensation
VDec: vo config request - 480 x 480 (preferred csp: Planar YV12)
[PP] Using external postprocessing filter, max q = 6.
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
videocodec: libavcodec (480x480 fourcc=58564944 [DIVX])
High quality encoding selected (non real time)!
Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2 (libmpeg2))
==========================================================================
audiocodec: framecopy (format=55 chans=2 rate=44100 bits=0 bps=18051 sample=0)
Writing AVI header...
New_Face failed. Maybe the font path is wrong.  0mb  A-V:0.000 [0:0]
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
Pos:   0.9s     28f ( 0%)   0fps Trem:   0min   0mb  A-V:0.000 [0:145]
Skipping frame!
Pos:   2.1s     66f ( 0%)  38fps Trem:  24min 119mb  A-V:0.000 [361:148]
Skipping frame!
Pos:1878.5s  56301f (99%)  33fps Trem:   0min 717mb  A-V:0.000 [3053:144]
Writing AVI index...
Fixing AVI header...

Video stream: 3053.392 kbit/s  (381673 bps)  size: 716968710 bytes  1878.485 
secs  56301 frames

Audio stream:  144.405 kbit/s  (18050 bps)  size: 33916502 bytes  1878.962 
secs
Video Pass 1 done, beginning video encoding pass 2

Using GNU internationalization
Original domain: messages
Original dirname: /usr/share/locale
Current domain: mplayer
Current dirname: /usr/local/share/locale


MEncoder 0.90rc5-3.2.2 (C) 2000-2003 Arpad Gereoffy (see DOCS)

CPU: Advanced Micro Devices Athlon 4 PM Palomino/Athlon MP 
Multiprocessor/Athlon XP eXtreme Performance (Family: 
6, Stepping: 2)
Detected cache-line size is 64 bytes
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Reading /home/adeffs/.mplayer/codecs.conf: can't open 
'/home/adeffs/.mplayer/codecs.conf': No such file or 
directory
Reading /usr/local/etc/mplayer/codecs.conf: 50 audio & 136 video codecs
AVI file format detected.
VIDEO:  [FrNo]  480x480  24bpp  29.97 fps    1.0 kbps ( 0.1 kbyte/s)
Using pass3 control  frameno.avi
Reading config file /home/adeffs/.mplayer/mencoder: No such file or directory
success: format: 0  data: 0x0 - 0x55CDC000
MPEG-PS file format detected.
VIDEO:  MPEG2  480x480  (aspect 2)  29.97 fps  5800.0 kbps (725.0 kbyte/s)
[V] filefmt:2  fourcc:0x10000002  size:480x480  fps:29.97  ftime:=0.0334
Opening video filter: [expand=-1:-1:-1:-1:1]
Expand: -1 x -1, -1 ; -1  (-1=autodetect) osd: 1
Opening video filter: [pp=ci]
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 480 x 480 (preferred csp: Mpeg PES)
[PP] Using external postprocessing filter, max q = 6.
Could not find matching colorspace - retrying with -vop scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder v2.0
libmpeg2: Using MMXEXT for IDCT transform
libmpeg2: Using MMXEXT for motion compensation
VDec: vo config request - 480 x 480 (preferred csp: Planar YV12)
[PP] Using external postprocessing filter, max q = 6.
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
videocodec: libavcodec (480x480 fourcc=58564944 [DIVX])
High quality encoding selected (non real time)!
Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2 (libmpeg2))
==========================================================================
audiocodec: framecopy (format=55 chans=2 rate=44100 bits=0 bps=18051 sample=0)
Writing AVI header...
New_Face failed. Maybe the font path is wrong.  0mb  A-V:0.000 [0:0]
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
Pos:   0.9s     28f ( 0%)   0fps Trem:   0min   0mb  A-V:0.000 [0:145]
Skipping frame!
Pos:   2.1s     66f ( 0%)  36fps Trem:  26min 120mb  A-V:0.000 [366:148]
Skipping frame!
Pos:1878.5s  56301f (99%)  33fps Trem:   0min 716mb  A-V:0.000 [3051:144]
Writing AVI index...
Fixing AVI header...

Video stream: 3051.957 kbit/s  (381494 bps)  size: 716631788 bytes  1878.485 
secs  56301 frames

Audio stream:  144.405 kbit/s  (18050 bps)  size: 33916502 bytes  1878.962 
secs
Video Pass 2 done, file renaming time

renaming output file
Done converting!!
----------------------------------OUTPUT--------------------------------------------------

Here's the code of the script I use...

---------------------------------SCRIPT----------------------------------------------------

#!/bin/bash
# MPEG2DIVX version 1.2 by Steven Adeff
# converts mpeg files to divx files with mp3 audio
# requries mencoder with lame and lavcodec support compiled in
# this script is designed for tivo mpegs but should work
# with most mpeg files.
# things to change for better quality are the audio settings
# and video bitrate used.
#
# This program is copyleft by Steven Adeff (tincanfury at yahoo.com),
# use it and abuse it in anyway you want, just please keep a note
# that the original source was written by me and include my above
# noted email address. If you improve the script in some way, email
# me the changes so that I can incorporate it my official version.
#
# Thanks!


if [ -n "$1" ]
then
	filename=$1
else
	echo "no file name given."
	echo
	filename=--help
fi

if [ $filename == "--help" ]
then
        echo "mpeg2divx 1.2"
        echo "A simple script to encode mpg to 3-pass divx with mp3 audio"
        echo
        echo "Usage:"
        echo "        mpeg2divx mpegfilename.mpg bitrate"
        echo
        echo "the final filename will mimic the input filename with divx as 
the extension"
        echo "bitrate can be anywhere between 4 and 16000 (in Kbit) with 800 
as the default."
	echo 
	echo "this script requires mplayer's mencoder with lame and ffmpeg support 
compiled in"
	echo "http://www.mplayerhq.hu"
        echo
        echo "script version 1.2, copyright Steven Adeff 
(tincanfury at yahoo.com)"
        echo
        echo
        exit 1
fi

if [ -n "$2" ]
then
	bitrate=$2
	echo "using bitrate of "$bitrate
else
	bitrate=800
	echo "using default bitrate of 800"
fi

echo
echo "We will now convert \"$1\" to a divx file..."
echo

if [ -e "frameno.avi" ]
then
	rm frameno.avi -f
else
	echo "frameno.avi not found, not a problem, it just means we have nothing to 
delete."
	echo
fi
if [ -e "lavc_stats.txt" ]
then
        rm lavc_stats.txt -f
else
        echo "lavc_stats.txt not found, not a problem, it just means we have 
nothing to delete."
        echo
fi

echo "Beginning Audio Encoding..."
echo

mencoder $1 -ovc frameno -oac mp3lame -lameopts br=128:vbr=4:q=0 -o 
frameno.avi
if [ $? -eq 0 ]
then
	echo "Audio encoding done, starting video encoding pass 1"
	echo
else
	echo "Audio encoding failed, exiting"
	exit 1
fi

mencoder $1 -vop pp=ci -ovc lavc -lavcopts 
vcodec=mpeg4:vhq:v4mv:vqmin=2:vqmax=31:vbitrate=$bitrate:vpass=1 -oac copy 
-sws 2 -o output.avi
if [ $? -eq 0 ]
then
	echo "Video Pass 1 done, beginning video encoding pass 2"
	echo
else
	echo "Video encoding pass 1 failed, exiting"
	exit 1
fi

mencoder $1 -vop pp=ci -ovc lavc -lavcopts 
vcodec=mpeg4:vhq:v4mv:vqmin=2:vqmax=31:vbitrate=$bitrate:vpass=2 -oac copy 
-sws 2 -o output.avi
if [ $? -eq 0 ]
then
	echo "Video Pass 2 done, file renaming time"
	echo
else
	echo "Video encoding pass 2 failed,exiting"
	exit 1
fi

if [ -e "output.avi" ]
then
	echo "renaming output file"
	filename=${filename%.*g}
	mv output.avi $filename.divx
else
	echo "conversion failed at some point, no output.avi file found"
	exit 1
fi

echo "Done converting!!"
rm frameno.avi -f
rm lavc_stats.txt -f
ls -lh $filename*
---------------------------------SCRIPT----------------------------------------------------

Now, this problem is really annoying to me, so D Richard Felker III, if you'd 
like I can setup a user account for you on my system if it will help solve 
the problem.

Thanks, lets hope we can nip this bug in the proverbial 'ass'!

p.s. I hope I got this bug report filled out correctly.

-- 

Steven Adeff
ADEFFS at RPI.EDU
Graduate, Electric Power Engineering
Rensselaer Polytechnic Institute - Troy, NY



More information about the MPlayer-users mailing list