[FFmpeg-devel] [PATCH] ffmpeg.c doesn't detect aspect ratioproperly in some case
Chiranjeevi Melam
cmelam at rgbnetworks.com
Tue Aug 23 23:15:48 CEST 2011
All,
The patch is to strip off ADTS Header from AAC audio as it is needed only in TS and not needed in 3GP, MP4, FLV, ISM formats.
Thanks,
Chiru
diff --git a/ffmpeg/ffmpeg_orig.c b/ffmpeg/ffmpeg.c
index 95b3252..f860e9a 100755
--- a/ffmpeg/ffmpeg_orig.c
+++ b/ffmpeg/ffmpeg.c
@@ -1835,6 +1835,22 @@ static int output_packet(InputStream *ist, int ist_index,
opkt.size = sizeof(AVPicture);
opkt.flags |= AV_PKT_FLAG_KEY;
}
+
+ if(ost->st->codec->codec_id == CODEC_ID_AAC) {
+ if(!strcmp(input_files[ist->file_index]->iformat->name, "mpegts") && strcmp(output_files[ost->file_index]->oformat->name, "mpegts") ) {
+ if(opkt.data[0] == 0xff && (opkt.data[1] & 0xf0) == 0xf0) {
+ uint32_t offset = 7;
+ // skip ADTS CRC
+ if((opkt.data[1] & 0x1) == 0x00)
+ offset += 2;
+ opkt.data += offset;
+ opkt.size -= offset;
+ data_size -= offset;
+ audio_size -= offset;
+ }
+ }
+ }
+
write_frame(os, &opkt, ost->st->codec, ost->bitstream_filters);
ost->st->codec->frame_number++;
ost->frame_number++;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adts_header
Type: application/octet-stream
Size: 1453 bytes
Desc: adts_header
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110823/a4206bf7/attachment.obj>
More information about the ffmpeg-devel
mailing list