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

24 bit LPCM audio not working #823

Closed jcdr428 closed 4 months ago

jcdr428 commented 5 months ago

Discussed in https://github.com/justdan96/tsMuxer/discussions/822

Originally posted by **sebarious70** January 21, 2024 I created a BD image with a video .264 file and a Wave that is 24 bits 48 Khz. As far as I know, the Blu-ray spec allows for this. But the resulting BD-RE, when burned and put in the blu-ray player, plays little else than white noise, and in the background you can hear some of the original audio, but for the most part it's loud white noise. I considered the possibility that it might be a burning error, so I opened the ISO file with VLC, and it's the same thing. I also opened the source 24/48 audio file and it's fine, no white noise. So I exported the audio again as wav, but this time as 16 bits / 96 Khz, dragged it into TS Muxer, created the ISO file again, and then the audio was perfectly fine. So I wonder if TS Muxer doesn't allow for BD authoring with LPCM 24 bit audio. Is that the case? I cloned the code and opened the two files with the code that handle LCPM, which as far as I can tell are lpcmStreamReader.cpp and lpcmStreamReader.h. I don't know anything about programming, but the names make that obvious. I did a search for 16 and I came to a point in the lpcmStreamReader.cpp file that maybe has something related to this. Of course, not knowing the first thing about code, I'm not sure what those actions are, but it's this part: Screenshot 2024-01-21 at 01 42 27 So this part tells me that if it's 16 bits, then it does something: ``` if (m_bitsPerSample == 16) { for (auto curPos = (uint16_t*)start; curPos < (uint16_t*)end; ++curPos) *curPos = my_htons(*curPos); } ``` And this part tells me that if the bit depth is higher than 16 bits, then it does something else. ``` else if (m_bitsPerSample > 16) { for (uint8_t* curPos = start; curPos < end - 2; curPos += 3) { uint8_t tmp = curPos[0]; curPos[0] = curPos[2]; curPos[2] = tmp; } ``` But that's just a guess. So is it possible to author a BD with TS Muxer that has 24 bit LPCM audio or not?
jcdr428 commented 5 months ago

@sebarious70 I've opened an issue. Can you please share a sample of the 24-bit LPCM creating this issue.

sebarious70 commented 5 months ago

Do you mean of the file that I import into TS Muxer, or the file that it produces with the glitch?

On Jan 24, 2024, at 12:59, jcdr428 @.***> wrote:

@sebarious70 https://github.com/sebarious70 I've opened an issue. Can you please share a sample of the 24-bit LPCM creating this issue.

— Reply to this email directly, view it on GitHub https://github.com/justdan96/tsMuxer/issues/823#issuecomment-1908652768, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFPWIC3QJRZ44EAFQEMI6Y3YQFDY5AVCNFSM6AAAAABCJF4ALKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBYGY2TENZWHA. You are receiving this because you were mentioned.

jcdr428 commented 5 months ago

The file that you import.

sebarious70 commented 5 months ago

OK, so I shared it in the forum because the two emails I sent with the short wav bounced.

On Jan 24, 2024, at 16:12, Sebastian Alvarez @.***> wrote:

OK so I sent you a small piece of the wav, but the email was bounced because it was too large. I zipped it to less than 10 MB, hopefully that’s the limit, because they just say it’s over the limit, but not what’s the limit.

<24 bit sample for justdan96.wav.zip> > On Jan 24, 2024, at 15:23, Sebastian Alvarez ***@***.***> wrote: > > Sure, here’s just a small part. So TSMuxer is supposed to work fine with 24 bit PCM files? What I can’t find anywhere online is if the Blu-ray spec allows 24 bit LPCM or not. But I read in some forums that it’s supposed to be 16 bit for PCM, even if it allows 24 for AC3. Do you know if that’s accurate? > > <24 bit sample for justdan96.wav> > > >> On Jan 24, 2024, at 14:55, jcdr428 ***@***.***> wrote: >> >> >> The file that you import. >> >> — >> Reply to this email directly, view it on GitHub , or unsubscribe . >> You are receiving this because you were mentioned. >> >
jcdr428 commented 5 months ago

@sebarious70 You should be able to attach the file directly into the github comment box. Size limits are https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files Alternatively, post a OneDrive or GoogleDrive or WeTransfer link.

Edit: thanks, sample obtained from the discussion.

jcdr428 commented 5 months ago

@sebarious70 the problem arises from the non-standard (but spec compliant) 'FLLR' (filler) chunk added by the iPhone: if you remove the chunk with an hex editor, then tsMuxer muxes correctly. Same sample with the 'FLLR' chunk removed: 24 bit sample for justdan96 -modified.zip

I'll explore how to solve it.

sebarious70 commented 5 months ago

Sorry, you mean the 24/48 WAV has something called FLLR that is added by the iPhone? But I never used my iPhone for this. However, I used Final Cut Pro X. Could that be the reason?

On Feb 5, 2024, at 12:21, jcdr428 @.***> wrote:

@sebarious70 https://github.com/sebarious70 the problem arises from the non-standard (but spec compliant) 'FLLR' (filler) chunk added by the iPhone: if you remove the chunk with an hex editor, then tsMuxer muxes correctly. Same sample with the 'FLLR' chunk removed: 24 bit sample for justdan96 -modified.zip https://github.com/justdan96/tsMuxer/files/14169000/24.bit.sample.for.justdan96.-modified.zip I'll explore how to solve it.

— Reply to this email directly, view it on GitHub https://github.com/justdan96/tsMuxer/issues/823#issuecomment-1927518574, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFPWIC4UEVRRXFOGEM76OPTYSEIITAVCNFSM6AAAAABCJF4ALKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRXGUYTQNJXGQ. You are receiving this because you were mentioned.

jcdr428 commented 5 months ago

Yes the filler chunk is added by Apple to all apps using AVAudioRecorder. I've just pushed a fix, please try tomorrow's release and confirm whether this issue is solved.

sebarious70 commented 4 months ago

Thanks for fixing that! Just so I’m clear on what to do, I would have to do what is laid out in the COMPILING.md document at the bottom under "MacOS (Native)”, correct?

On Feb 6, 2024, at 02:31, jcdr428 @.***> wrote:

Yes the filler chunk is added by Apple to all apps using AVAudioRecorder. I've just pushed a fix, please try tomorrow's release and confirm whether this issue is solved.

— Reply to this email directly, view it on GitHub https://github.com/justdan96/tsMuxer/issues/823#issuecomment-1928929827, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFPWICYNOJIWF73YTGU5FT3YSHL5NAVCNFSM6AAAAABCJF4ALKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRYHEZDSOBSG4. You are receiving this because you were mentioned.

jcdr428 commented 4 months ago

@sebarious70 just download the latest release https://github.com/justdan96/tsMuxer/releases

jcdr428 commented 4 months ago

@sebarious70 please close the issue if solved.

sebarious70 commented 4 months ago

Hey man, sorry, I didn't have time to check on this until today. I’m playing the Blu-ray with the LPCM track rendered to 24/48 and it plays perfectly fine. Thank you so much!

What’s the link to donate something?

On Feb 9, 2024, at 08:27, jcdr428 @.***> wrote:

@sebarious70 https://github.com/sebarious70 please close the issue if solved.

— Reply to this email directly, view it on GitHub https://github.com/justdan96/tsMuxer/issues/823#issuecomment-1935926815, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFPWIC6LRFEL2ZVSPPGI7U3YSYP2VAVCNFSM6AAAAABCJF4ALKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZVHEZDMOBRGU. You are receiving this because you were mentioned.

sebarious70 commented 4 months ago

I've been up and down the thread and I don't see anywhere I can click to close the issue. Maybe it's because you opened it so you're the only one who can close it? Sorry, I rarely visit Github.

sebarious70 commented 4 months ago

Sorry, I just saw this:

"We are not currently accepting any kind of donations and we do not have a bounty program."

Makes me feel bad, I've been using this program every once in a while for several years. I'd be happy to donate to you guys if you give me a link or a Paypal email.

jcdr428 commented 4 months ago

Don't worry about donations, there are only independent volunteers working on tsMuxer. The best way to help is to report issues as you did. Closing.

sebarious70 commented 4 months ago

Well, I really appreciate all of you volunteers for working on this great software that has always been my first go to when I have to rewrap something, and now it’s even allowing me to burn my home movies to Blu-ray right from my Mac. Final Cut Pro X can do it but it adds a crappy looking menu even when you tell it not to, and you barely have any control over bitrate and things like that.

Is there a way to get a notification when you guys publish a new version?

On Feb 10, 2024, at 02:52, jcdr428 @.***> wrote:

Don't worry about donations, there are only independent volunteers working on tsMuxer. The best way to help is to report issues as you did. Closing.

— Reply to this email directly, view it on GitHub https://github.com/justdan96/tsMuxer/issues/823#issuecomment-1936920760, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFPWIC3G4MIFZCUULENMMPTYS4RNVAVCNFSM6AAAAABCJF4ALKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWHEZDANZWGA. You are receiving this because you were mentioned.

jcdr428 commented 4 months ago

You can customise notifications as explained on this page:

https://docs.github.com/en/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/about-notifications