[FFmpeg-cvslog] movenc: Support high sample rates in isomedia formats by setting the sample rate field in stsd to 0 .

Alex Converse git at videolan.org
Sat Apr 21 23:24:49 CEST 2012


ffmpeg | branch: master | Alex Converse <alex.converse at gmail.com> | Fri Apr 20 13:21:28 2012 -0700| [dc878b96a78c1cc5edc6edc0bf087cf7a3c14ae9] | committer: Alex Converse

movenc: Support high sample rates in isomedia formats by setting the sample rate field in stsd to 0.

Libisomediafile appears to always set this field to zero.

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

 libavformat/movenc.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index dd2598b..35c03dd 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -630,7 +630,8 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
         avio_wb16(pb, 0);
 
         avio_wb16(pb, 0); /* packet size (= 0) */
-        avio_wb16(pb, track->enc->sample_rate);
+        avio_wb16(pb, track->enc->sample_rate <= UINT16_MAX ?
+                      track->enc->sample_rate : 0);
         avio_wb16(pb, 0); /* Reserved */
     }
 
@@ -3122,17 +3123,11 @@ static int mov_write_header(AVFormatContext *s)
             if (av_get_bits_per_sample(st->codec->codec_id) < 8) {
                 track->audio_vbr = 1;
             }
-            if (track->mode != MODE_MOV) {
-                if (track->timescale > UINT16_MAX) {
-                    av_log(s, AV_LOG_ERROR, "track %d: output format does not support "
-                           "sample rate %dhz\n", i, track->timescale);
-                    goto error;
-                }
-                if (track->enc->codec_id == CODEC_ID_MP3 && track->timescale < 16000) {
-                    av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not supported\n",
-                           i, track->enc->sample_rate);
-                    goto error;
-                }
+            if (track->mode != MODE_MOV &&
+                track->enc->codec_id == CODEC_ID_MP3 && track->timescale < 16000) {
+                av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not supported\n",
+                       i, track->enc->sample_rate);
+                goto error;
             }
         }else if(st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE){
             track->timescale = st->codec->time_base.den;



More information about the ffmpeg-cvslog mailing list