Incorrect detection of audio streams
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 37k
- Forks
- 3.5k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 22
Description
Important Information
mpv-0.33.1-1.fc33.x86_64
Fedora 33 official repo
I tried recompiling mpv from git but currently the resulting binary refuses to play any video on any video driver. I would need to solve this problem first.
Reproduction steps
Play a specific mpeg transport stream.
mpv /mnt/scratch/t2mi/t2mi.ts
This plays the SPORTITALIA HD substream without audio.
It is possible to activate an Italian audio track using the # key
The video has some corruption because the video format is not fully supported by ffmpeg, but that is not the subject of this issue.
The actual problem is that mpv consideres one of the private streams as audio. This private stream is NOT ac3.
The result is that mpv thinks there are two audio streams. the first one does not work but is played as default.
This is is important because I use libmpv in DVB receiver software (which will be released soon). That software
sends commands to swtch audio streams depending on preferences in a configuration file and so it must rely on some
stable numbering of audio channels. So my own code checks the PMT for audio streams, assumes that the first one
will be known to mpv as aid=1, the second one as aid=2 and so on. This approach seems to work all the time,
except on this specific transport stream.
On the other hand ffmpeg seems to correctly identify the audio streams (it finds only 1) which is a bit surprising.
ffmpeg version: ffmpeg-4.3.2-2.fc33.x86_64
mpv reports:
[ffmpeg/demuxer] mpegts: Could not find codec parameters for stream 5 (Unknown: none ([255][0][0][0] / 0x00FF)): unknown codec
[ffmpeg/demuxer] Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[ffmpeg/demuxer] mpegts: Could not find codec parameters for stream 6 (Unknown: none ([255][0][0][0] / 0x00FF)): unknown codec
[ffmpeg/demuxer] Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
(+) Video --vid=1 (h264 1920x1080 25.000fps)
(+) Audio --aid=1 --alang=eng (mp2 1ch 48000Hz)
Audio --aid=2 --alang=ita (mp2 2ch 48000Hz)
However, aid 1 is not an audio stream.
ffmpeg -i /mnt/scratch/t2mi/t2mi.ts
reports
Input #0, mpegts, from '/mnt/scratch/t2mi/t2mi.ts':
Duration: 00:00:56.72, start: 5216.403456, bitrate: 6486 kb/s
Program 1
Metadata:
service_name : Servizio 1
service_provider:
Stream #0:1[0x246](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, mono, s16p, 128 kb/s
Program 2
Metadata:
service_name : Servizio 2
service_provider:
Program 3
Metadata:
service_name : Servizio 3
service_provider:
Program 4
Metadata:
service_name : Servizio 4
service_provider:
Program 5
Metadata:
service_name : Servizio 5
service_provider:
Program 6
Metadata:
service_name : Servizio 6
service_provider:
Program 7
Metadata:
service_name : Servizio 7
service_provider:
Program 8
Metadata:
service_name : Servizio 8
service_provider:
Program 9
Metadata:
service_name : Servizio 9
service_provider:
Program 10
Metadata:
service_name : Servizio 10
service_provider:
Program 99
Metadata:
service_name : Ghost
service_provider:
Stream #0:5[0x12b]: Unknown: none ([255][0][0][0] / 0x00FF)
Stream #0:6[0x12c]: Unknown: none ([255][0][0][0] / 0x00FF)
Program 8201
Metadata:
service_name : SPORTITALIA HD
service_provider:
Stream #0:2[0x596]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0:3[0x597](ita): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
Stream #0:4[0x59f]: Unknown: none ([5][0][0][0] / 0x0005)
No Program
Stream #0:0[0x12]: Data: epg
The italian audio is Stream #0:3[0x597](ita): Audio: mp2
Expected behavior
Only detect real audio streams and provide stable numbering of audio streams (for use with aid=)
which other programs can deduce from the pmt.
Actual behavior
non-audio stream detected as audio and (making things worse) detected as the default audio stream
Log file
Log file attached to this issue.
output.txt
It was produced with
mpv -v -v --log-file=output.txt /mnt/scratch/t2mi/t2mi.ts
Sample files
The t2mi.ts file can be found here
https://0x0.st/-tnT.ts
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the linked t2mi.ts sample using mpv and compare its stream listing with ffmpeg -i output. Investigate how the MPEG transport stream's PMT entries are classified, using output.txt as evidence. Done means only the real audio streams are detected and their aid numbering matches the PMT.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- audio-video-rtc, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100