[FFmpeg-cvslog] movdec: Set frame_size for AMR

Carl Eugen Hoyos git at videolan.org
Sun Nov 6 02:39:16 CET 2011


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Thu Nov  3 20:20:58 2011 +0100| [237f13290bcc1c69cf103dede7f546a2a0706b5c] | committer: Martin Storsjö

movdec: Set frame_size for AMR

Earlier, sc->samples_per_frame was used for setting the frame size,
but all files don't have that set properly. The frame size is a
known constant for these codecs.

If frame_size isn't set, the mov/3gp muxer refuses to mux it.

This fixes stream copy of audio from
https://roundup.libav.org/file1248/Video_With_AMR-NB_Audio.3gp
to another 3gp file (roundup issue 2468).

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavformat/mov.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2036f51..351058c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1291,14 +1291,16 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
         st->codec->channels= 1; /* really needed */
         break;
     case CODEC_ID_AMR_NB:
-    case CODEC_ID_AMR_WB:
-        st->codec->frame_size= sc->samples_per_frame;
         st->codec->channels= 1; /* really needed */
         /* force sample rate for amr, stsd in 3gp does not store sample rate */
-        if (st->codec->codec_id == CODEC_ID_AMR_NB)
-            st->codec->sample_rate = 8000;
-        else if (st->codec->codec_id == CODEC_ID_AMR_WB)
-            st->codec->sample_rate = 16000;
+        st->codec->sample_rate = 8000;
+        /* force frame_size, too, samples_per_frame isn't always set properly */
+        st->codec->frame_size  = 160;
+        break;
+    case CODEC_ID_AMR_WB:
+        st->codec->channels    = 1;
+        st->codec->sample_rate = 16000;
+        st->codec->frame_size  = 320;
         break;
     case CODEC_ID_MP2:
     case CODEC_ID_MP3:



More information about the ffmpeg-cvslog mailing list