[Ffmpeg-devel] [BUG] converting mpeg4/mp3 to mpeg2video/mp3

Cyrus A lists
Mon Nov 13 18:20:21 CET 2006


Cyrus A wrote:
> I have encountered a problem trying to reencode an mpeg4/mp3 avi into 
> an mpeg2video/mp3 mpg file.
>
> The original MPEG-4 file is captured from an ivtv video capture device 
> with the following command:
>
> [cyrus at wkyt ffmpeg_6967]$ ./ffmpeg -i /dev/video0 -async 1 -y -vcodec 
> mpeg4 -acodec mp3 -t 2080 -b 1750k -ab 192 -ar 44100 -s 480x384 -vtag 
> DX50 '/usr/local/apache-tomcat/webapps/ROOT/test_for_ffmpeg-devel.avi'
> FFmpeg version SVN-r6967, Copyright (c) 2000-2006 Fabrice Bellard, et al.
>  configuration:  --enable-mp3lame
>  libavutil version: 49.0.2
>  libavcodec version: 51.25.0
>  libavformat version: 51.6.0
>  built on Nov 11 2006 00:00:13, gcc: 4.1.1 20060525 (Red Hat 4.1.1-1)
> Input #0, mpeg, from '/dev/video0':
>  Duration: N/A, bitrate: 9984 kb/s
>  Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x480, 9600 kb/s, 
> 29.97 fps(r)
>  Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, 384 kb/s
> Output #0, avi, to 
> '/usr/local/apache-tomcat/webapps/ROOT/test_for_ffmpeg-devel.avi':
>  Stream #0.0: Video: mpeg4, yuv420p, 480x384, q=2-31, 1750 kb/s, 29.97 
> fps(c)
>  Stream #0.1: Audio: mp3, 44100 Hz, stereo, 192 kb/s
> Stream mapping:
>  Stream #0.0 -> #0.0
>  Stream #0.1 -> #0.1
> Press [q] to stop encoding
> [mp3 @ 0x964210]lame: output buffer too small (buffer index: 592, free 
> bytes: 1712)
> frame=  304 q=3.6 Lsize=    2570kB time=10.1 bitrate=2077.0kbits/s   
> video:2258kB audio:238kB global headers:0kB muxing overhead 2.975545%
>
> The resulting avi file can be downloaded here: 
> http://wkyt.dynalias.com/test_for_ffmpeg-devel.avi . As you can see, 
> the file looks good and plays perfectly.
>
> The mpeg2video command I've been using (among others is):
>
> [cyrus at wkyt ffmpeg_6967]$ ./ffmpeg -v 0 -b 600 -y  -i 
> /usr/local/jakarta-tomcat/webapps/ROOT/test_for_ffmpeg-devel.avi 
> -acodec mp3 -vcodec mpeg2video 
> /usr/local/jakarta-tomcat/webapps/ROOT/test_for_ffmpeg-devel.mpg
> FFmpeg version SVN-r6967, Copyright (c) 2000-2006 Fabrice Bellard, et al.
>  configuration:  --enable-mp3lame
>  libavutil version: 49.0.2
>  libavcodec version: 51.25.0
>  libavformat version: 51.6.0
>  built on Nov 11 2006 00:00:13, gcc: 4.1.1 20060525 (Red Hat 4.1.1-1)
>
> Seems that stream 0 comes from film source: 30000.00 (30000/1) -> 
> 29.97 (30000/1001)
> Stream mapping:
>  Stream #0.0 -> #0.0
>  Stream #0.1 -> #0.1
> Press [q] to stop encoding
> invalid new backstep 590
> invalid new backstep 591
> invalid new backstep 591
> invalid new backstep 591
> invalid new backstep 591
> invalid new backstep 591
> invalid new backstep 591
> invalid new backstep 591
> invalid new backstep 591
> invalid new backstep 591
> invalid new backstep 591
> invalid new backstep 591
> invalid new backstep 591
> frame=  292 q=31.0 Lsize=     560kB time=9.7 bitrate= 472.5kbits/s   
> video:476kB audio:77kB global headers:0kB muxing overhead 1.267253%
>
> Obviously, the invalid new backstep stuff is troubling. The resulting 
> file can be found here:
> http://wkyt.dynalias.com/test_for_ffmpeg-devel.mpg
>
> As you may notice, the resulting mpg file plays perfectly in mplayer 
> (and probably other open-source players I haven't tested). The problem 
> is that the image gets all screwy when played in windows. You can 
> still hear the audio, but the video goes psychedelic. I know most of 
> you have the luxury of not using windows as I wish I could, but the 
> users of my web applications do and therefore these files must play 
> correctly in WMP. (I tried to do a screen capture, but the video area 
> was blank.)
>
> For testing in windows, try 
> http://wkyt.dynalias.com/test_for_ffmpeg-devel.html . It has the DivX 
> web player plugin code embedding and a link for downloading the mpg 
> with a right-click.
>
> I have tested a ton of ffmpeg revisions on this. The first revision 
> that will compile on my machine (64-bit 2.6.18 kernel) was revision 
> 4019 which produces a serious video delay sync issue for the avi. 
> Other revisions do strange things as well: 4526 produces an avi that 
> skips/chirps at the end when played in the DivX web player. 4800 
> produces a good avi, but the mpg is either blank (when reencoded with 
> 4800) or back to psychedelic (when reencoded with 6967). I also 
> sporadically tried 4300 and 6801 in combination with the other 
> revisions but nothing would work properly.
>
> I'm kind of at the mercy of the wizards on this mailing list to take a 
> look and fix the bug, or if there isn't a bug, tell me what I'm doing 
> wrong.
>
> As always, your help is greatly appreciated.
>
> Cyrus
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
A little more information on this:

I'm able to convert the SVN-created mpeg4/mp3 avi into working WMV and 
MPEG-2 files using a program called Digital Media Converter (DMC) on 
windows.

Also, I tried to take the SVN-created mpeg4/mp3 and reencode it on a 
32-bit computer with an old version of ffmpeg and got bad results. The 
audio and video would start out in sync, but over time (clearly 
noticeable after 10 seconds) the video would get behind the audio and 
steadily get worse.

I still don't know if the problem is with the original recording of the 
mpeg4/mp3 avi (although these files play perfectly in windows and with 
mplayer) or the reencoding from mpeg4/mp3 avi to mpeg2video/mp3 mpg.

Again, any help, any advice on what else I can do to test... any insight 
whatsoever... would be helpful.

Cyrus




More information about the ffmpeg-devel mailing list