justdan96 / tsMuxer

tsMuxer is a transport stream muxer for remuxing/muxing elementary streams, EVO/VOB/MPG, MKV/MKA, MP4/MOV, TS, M2TS to TS to M2TS. Supported video codecs H.264/AVC, H.265/HEVC, VC-1, MPEG2. Supported audio codecs AAC, AC3 / E-AC3(DD+), DTS/ DTS-HD.
Apache License 2.0
860 stars 144 forks source link

Add AUD nals in HEVC when muxing from MKVs #368

Open bouchnouk opened 3 years ago

bouchnouk commented 3 years ago

Hi,

I am having problems when an UHD movie is remuxed with Tsmuxer. Hercules, Gladiator, Greyhound, The Banker and Roger Waters Live Concert can't be played when burned on a Bluray disc and played on a Panasonic UB820 Bluray player. The disc starts but stalls and aborts after a short while. The timer always shows 0:00 before aborting. No image is shown on the tv. I don't know what is wrong because Tsmuxer doesn't return any error during the remuxing process. Can you help me?

Thanks in advance, Archive.zip

jcdr428 commented 3 years ago

@bouchnouk the sources are all mkv, chances are the hevc stream is badly muxed in the mkv without AUD/SPS/PPS. Try muxing in tsMuxer with insertSEI and contSPS.

bouchnouk commented 3 years ago

Hi,

Thank you for this answer. Tsmuxer doesn't give me the options to insert SEI and contSPS. Is it normal?

Sorry for the question. I am not an expert with mkv muxing.

2020-10-30_21-04-29
bouchnouk commented 3 years ago

Hi,

In the documentation it is written that insertSEI and contSPS are to be used with h264 videos only. The files that I am using are HEVC (H265). That would explain why those options are disabled. So, which directives should I follow?

Thanks in advance.

jcdr428 commented 3 years ago

@bouchnouk sorry my mistake, you're right, the option to add AUD/SPS/PPS does not exit (yet) with HEVC.

Please give a link to download one of non-working mkv, thanks.

jcdr428 commented 3 years ago

@bouchnouk I have analysed one of the mkv files, and as expected it is missing the AUD nal units. For whatever reason (to gain few KBs I suppose), these "Access Unit Delimiters" are deleted by mkvtoolnix.

See #168 : the enhancement for tsMuxer to add the AUD nal units to HEVC streams will be implemented once version 2.7 has been released.

In the meantime, you can simply remux your mkv to ts with ffmpeg: (see https://ffmpeg.org/ffmpeg-bitstream-filters.html#hevc_005fmp4toannexb), which will add the missing AUD nal units: ffmpeg -i INPUT.mkv -c:v copy OUTPUT.ts

then remux again with tsMuxer.

bouchnouk commented 3 years ago

Hi,

No problem. Thank you for the information about ffmpeg. I will look forward to the next major release of Tsmuxer.

Thank you.

Best Regards.

jcdr428 commented 3 years ago

@bouchnouk avec plaisir. Please let us know whether the prior muxing with ffmpeg solves your problem.

michaelsft commented 3 years ago

Edit: so MediaInfo will either say no-aud or aud if it has them so that answers my last question but sadly ffmpeg -i INPUT.mkv -c:v copy OUTPUT.ts doesn't add in aud units to my mkv 4k HEVC file.

I have been advised elsewhere that ffmpeg -i Movie.mkv -c copy -bsf:v hevc_metadata=aud=insert Movie.ts
 should work but the file it creates simply won't load video at all. Does anyone have ideas?

Thanks for reading Michael

bouchnouk commented 3 years ago

@jcdr428 It seems to solve the problem unless Dolby Vision is used. Ffmpeg seems to destroy Dolby Vision information. That's unfortunate.

Best Regards.

HoffmannTom commented 2 years ago

@bouchnouk For DV you need to separate the BL and EL bevor muxing to BD. If you process BL and EL after separation, do they still get corrupted my ffmpeg?