Opened 14 years ago

Closed 8 years ago

#279 closed defect (fixed)

Remuxing aac in TS fails

Reported by: etienne Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: aac mpegts
Cc: mikie@iki.fi Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Hi.

It seems that mpegts_write_header, which is in charge of calling ff_adts_decode_extradata, is not called.

Here an execution trace (with stripped h264 errors):
$ ffmpeg -v 10 -loglevel debug -i sample.ts -acodec copy -vcodec copy output.ts
ffmpeg version git-N-30723-ge887690, Copyright (c) 2000-2011 the FFmpeg developers

built on Jun 12 2011 00:00:43 with gcc 4.4.5
configuration: --disable-doc --enable-extra-warnings --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --disable-stripping --enable-nonfree --enable-libfaac --enable-libmp3lame --enable-libx264
libavutil 51. 8. 0 / 51. 8. 0
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 3. 1 / 53. 3. 1
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 15. 1 / 2. 15. 1
libswscale 0. 14. 1 / 0. 14. 1
libpostproc 51. 2. 0 / 51. 2. 0

[NULL @ 0x1f89400] Format mpegts probed with size=2048 and score=100
[mpegts @ 0x1f89400] stream=0 stream_type=1b pid=44 prog_reg_desc=
[mpegts @ 0x1f89400] stream=1 stream_type=f pid=45 prog_reg_desc=
[mpegts @ 0x1f89400] stream=2 stream_type=6 pid=46 prog_reg_desc=
[mpegts @ 0x1f89400] stream=3 stream_type=f pid=47 prog_reg_desc=
[aac @ 0x1facee0] channel element 1.2 is not allocated
[aac @ 0x1f90ae0] channel element 1.5 is not allocated
Input #0, mpegts, from 'sample.ts':

Duration: 00:00:03.78, start: 86862.833978, bitrate: 3977 kb/s
Program 8824

Stream #0.0[0x44], 78, 1/90000: Video: h264 (High), yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 1/50, 27.94 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0.1[0x45](fra), 70, 1/90000: Audio: aac, 48000 Hz, stereo, s16, 61 kb/s
Stream #0.2[0x46](fra), 79, 1/90000: Subtitle: [6][0][0][0] / 0x0006
Stream #0.3[0x47](qaa), 72, 1/90000: Audio: aac, 48000 Hz, stereo, s16, 60 kb/s

File 'output.ts' already exists. Overwrite ? [y/N] y
[mpegts @ 0x1f8fde0] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to 'output.ts':

Metadata:

encoder : Lavf53.3.1
Stream #0.0, 0, 1/90000: Video: libx264, yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 1/25, q=2-31, 90k tbn, 25 tbc
Stream #0.1(qaa), 0, 1/90000: Audio: libfaac, 48000 Hz, stereo, 60 kb/s

Stream mapping:

Stream #0.0 -> #0.0
Stream #0.3 -> #0.1

Press [q] to stop, ? for help
[mpegts @ 0x1f8fde0] aac bitstream not in adts format and extradata missing
av_interleaved_write_frame(): Operation not permitted

Attachments (1)

test.aac (87.2 KB ) - added by Carl Eugen Hoyos 14 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Michael Niedermayer, 14 years ago

I tried with a random ts file and mpegts_write_header() is called

comment:2 by etienne, 14 years ago

Right, my analysis was wrong, so I'll rephrase issue I encounter:

ffmpeg -i with_aac_audio.ts -acodec copy -vcodec copy /tmp/output.ts
=>[mpegts] aac bitstream not in adts format and extradata missing
av_interleaved_write_frame(): Operation not permitted

ffmpeg -i with_aac_audio.ts -acodec copy -vcodec copy /tmp/output.mp4
=>[mp4] malformed aac bitstream, use -absf aac_adtstoasc
av_interleaved_write_frame()...

ffmpeg -i with_mp2_audio.ts -acodec copy -vcodec copy /tmp/output.ts
=> OK (well, until the remux bug strikes back)

I can upload a <2MB sample that exhibits this if you cannot reproduce with your files.

comment:3 by Carl Eugen Hoyos, 14 years ago

Reproduced by developer: set
Status: newopen

Works fine for some aac samples (like fate-suite/aac/ct_faac-adts.aac).

$ ffmpeg -i test.aac -acodec copy out.ts
ffmpeg version N-30972-gffc6c8a, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jun 24 2011 00:12:15 with gcc 4.5.3
  configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-gpl
  libavutil    51.  9. 1 / 51.  9. 1
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  4. 0 / 53.  4. 0
  libavdevice  53.  1. 1 / 53.  1. 1
  libavfilter   2. 23. 0 /  2. 23. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[aac @ 0x12bf400] Format aac detected only with low score of 25, misdetection possible!
[aac @ 0x12c13a0] channel element 3.3 is not allocated
[aac @ 0x12bf400] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'test.aac':
  Duration: 00:00:05.57, bitrate: 128 kb/s
    Stream #0.0: Audio: aac, 48000 Hz, stereo, s16, 128 kb/s
[mpegts @ 0x12c06a0] muxrate VBR, pcr every 4 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to 'out.ts':
  Metadata:
    encoder         : Lavf53.4.0
    Stream #0.0: Audio: aac, 48000 Hz, stereo, 128 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
[mpegts @ 0x12c06a0] aac bitstream not in adts format and extradata missing
av_interleaved_write_frame(): Operation not permitted

by Carl Eugen Hoyos, 14 years ago

Attachment: test.aac added

comment:4 by Carl Eugen Hoyos, 13 years ago

Keywords: aac ts added

comment:5 by Carl Eugen Hoyos, 12 years ago

Keywords: mpegts added; ts removed

comment:6 by Mika Raento, 10 years ago

Cc: mikie@iki.fi added

comment:7 by Carl Eugen Hoyos, 8 years ago

Component: undeterminedavformat
Resolution: fixed
Status: openclosed

Fixed by Hagen Schmidt in 583a6431460ac62bd91328a8856fb07a445124ea

Note: See TracTickets for help on using tickets.