Opened 4 months ago

Closed 4 weeks ago

Last modified 4 weeks ago

#7321 closed defect (invalid)

Sample format for mp2 audio channel is incorrectly determined as fltp rather than s16p

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

Description

At least for my sample MPEG-TS file, current versions of ffmpeg (I tried it with the current git-master version) fail to determine the sample format for mp2 audio channels correctly.

Though the sample format is s16p, it is reported as fltp.

For example: ffprobe mp2_fltp_instead_of_s16p.mpegts

Please find more informations in the log file.

Though ffmpeg or ffplay seem to handle the audio channel correctly anyway, I found this problem in a (rather complex) C program written by myself, because the ffmpeg API also reports the wrong sample format and so my program produced an awful sound...

Attachments (3)

mp2_fltp_instead_of_s16p.log (5.3 KB) - added by haertel 4 months ago.
Report file for wrong report of sample format for mp2 audio channel
mp2_fltp_instead_of_s16p_shortened.mpegts (2.4 MB) - added by haertel 4 months ago.
hr1.mp2 (789.8 KB) - added by klassikmann 4 weeks ago.

Change History (7)

Changed 4 months ago by haertel

Report file for wrong report of sample format for mp2 audio channel

Changed 4 months ago by haertel

comment:1 Changed 4 months ago by cehoyos

  • Component changed from avcodec to undetermined
  • Resolution set to invalid
  • Status changed from new to closed

Neither the default decoder for a given stream nor the sample (and pixel) format for a given decoder (and encoder) are part of the API.

Changed 4 weeks ago by klassikmann

comment:2 Changed 4 weeks ago by klassikmann

  • Component changed from undetermined to ffprobe
  • Resolution invalid deleted
  • Status changed from closed to reopened

Background:
The codec mp2 is heavily used in DVB, both cable and SAT. In particular DVB-Audio is based on mp2.

Problem description:
My DVB SAT receiver streams digital audio to my music server (Pi, ArchLinux?, RuneAudio?, mpd with ffmpeg plugin). After the upgrade of mpd to 0.20.21 and ffmpeg to 4.0.2 the sample format is detected as fltp instead of s16p. Consequence: The ffmpeg plugin invoked by mpd performs a (meaningless) conversion from 48000:f:2 to 48000:32:2 producing noise.

The error can be detected in ffprobe, i.e. it has nothing to do with the ffmpeg API.
ffprobe -show_format -show_streams hr1.mp2

Previous (correct) situation:
ffprobe 3.4.4:

Input #0, mp3, from 'hr1.mp2':
Duration: 00:00:16.85, start: 0.000000, bitrate: 384 kb/s
Stream #0:0: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
[STREAM]
index=0
codec_name=mp2
codec_long_name=MP2 (MPEG audio layer 2)
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=s16p
sample_rate=48000
channels=2
channel_layout=stereo

Actual (erroneous) situation:
ffprobe 4.0.2:

Input #0, mp3, from 'hr1.mp2':
Duration: 00:00:16.85, start: 0.000000, bitrate: 384 kb/s
Stream #0:0: Audio: mp2, 48000 Hz, stereo, fltp, 384 kb/s
[STREAM]
index=0
codec_name=mp2
codec_long_name=MP2 (MPEG audio layer 2)
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo

comment:3 Changed 4 weeks ago by heleppkes

  • Resolution set to invalid
  • Status changed from reopened to closed

mp2 is a lossy codec, there is no right or wrong sample format. It entirely depends what the decoder decides to decode to, and our mp2 decoder by default decodes to fltp.

Neither situation is correct or wrong. One is just what you want to happen.
The behavior can also vary depending on how ffmpeg is build. It has both a fixed point (S16) and floating point (FLT) decoder. If either of those is disabled, the other one is always going to be used. If both are enabled, you can also manually specify one of them.

comment:4 Changed 4 weeks ago by cehoyos

  • Component changed from ffprobe to undetermined
Note: See TracTickets for help on using tickets.