[FFmpeg-cvslog] avformat/mov: Autodetect mp3s which need parsing

Michael Niedermayer git at videolan.org
Fri Oct 23 11:37:30 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Oct 23 03:22:43 2015 +0200| [573334da8242a9d1e80572b7bf0979200899565f] | committer: Michael Niedermayer

avformat/mov: Autodetect mp3s which need parsing

mp3 packets all have the same duration and number of samples
if their duration indicated in the container varies then thats an
indication that they are not 1 mp3 packet each.
If this autodetection fails for some case then please contact us
and provide a testcase.

Fixes Ticket4938

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=573334da8242a9d1e80572b7bf0979200899565f
---

 libavformat/mov.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 7c90d40..487fe0c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3105,6 +3105,13 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         break;
     }
 
+    // If the duration of the mp3 packets is not constant, then they could need a parser
+    if (st->codec->codec_id == AV_CODEC_ID_MP3
+        && sc->stts_count > 3
+        && sc->stts_count*10 > st->nb_frames
+        && sc->time_scale == st->codec->sample_rate) {
+            st->need_parsing = AVSTREAM_PARSE_FULL;
+    }
     /* Do not need those anymore. */
     av_freep(&sc->chunk_offsets);
     av_freep(&sc->stsc_data);



More information about the ffmpeg-cvslog mailing list