Opened 18 months ago

#11517 new defect

Remuxing AAC in mpegts to non-seekable matroska fails with "Error parsing AAC extradata, unable to determine samplerate"

Reported by: Tomas Härdin Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: matroska, mkv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
When remuxing AAC stored in mpegts to matroska and writing the result to a pipe, matroskaenc is unable to extract AAC metadata to determine the samplerate and consequently the conversion fails.

How to reproduce:
Using current master (94beaf4872)

$ ffmpeg -t 1 -f lavfi -i sine -codec aac -f mpegts - | ffmpeg -i - -map 0 -codec copy -f matroska - > /dev/null
ffmpeg version N-118848-g94beaf4872 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 6.3.1 (GCC) 20170510 (for GNAT GPL 2017 20170515)
  configuration: --enable-libsrt --enable-gnutls --enable-libx264 --enable-gpl --enable-libmp3lame
  libavutil      59. 60.100 / 59. 60.100
  libavcodec     61. 33.102 / 61. 33.102
  libavformat    61.  9.107 / 61.  9.107
  libavdevice    61.  4.100 / 61.  4.100
  libavfilter    10.  9.100 / 10.  9.100
  libswscale      8. 13.102 /  8. 13.102
  libswresample   5.  4.100 /  5.  4.100
  libpostproc    58.  4.100 / 58.  4.100
ffmpeg version N-118848-g94beaf4872 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 6.3.1 (GCC) 20170510 (for GNAT GPL 2017 20170515)
  configuration: --enable-libsrt --enable-gnutls --enable-libx264 --enable-gpl --enable-libmp3lame
  libavutil      59. 60.100 / 59. 60.100
  libavcodec     61. 33.102 / 61. 33.102
  libavformat    61.  9.107 / 61.  9.107
  libavdevice    61.  4.100 / 61.  4.100
  libavfilter    10.  9.100 / 10.  9.100
  libswscale      8. 13.102 /  8. 13.102
  libswresample   5.  4.100 /  5.  4.100
  libpostproc    58.  4.100 / 58.  4.100
[out @ 0x32c4480] The "sample_fmts" option is deprecated: set the supported sample formats
[out @ 0x32c4480] The "all_channel_counts" option is deprecated: accept all channel counts
Input #0, lavfi, from 'sine':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[mpegts @ 0x32c7200] frame size not set
Output #0, mpegts, to 'pipe:':
  Metadata:
    encoder         : Lavf61.9.107
  Stream #0:0: Audio: aac (LC), 44100 Hz, mono, fltp, 69 kb/s
    Metadata:
      encoder         : Lavc61.33.102 aac
[out#0/mpegts @ 0x32c7100] video:0KiB audio:9KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 31.643881%
size=      12KiB time=00:00:01.00 bitrate=  94.8kbits/s speed=  20x    
[aac @ 0x32c4000] Qavg: 1558.835
Input #0, mpegts, from 'fd:':
  Duration: N/A, start: 1.400000, bitrate: 71 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, mono, fltp, 71 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
[matroska @ 0x434c980] Error parsing AAC extradata, unable to determine samplerate.
[out#0/matroska @ 0x434fc40] Could not write header (incorrect codec parameters ?): Invalid argument
Conversion failed!

This all relates to the writing of MATROSKA_ID_AUDIOOUTSAMPLINGFREQ. But since it appears to be optional perhaps the muxer shouldn't error out?

Change History (0)

Note: See TracTickets for help on using tickets.