Opened 23 months ago

Last modified 23 months ago

#5993 new defect

Not written DecoderSpecificInfo with aac_adtstoasc bsf and empty_moov flags

Reported by: miyukki Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Not written DecoderSpecificInfo? in esds atom box in MP4 with set aac_adtstoasc bsf and empty_moov flags.

  1. mov_init() disable a AVFMT_FLAG_AUTO_BSF flag if FF_MOV_FLAG_EMPTY_MOOV flag set.

https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/movenc.c#L5556-L5559

  1. Did not called aac_adtstoasc_filter.c in first_frame_done process.

https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/aac_adtstoasc_bsf.c#L78-L121

  1. Write esds header without DecoderSpecificInfo? before first_frame_done process when disable AVFMT_FLAG_AUTO_BSF. Then player couldn't be played audio.

How to reproduce:

% ffmpeg -i source.ts -f mp4 -vcodec copy -acodec copy -bsf:a aac_adtstoasc dest.mp4 # video and audio could be played
% ffmpeg -i source.ts -f mp4 -vcodec copy -acodec copy -bsf:a aac_adtstoasc -movflags empty_moov dest.mp4 # audio couldn't be played!

ffmpeg built on 1f5630af51f24d79053b6bef5b8b3ba93d637306
player for test is VLC 2.2.4

Attachments (3)

source.ts (551.7 KB) - added by miyukki 23 months ago.
dest.mp4 (507.5 KB) - added by miyukki 23 months ago.
dest_empty_moov.mp4 (504.7 KB) - added by miyukki 23 months ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 23 months ago by cehoyos

  • Component changed from ffmpeg to undetermined

Please provide the command line that produces the failing output file together with the complete, uncut console output and a short input file to make this a valid ticket.

Changed 23 months ago by miyukki

Changed 23 months ago by miyukki

Changed 23 months ago by miyukki

comment:2 follow-up: Changed 23 months ago by miyukki

Reproduce terminal with completely output:

➜  tmp ffmpeg -i source.ts -f mp4 -vcodec copy -acodec copy -bsf:a aac_adtstoasc dest.mp4
ffmpeg version 3.1.4 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-libfdk-aac --enable-libopus --enable-libx265 --enable-libwebp --disable-lzma --enable-nonfree --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mpegts, from 'source.ts':
  Duration: 00:00:09.33, start: 5488.084122, bitrate: 484 kb/s
  Program 1
    Stream #0:0[0x102]: Data: timed_id3 (ID3  / 0x20334449)
    Stream #0:1[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 426x240, 25 fps, 25 tbr, 90k tbn, 6k tbc
    Stream #0:2[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 97 kb/s
[mp4 @ 0x7fd7bc803c00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'dest.mp4':
  Metadata:
    encoder         : Lavf57.41.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 426x240, q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 97 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  233 fps=0.0 q=-1.0 Lsize=     507kB time=00:00:09.33 bitrate= 445.4kbits/s speed= 447x
video:393kB audio:108kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.249113%

➜  tmp  ffmpeg -i source.ts -f mp4 -vcodec copy -acodec copy -bsf:a aac_adtstoasc -movflags empty_moov dest_empty_moov.mp4
ffmpeg version 3.1.4 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-libfdk-aac --enable-libopus --enable-libx265 --enable-libwebp --disable-lzma --enable-nonfree --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mpegts, from 'source.ts':
  Duration: 00:00:09.33, start: 5488.084122, bitrate: 484 kb/s
  Program 1
    Stream #0:0[0x102]: Data: timed_id3 (ID3  / 0x20334449)
    Stream #0:1[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 426x240, 25 fps, 25 tbr, 90k tbn, 6k tbc
    Stream #0:2[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 97 kb/s
[mp4 @ 0x7f9839809400] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'dest_empty_moov.mp4':
  Metadata:
    encoder         : Lavf57.41.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 426x240, q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 97 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x7f9839809400] Estimating the duration of the last packet in a fragment, consider setting the duration field in AVPacket instead.
frame=  233 fps=0.0 q=-1.0 Lsize=     505kB time=00:00:09.33 bitrate= 443.0kbits/s speed= 643x
video:393kB audio:108kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.701421%

Show esds atom box using mp4dump command that is included Bento4.

➜  tmp mp4dump dest.mp4 | grep -A12 esds
              [esds] size=12+39
                [ESDescriptor] size=5+34
                  es_id = 2
                  stream_priority = 0
                  [DecoderConfig] size=5+20
                    stream_type = 5
                    object_type = 64
                    up_stream = 0
                    buffer_size = 0
                    max_bitrate = 97157
                    avg_bitrate = 95114
                    DecoderSpecificInfo = 12 10
                  [Descriptor:06] size=5+1

➜  tmp mp4dump dest_empty_moov.mp4 | grep -A11 esds
              [esds] size=12+32
                [ESDescriptor] size=5+27
                  es_id = 2
                  stream_priority = 0
                  [DecoderConfig] size=5+13
                    stream_type = 5
                    object_type = 64
                    up_stream = 0
                    buffer_size = 0
                    max_bitrate = 97157
                    avg_bitrate = 0
                  [Descriptor:06] size=5+1

comment:3 in reply to: ↑ 2 Changed 23 months ago by cehoyos

Replying to miyukki:

ffmpeg version 3.1.4 Copyright (c) 2000-2016 the FFmpeg developers

This looks different from your original report.

comment:4 Changed 23 months ago by miyukki

Oops sorry, I tried run it with system ffmpeg.

The terminal output with built on 1f5630af51f24d79053b6bef5b8b3ba93d637306

➜  ffmpeg git:(master) ✗ ./ffmpeg -i source.ts -f mp4 -vcodec copy -acodec copy -bsf:a aac_adtstoasc dest.mp4
ffmpeg version N-82759-g1f5630a Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --enable-gpl --enable-libx264
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.109 / 57. 66.109
  libavformat    57. 58.101 / 57. 58.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mpegts, from 'source.ts':
  Duration: 00:00:09.33, start: 5488.084122, bitrate: 484 kb/s
  Program 1
    Stream #0:0[0x102]: Data: timed_id3 (ID3  / 0x20334449)
    Stream #0:1[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 426x240, 25 fps, 25 tbr, 90k tbn, 6k tbc
    Stream #0:2[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp,97 kb/s
Output #0, mp4, to 'dest.mp4':
  Metadata:
    encoder         : Lavf57.58.101
    Stream #0:0: Video: h264 (Main) ([33][0][0][0] / 0x0021), yuv420p(progressive), 426x240, q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 97 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  233 fps=0.0 q=-1.0 Lsize=     507kB time=00:00:09.31 bitrate= 446.5kbits/s speed=783x
video:393kB audio:108kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.249113%

➜  ffmpeg git:(master) ✗ ./ffmpeg -i source.ts -f mp4 -vcodec copy -acodec copy -bsf:a aac_adtstoasc -movflags empty_moov dest_empty_moov.mp4
ffmpeg version N-82759-g1f5630a Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --enable-gpl --enable-libx264
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.109 / 57. 66.109
  libavformat    57. 58.101 / 57. 58.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mpegts, from 'source.ts':
  Duration: 00:00:09.33, start: 5488.084122, bitrate: 484 kb/s
  Program 1
    Stream #0:0[0x102]: Data: timed_id3 (ID3  / 0x20334449)
    Stream #0:1[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 426x240, 25 fps, 25 tbr, 90k tbn, 6k tbc
    Stream #0:2[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp,97 kb/s
Output #0, mp4, to 'dest_empty_moov.mp4':
  Metadata:
    encoder         : Lavf57.58.101
    Stream #0:0: Video: h264 (Main) ([33][0][0][0] / 0x0021), yuv420p(progressive), 426x240, q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 97 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x7fe0a4003400] Estimating the duration of the last packet in a fragment, consider setting the duration field in AVPacket instead.
frame=  233 fps=0.0 q=-1.0 Lsize=     505kB time=00:00:09.31 bitrate= 444.1kbits/s speed=821x
video:393kB audio:108kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.701421%
➜  ffmpeg git:(master) ✗ mp4dump dest.mp4 | grep -A12 esds
              [esds] size=12+39
                [ESDescriptor] size=5+34
                  es_id = 2
                  stream_priority = 0
                  [DecoderConfig] size=5+20
                    stream_type = 5
                    object_type = 64
                    up_stream = 0
                    buffer_size = 0
                    max_bitrate = 97846
                    avg_bitrate = 95114
                    DecoderSpecificInfo = 12 10
                  [Descriptor:06] size=5+1

➜  ffmpeg git:(master) ✗ mp4dump dest_empty_moov.mp4 | grep -A11 esds
              [esds] size=12+32
                [ESDescriptor] size=5+27
                  es_id = 2
                  stream_priority = 0
                  [DecoderConfig] size=5+13
                    stream_type = 5
                    object_type = 64
                    up_stream = 0
                    buffer_size = 0
                    max_bitrate = 97846
                    avg_bitrate = 0
                  [Descriptor:06] size=5+1
Note: See TracTickets for help on using tickets.