Skip to content

3.6.0 - MPEG-TS audio PIDs are identified by payload

Latest

Choose a tag to compare

@superuser404notfound superuser404notfound released this 25 Sep 20:09
· 1 commit to main since this release

Same n8.1.3 FFmpeg, dav1d, zimg and libzvbi as 3.5.0. Three more raw demuxers and one new local patch: an MPEG-TS audio PID is identified by its payload when its label does not name the codec, or names the wrong one.

What it fixes

A live IPTV channel carrying DTS-HD opened as mp3. Every packet failed in mp3float with Header missing, the audio track never produced a frame, and a player waiting for audio stalled after the first picture. Reported as AetherEngine #641.

Two separate gaps lead there.

The content probe could not name DTS, TrueHD or LATM. When a PMT stream type does not name its codec (an unknown type, 0x06 without a descriptor) or is one mpegts re-checks (0x04, 0x0f), set_codec_from_probe_data() runs the raw demuxers' probes over the payload. This build ships with --disable-demuxers, and dts, truehd and loas were never enabled, although their decoders were. None of the three codecs could be confirmed, and the lenient mp3 probe (score 1 on noise) named the track instead. The same trap on the video side is why mpegvideo and m4v are enabled.

0x03 is taken at its word. mpegts_set_stream_info() asks for a content probe on 0x04 (MPEG-2 audio) and 0x0f (AAC), but not on 0x03 (MPEG-1 audio). A DTS PID labelled 0x03 opens as mp3 on a full upstream FFmpeg too:

ffmpeg -f lavfi -i testsrc2=size=1280x720:rate=24000/1001 \
  -f lavfi -i "sine=f=440:r=48000,pan=5.1|c0=c0|c1=c0|c2=c0|c3=c0|c4=c0|c5=c0" \
  -t 20 -c:v libx264 -c:a dca -strict -2 -b:a 1509k -f mpegts dts.ts
# rewrite the audio stream_type in the PMT to 0x03 and fix the CRC, then:
ffprobe dts03.ts
# Stream #0:1: Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels, fltp

What ships now

  • --enable-demuxer=dts --enable-demuxer=truehd --enable-demuxer=loas.
  • New patch_ffmpeg_mpegts_mpeg1_probe adds STREAM_TYPE_AUDIO_MPEG1 to the request_probe = 50 condition in libavformat/mpegts.c. A genuine MP2 or MP3 PID settles on its first PES packet, so there is no start-up cost, and a probe that finds nothing better keeps the PMT's codec.
  • New MPEGTSAudioProbeTests mux a transport stream through the shipped libavformat, relabel the audio PID in the PMT, and open it. The fixture's DTS frames carry the reporter's own core header. A DTS PID labelled 0x03 and one labelled 0x06 both open as DTS where 3.5.0 opened them as mp3, the three demuxers are present, and the MPEG-1 Layer II control labelled 0x03 stays MPEG audio on both builds.

swift test: 28 tests in 8 suites pass.