[FFmpeg-devel] Copying mp3 to FLV container Broken Since Haloween (SVN 10891)

Stefano Sabatini stefano.sabatini-lala
Wed Dec 12 09:21:53 CET 2007


On date Tuesday 2007-12-11 12:12:59 -0800, Scott Manley encoded:
> Ok so I've traced this down to a check in on Haloween, it used to be 
> possible to copy mp3 audio into an flv wrapper without transcoding, but 
> this appears to have broken with SVN 10891
> 
> So I have a clean mp3 file - no wierd bitrates, id3 tags or wierd vbr 
> stuff in frames, just standard mp3 data, and I can pack it into a flash 
> video container using this command line, there's a 'non monotone 
> timestamp' warning, but that happens for any mp3 I throw at it, and the 
> file still plays without a glitch in flash.
> 
> $ ffmpeg -i test.mp3 -acodec copy test.flv
> FFmpeg version SVN-r10890, Copyright (c) 2000-2007 Fabrice Bellard, et al.
>   configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 
> --mandir=/usr/share/man --incdir=/usr/include/ffmpeg 
> --extra-cflags=-fPIC --enable-libmp3lame --enable-libfaad 
> --enable-libx264 --enable-libxvid --enable-libfaac --enable-libgsm 
> --enable-liba52 --enable-liba52bin --enable-libvorbis --enable-libtheora 
> --enable-pp --enable-shared --enable-pthreads --enable-gpl 
> --enable-libamr-wb --enable-libamr-nb --enable-qcelp --enable-swscaler 
> --enable-libogg --disable-strip
>   libavutil version: 49.5.0
>   libavcodec version: 51.47.2
>   libavformat version: 51.17.0
>   built on Dec 11 2007 11:50:50, gcc: 4.1.1 20070105 (Red Hat 4.1.1-52)
> Input #0, mp3, from 'test.mp3':
>   Duration: 00:01:13.9, start: 0.000000, bitrate: 128 kb/s
>     Stream #0.0: Audio: mp3, 44100 Hz, stereo, 128 kb/s
> File 'test.flv' already exists. Overwrite ? [y/N] y
> Output #0, flv, to 'test.flv':
>     Stream #0.0: Audio: libmp3lame, 44100 Hz, stereo, 128 kb/s
> Stream mapping:
>   Stream #0.0 -> #0.0
> Press [q] to stop encoding
> error, non monotone timestamps 13 >= 0
> size=    1199kB time=73.9 bitrate= 132.9kbits/s
> video:0kB audio:1156kB global headers:0kB muxing overhead 3.805984%
> 
> But I update to 10891 and this starts failing
> 
> $ ffmpeg -i test.mp3 -acodec copy test.flv
> FFmpeg version SVN-r10891, Copyright (c) 2000-2007 Fabrice Bellard, et al.
>   configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 
> --mandir=/usr/share/man --incdir=/usr/include/ffmpeg 
> --extra-cflags=-fPIC --enable-libmp3lame --enable-libfaad 
> --enable-libx264 --enable-libxvid --enable-libfaac --enable-libgsm 
> --enable-liba52 --enable-liba52bin --enable-libvorbis --enable-libtheora 
> --enable-pp --enable-shared --enable-pthreads --enable-gpl 
> --enable-libamr-wb --enable-libamr-nb --enable-qcelp --enable-swscaler 
> --enable-libogg --disable-strip
>   libavutil version: 49.5.0
>   libavcodec version: 51.47.2
>   libavformat version: 51.17.0
>   built on Dec 11 2007 11:59:39, gcc: 4.1.1 20070105 (Red Hat 4.1.1-52)
> Input #0, mp3, from 'test.mp3':
>   Duration: 00:01:13.9, start: 0.000000, bitrate: 128 kb/s
>     Stream #0.0: Audio: mp3, 44100 Hz, stereo, 128 kb/s
> File 'test.flv' already exists. Overwrite ? [y/N] y
> Output #0, flv, to 'test.flv':
>     Stream #0.0: Audio: libmp3lame, 44100 Hz, stereo, 128 kb/s
> Stream mapping:
>   Stream #0.0 -> #0.0
> Press [q] to stop encoding
> error, non monotone timestamps 13 >= 0
> av_interleaved_write_frame(): Error while opening file

Just to start inquiring the problem:

stefano at geppetto ~/s/ffmpeg> svn log -r 10891
------------------------------------------------------------------------
r10891 | michael | 2007-11-01 02:59:22 +0100 (Thu, 01 Nov 2007) | 3 lines

check av_interleaved_write_frame() return
fixes issue149

------------------------------------------------------------------------
stefano at geppetto ~/s/ffmpeg> svn diff -r10890:10891
Index: ffmpeg.c
===================================================================
--- ffmpeg.c    (revision 10890)
+++ ffmpeg.c    (revision 10891)
@@ -409,6 +409,8 @@
 }
 
 static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc){
+    int ret;
+
     while(bsfc){
         AVPacket new_pkt= *pkt;
         int a= av_bitstream_filter_filter(bsfc, avctx, NULL,
@@ -424,7 +426,11 @@
         bsfc= bsfc->next;
     }
 
-    av_interleaved_write_frame(s, pkt);
+    ret= av_interleaved_write_frame(s, pkt);
+    if(ret < 0){
+        print_error("av_interleaved_write_frame()", ret);
+        exit(1);
+    }
 }
 
 #define MAX_AUDIO_PACKET_SIZE (128 * 1024)

A gdb dive into av_interleaved_write_frame should help to solve the
problem.

Regards.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)




More information about the ffmpeg-devel mailing list