[libbluray-devel] phantom AC-3 stream in FFmpeg-based players such as mpv or ffplay

桃源老師 xanadu6291 at gmail.com
Sun Jul 12 17:24:11 UTC 2026


Hello, 

I'd like to open an issue regarding libbluray, but I can't fin out the way. So, I subscribed this mailing list...
First of all, I'm a kind of hobby programer. Not a kind of professional engineer or so...

Here's the issue description:

Phenomenon
A phantom AC-3 stream appears in FFmpeg/mpv. It is presented as a selectable audio track even though it contains no valid audio.

How to reproduce
    • Use m2ts file which audio stream starts before video stream.
    • Mux this m2ts as a blu-ray structure folder with tsMuxeR version 2.3.2b or later.
    • Open the BDMV folder with FFmpeg-based players such as mpv or ffplay.
    • An additional stream labeled "Audio: ac3, 0 channels" appears. It is really selectable as audio track, but because it does not contain valid audio track at all, it result in "No Sound"...

Expected behavior
FFplay/mpv should expose only the actual video and audio streams.

Actual behavior
FFplay/mpv exposes an additional phantom AC-3 stream.

Presumed cause
When using tsMuxeR version 2.3.2b or later to mux a source containing audio packets that appear before the video starts, libbluray attempts to wipe those packets by marking it as outside the clip range.
However, the current implementation only changes the packet identifier (PID) to the value used for Null Packets (0x1FFF) while leaving the packet payload intact.
As a result, FFmpeg detects the remaining payload as a separate AC-3 stream, which appears as "Audio: ac3, 0 channels".

Applicable code
Current line 260-265 of libbluray-1.4.0/src/libbluray/decoders/m2ts_filter.c is as follows: 

static void _wipe_packet(uint8_t p)
{
/ set pid to 0x1fff (padding) */
p[4 + 2] = 0xff;
p[4 + 1] |= 0x1f;
}

A candidate of fix

static void _wipe_packet(uint8_t p)
{
/
Replace the TS packet with a proper null packet.
Preserve the 4-byte M2TS arrival timestamp.
/
p[4 + 1] = 0x1f; / PUSI=0, PID high bits=0x1f /
p[4 + 2] = 0xff; / PID low byte /
p[4 + 3] = 0x10; / payload only, continuity counter=0 */
memset(p + 4 + 4, 0xff, 184);
}

Side Note
I confirmed that replacing the entire TS packet with a proper null packet, instead of changing only its PID, completely eliminates the phantom AC-3 stream. 
I also rebuilt mpv against the patched libbluray and confirmed that both the phantom aid=2 stream and the FFmpeg warning disappeared during normal BDMV playback. 

This investigation was greatly assisted by ChatGPT. All experiments and verification were performed by me.


Best Regards,
Kimio Miyamura
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4393 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/libbluray-devel/attachments/20260713/20351a65/attachment.bin>


More information about the libbluray-devel mailing list