Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#7321 closed defect (invalid)

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

Reported by: Manfred Härtel 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 Manfred Härtel 3 years 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 Manfred Härtel 3 years ago.
hr1.mp2 (789.8 KB ) - added by klassikmann 3 years ago.

Change History (7)

by Manfred Härtel, 3 years ago

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

by Manfred Härtel, 3 years ago

comment:1 by Carl Eugen Hoyos, 3 years ago

Component: avcodecundetermined
Resolution: invalid
Status: newclosed

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.

by klassikmann, 3 years ago

Attachment: hr1.mp2 added

comment:2 by klassikmann, 3 years ago

Component: undeterminedffprobe
Resolution: invalid
Status: closedreopened

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 by Hendrik, 3 years ago

Resolution: invalid
Status: reopenedclosed

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 by Carl Eugen Hoyos, 3 years ago

Component: ffprobeundetermined
Note: See TracTickets for help on using tickets.