Index: ffmpeg.c
===================================================================
--- ffmpeg.c	(revision 26402)
+++ ffmpeg.c	(working copy)
@@ -1732,7 +1732,19 @@
                             opkt.data = data_buf;
                             opkt.size = data_size;
                         }
-
+                        if(ost->st->codec->codec_id == CODEC_ID_AAC) { // skip ADTS header for AAC audio copied from TS container to non TS containers
+                            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;
+                                    if((opkt.data[1] & 0x1) == 0x00) // skip ADTS CRC
+                                        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++;
