diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-03-30 08:41:46 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-04-02 12:55:10 +0200 |
commit | 8b72bcba713ae2dd48c260265010c9831dffdc30 (patch) | |
tree | 10eab2ffcd728edb5934f1c2c914d41ab52c5134 | |
parent | 5dd5cfd0b8d3b658d3b517a617aeb57a233c68c4 (diff) | |
download | ffmpeg-8b72bcba713ae2dd48c260265010c9831dffdc30.tar.gz |
Write broken aac frames to mov files instead of skipping them.
Fixes decoding with picky media players.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b448c0a68d0cc7dfef736267dfdaed0e213c020b)
Conflicts:
libavformat/movenc.c
-rw-r--r-- | libavformat/movenc.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index fdde5176a0..94e718263a 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2583,6 +2583,14 @@ static int mov_write_packet_internal(AVFormatContext *s, AVPacket *pkt) memcpy(trk->vosData, enc->extradata, trk->vosLen); } + if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && + (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { + if (!s->streams[pkt->stream_index]->nb_frames) { + av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); + return -1; + } + av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); + } if (enc->codec_id == CODEC_ID_H264 && trk->vosLen > 0 && *(uint8_t *)trk->vosData != 1) { /* from x264 or from bytestream h264 */ /* nal reformating needed */ @@ -2593,13 +2601,6 @@ static int mov_write_packet_internal(AVFormatContext *s, AVPacket *pkt) } else { size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size); } - } else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && - (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { - if (!s->streams[pkt->stream_index]->nb_frames) { - av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); - return -1; - } - av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); } else { avio_write(pb, pkt->data, size); } |