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
831 stars 140 forks source link

M2TS: Maximum Overall bit rate field is wrong #713

Closed ValeZAA closed 1 year ago

ValeZAA commented 1 year ago

If I get this sample from Blu-ray that has 128 mbit/s HEVC stream (that is the value on m2ts files on Blu-ray) and remux it with TsMuxer to m2ts (only video) I get a wrong Maximum Overall bit rate in Mediainfo, that is smaller than overall bitrate, which is impossible. Even if you remux it to Annex B and then back it is still wrong 35.5 Mbit/s. After googling I found it is a common problem. FFmpeg does not write the field with -c copy to m2ts.

https://mailccsf-my.sharepoint.com/:v:/g/personal/dirizar2_mail_ccsf_edu/Ea3Lyr-Jl69CpSEU2C2kpEIBT1ofxtyhD5r_ttps9Asxlw?e=lrPnoJ

jcdr428 commented 1 year ago

@ValeZAA the "Maximum Overall bit rate" is taken from the "peak_rate" field written in the "partial transport stream descriptor" of the SIT (Service Information Table). The SIT is not part of blu-ray standards / not used by blu-ray players, tsMuxer writes the same SIT to all outputs with a 35.5 mbps peak_rate. I suppose this peak_rate could be adapted to the real bitrate, I'll mark this issue as a potential enhancement.

Edit:I'll change AVC default to 48 mbps and HEVC default to 109 mbps.

jcdr428 commented 1 year ago

@ValeZAA please try tomorrow's release.

ValeZAA commented 1 year ago

That is nice, but actual bit rate is 239 Mbit/s. Also, I think it is not from Blu-ray, but was reencoded, sorry about that.

download

jcdr428 commented 1 year ago

@ValeZAA the "Overall Maximum bit rate" has nothing to do with the actual maximum bitrate: as explained, MediaInfo takes the data from the peak_rate field. You can check with any commercial Blu-ray, it is the same situation.

ValeZAA commented 1 year ago

This is from commercial Blu-ray:

download

jcdr428 commented 1 year ago

@ValeZAA yes the UHD maximum bitrate is 109 mbps in the inner zone to 128 mbps in the outer zone. So you wont see a commercial bluray with "Overall Maximum bitrate" above 128 mbps.

And as stated previously, this "peak_rate" info is not used by any player.

Edit: I have changed peak bitrate to 128 mbps for HEVC.

ValeZAA commented 1 year ago

I suppose this peak_rate could be adapted to the real bitrate, I'll mark this issue as a potential enhancement.

So ideally it should not be 128 mbit/s for all Blu-ray v3?

jcdr428 commented 1 year ago

Ideally tsMuxer should scan the streams in their entirety and deduct the max bitrate to write in the SIT. Currently, tsMuxer initially scans the first few frames only.

jcdr428 commented 1 year ago

Closing, can be reopened upon request.