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
853 stars 144 forks source link

MacOS M1/Arm 4K UHD BD ISO not playable on Oppo-203 #579

Closed axledentaldj closed 2 years ago

axledentaldj commented 2 years ago

I have a Mac mini M1 (2020) (Arm) on 11.6.5. With my build of tsmuxer 2.6.x (M1 Arm build) and the current 4-22-03 Nightly build for MacOS, doesn't make a 4K UHD BD ISO playable on my Oppo-203 (that has the Free Russian Jailbreak firmware on it). It states "File is Not Supported". Now, if a run tsmuxer to make a BDMV folder it usually says something along the lines of a dirty Disc error and will not play in the Oppo-203. So, in order to fix this, I have to take that tsmuxer ISO and use DVDFab 11.0.6.1Mac to just do a full copy and save again to another named ISO file, and then the Oppo-203 can play it. I don't know what DVDFab does differently between tsmuxer and DVDFab in making ISOs?

The BD ISO files sizes are the same. The crc32 to each file is different though. Maybe its breaking the index.bdmv or MovieObject.bdmv files? I think I tried switching them around...?

This happens whether its at BDMV Im remuxing or a mkv container to ISO switching.

Windows tsmuxer-git-08d1269 works just fine!

jcdr428 commented 2 years ago

@axledentaldj have you tried with the options -insertSEI -contSPS (which are now off by default) ?

axledentaldj commented 2 years ago

Im not sure where that is unless its in the greyed-out box for "Do not change SEI and VUI data" box from the HEVC selected video.

jcdr428 commented 2 years ago

@axledentaldj sorry you're right, the change affects AVC only. Can you please provide a sample. Edit: I really cannot see any change from commit 08d1269 that would make the ISO not playable. Can you find out which last commit works fine ?

axledentaldj commented 2 years ago

A sample here: https://mega.nz/file/JcgEnAwb#KXQmjoS2sC484gcLWXRjrzPe28vhnP7WbmI9OCgVMNA

jcdr428 commented 2 years ago

@axledentaldj having verified your ISO, and compared with ISOs produced by working git 08d1269 and last git cad2b42 with UDF Verifier:

All files within the ISOs are strictly the same (same CRC32). Both git 08d1269 and git cad2b42 are UDF compliant.

Last git cad2b42 shows :

    PVD   Volume Identifier    : " "
    PVD   Volume Set Identifier: "3847DE5D         "
  ==>   PVD  344 New Entity Identifier (regid):
    Application Entity Identifier
      Identifier         : "*tsMuxeR git-cad2b42"

However your ISO file results in the following warning:

    PVD   Volume Identifier    : "Test sample UHD"
    PVD   Volume Set Identifier: "239963CD        Test sample UHD"
  ==>   PVD  344 New Entity Identifier (regid):
    Application Entity Identifier
      Identifier         : "*tsMuxeR 2.6.16-The Axl"
      Implementation Use : #65 #64 #65 #6E #74 #61 #6C #20
    PVD  376 Timezone warning: Offset is no multiple of 15 minutes,
-        timezone offset: -4 minutes (west of UTC),
-        time: 2022-04-24 15:24:09 -00:04
- ==>   Message printed once, ignored from now.

In brief, you seem to use a modified tsMuxeR version "2.6.16-The Axledental " which does not produce compliant UDF ISOs. Edit: Or maybe you have modified the identifier with an hex editor ?

axledentaldj commented 2 years ago

Well, my tsmuxer build and git-cad2b42 Mac Nightly build still do not play my 00000.iso sample on my Oppo-203. I did not use any modification in any hex editor. I'm not skillful enough to use a hex editor. I'm lucky I learned how to compile tsmuxer with everyones help here. :-D

I just made a fresh tsmuxer_build folder with a fresh tsMuxer-master compile: 00001-my-compiled-2.6.16-dev-default.iso and still the same issue. I did NOT do any custom changes at all or hex edit anything in this compiled build.

Did you do any comparisons to the windows builds that I used? Do you want the sample from my working DVDFab remuxed back to a full copy ISO? Correction, this one: https://mega.nz/file/1IomXB7b#b28G3VdlL1Xx3FmD0ftir3gV929vjygjV5QSc1oQHBI

jcdr428 commented 2 years ago

@axledentaldj can you please advise what is the last commit working (starting with 04-Apr 22e8c98 then back).

axledentaldj commented 2 years ago

I do not understand? This issue has been going on even when I was trying to get justdan96 to help me fix the Mac mini M1 Arm compiling GUI issues many months ago. And he told me to start a new ticket for this one.

jcdr428 commented 2 years ago

I misunderstood when you stated that Windows tsmuxer-git-08d1269 was working just fine: I thought that the problem appeared after the 31st March. So the BD ISOs from Mac tsMuxer never worked on your Oppo ?

axledentaldj commented 2 years ago

I can't be sure if there ever was a Mac version of tsmuxer that worked right for making 4K BD ISOs? I just know its been many, many, months and its still not working. But the Windows build that I have, does work.

justdan96 commented 2 years ago

I have an M1 Mac I can borrow for testing and I am currently working on a new version of the Docker container that can create universal x64/arm64 binaries for Mac. I'll see if I can create a build from the latest commit in master and you can test if the same issue occurs, otherwise I'd need you to re-upload your sample.

axledentaldj commented 2 years ago

Sure, I got them on my mega ready for you: https://mega.nz/file/dQoixRxL#wh_NvkG7Z5uZEWrhU__LndX-y35nl7tRr9IErG89E50

justdan96 commented 2 years ago

Would you be able to check if you get the same result with the "4K, Quad-Full-HD (3840x2160) 60FPS" file from: http://bbb3d.renderfarming.net/download.html

axledentaldj commented 2 years ago

That file can not be compatible with remuxing it into a BD ISO in tsmuxer 2.6.16-dev as I get an error:

justdan96 commented 2 years ago

It looks like there is a corrupt frame in the source file, you can use ffmpeg to truncate the file before the corrupt frame:

ffmpeg  -i bbb_sunflower_2160p_60fps_normal.mp4 -to 00:05:00 -c copy bbb_fixed.mp4

If you can then try it on the new file, we can see if that can be used to reproduce the issue.

axledentaldj commented 2 years ago

I used the tsmuxer setting under split & cut and set to end in 5 minutes, that allowed tsmuxer to remux into a BD ISO with no errors. But, the Oppo-203 still said File Not Supported". But a DVDFab BD ISO copy of that made the Oppo-203 state Bad or dirty disc error popup". SO, it could also be a bad h.264 encode with unsupported audio track for the H264 Spec BD ISO for the Oppo-203. So, I'm not sure if its a good test video we should use?

I'll remove the MPEG 160kbps part and see what results I get.

After taking out that MPEG 160kbps audio track, the Oppo-203 still states "File not Supported", but remux DVDFab 11.x copy back out the another BD ISO does play on the Oppo-203!! Do you want both files to compare?

The Bunny 5 minute video is strange too, I can't fast forward it, but it least it starts playback and I hear Dolby Digital 5.1 audio.

jcdr428 commented 2 years ago

@axledentaldj can you please post the ISO produced by latest tsMuxer MacOS, and the ISO produced by same release tsMuxer Windows. I will analyse differences. Cut the m2ts to no more than 100MB please, I can't download 4GB.

axledentaldj commented 2 years ago

I used tsmuxer Mac nightly build git-7ec1adc and split & cut to only be 1 minute long of the movie. I did the same for the Windows 64-bit git-7ec1adc nightly build for April 27th. The MacOS tsmuxer BD ISO does Not Play in the Oppo-203. the Windows 64-Bit tsmuxer BD ISO DOES play in my Oppo-203.

Each are 330MB Iso files. tsmuxer_mac_build here: https://mega.nz/file/kAJhVZyI#QX84xIlCVChxcpJUsNDKLBXcWZAil_o13QZdR6EkbnU

tsmuxer_windows64-bit here: https://mega.nz/file/gEBxUJZK#74vxNqeNNYpPb3ZjYbq90LvzNB-Y-yOndjZ2VDqL71I

jcdr428 commented 2 years ago

udfmac.txt udfwin.txt Duh... having checked UDF 2.50 specification [2.1.4.1 Uint16 TypeAndTimezone], the time zone should be in minutes, not in hours ! The Mac ISO does not work because it has a time zone of -4 min. instead of -4 hours. The Win ISO works because the time zone is zero (probably the computer time is set to GMT).

@axledentaldj I've pushed a fix, please try tomorrow.

axledentaldj commented 2 years ago

I prolly should tell you, in order for me to test Windows, I use Parallels 17.x and its in trial mode, so I always run it on 8/31/2021 to keep running in Trial mode for Parallels Windows 10 (Arm). I hope that didn't affect your findings? Thanks. I wait til tomorrow for any new binaries to test.

justdan96 commented 2 years ago

You can try the new binaries from here: https://github.com/justdan96/tsMuxer/releases/tag/nightly-2022-04-28-03-42-16

axledentaldj commented 2 years ago

Tried the new Mac binaries and still the same issue.

I found and ran udfct_1.5r4 on the ISO and saw PVD recording was at -5 min? Shouldn't it be 1 minute because that's the length of the sample I did.

Here's my file: https://mega.nz/file/ZVgTCKZQ#0HUMxQFinrvtNeSsFQCUz17x26qkhXJp1siqikfCsTU

jcdr428 commented 2 years ago

@axledentaldj GMT is -5 hours (not minutes, so fixed) however there is still an error :

    LVID 16  Error: LVID Recording Time shall not be later than
-        Verification start time, UDF 3.1.1.
-            LVID Recording Time: 2022-04-28 21:45:02 -05:00
-        Verification start time: 2022-04-28 22:35:10
-     LVID Recording Time is in the `future.`

I've pushed a new commit, please try tomorrow.

axledentaldj commented 2 years ago

Still not fixed. (00000-tsmuxer_mac-git-79b86ec) Here: https://mega.nz/file/5YwlWRrA#dJKzBcXLrUPQXE9bsr48Tb9zdbqLFQiC82vj2IVRpks

DVDfab ISO Copy: https://mega.nz/file/gAxWGboJ#ZYgrj4U3m6O53_gMZ2nCHX5Ezo03cSR7b8ligLj_kR8

jcdr428 commented 2 years ago

UDF_Verifier_mac-git-79b86ec.txt UDF_Verifier_windows64bit-git-7ec1adc.txt UDF_Verifier_mac-git-79b86ec-dvdfab.txt

As can be seen, no error anymore, and the UDF-Verifier log is now strictly the same as the working Windows ISO except for commit number and recorded times: I can't understand why the Win iso would work and the Mac iso would fail.

There are differences between the Win/Mac tsMuxer and the DVDFab logs, but I am not expert enough on UDF to assess their consequence.

jcdr428 commented 2 years ago

@axledentaldj I have made some few corrections from the differences I've spotted with dvdFab and ImgBurn, please try tomorrow. Edit: or try now with https://github.com/justdan96/tsMuxer/actions/runs/2257992573

axledentaldj commented 2 years ago

I would but that tsMuxeR exe is for MacOS? and it needed a sudo chmod +x to it and is missing:

Screen Shot 2022-05-02 at 5 21 11 PM
jcdr428 commented 2 years ago

@axledentaldj I am not familiar with the Mac builds, there are two builds at https://github.com/justdan96/tsMuxer/actions , the second one is https://github.com/justdan96/tsMuxer/actions/runs/2258213312

axledentaldj commented 2 years ago

A bit confusing, but I used the MacOS Build from here: https://github.com/justdan96/tsMuxer/actions/runs/2258213312

00000_tsmuxer_mac_git-7dcca48 still has the same issue, but DVDFab remuxed full BD copy does plays.

Interestingly, making a BDMV folder,(from commit b400451fa3) for MacOS, I see something weird and the Oppo-203 sees an empty folder..

Screen Shot 2022-05-02 at 6 00 38 PM
jcdr428 commented 2 years ago

@axledentaldj what do you mean "I see something weird and the Oppo-203 sees an empty folder" ?

I found a bug which I spotted when analysing the differences with DVDFab/ImgBurn, which was not highlighted by the Philips udf_test, and took me a lot of trials and errors to correct -there was a termination descriptor missing in the ISO after the File Set Descriptor. I pushed a fix, hopefully this was the cause of the issue...

axledentaldj commented 2 years ago

I thought I saw something weird. I thought it was a visual thing but the Oppo-203 being an Oppo. 😁 Probably from the "Blessed" AVCHD issue? Nope, it wasnt that. Thats why I saw an empty folder. I look forward to testing this next fix you have found. Thanks.

axledentaldj commented 2 years ago

I tested git-e85de68 for MacOS and still same issue. I tested tsmuxer-win64-git-e85de68 and that works. I don't know if you pushed out the fix yet?

jcdr428 commented 2 years ago

@axledentaldj indeed I pushed the fix ! I suspect the issue might be the GTM vs local time. Why else would the Win build work and not the Mac build ? So I've created a simple fork where local time = GMT time. Could you please try https://github.com/jcdr428/tsMuxer/suites/6379102774/artifacts/231490971

axledentaldj commented 2 years ago

Thanks, but still same issue: 00000-tsmuxer-mac-git-4619fd1.iso download here: https://mega.nz/file/tYwXDL6Z#QLHpvTxABPECoJn7IsDKmaZbzXjbHu_Vy92HjRuZK0A

jcdr428 commented 2 years ago

Can you please also post the tsmuxer-win64-git-e85de68 ISO ?

axledentaldj commented 2 years ago

sure, here: https://mega.nz/file/IZICRTiZ#Dg-gkk-q5Imx2TwTi9YOMnp43IwK5P0XWj73kXvsydA

jcdr428 commented 2 years ago

@axledentaldj where does the 4619fd1 commit come from ? Edit: sorry I forgot it was my fork... Very strange, the m2ts has the DTCP (Digital Transmission Content Protection) descriptor set to 0x4d568804 instead of 0x0ffffcfc.

This descriptor is written by line 414 of tsPacket.cpp, I simply can't see how this descriptor is changed with the MAcOS build. Unfortunately without Mac I cannot trace.

axledentaldj commented 2 years ago

Ok, but, can I do anything to help?

jcdr428 commented 2 years ago

@justdan96 @xavery if you have access to a Mac, maybe you can help ?

Edit: 4d568804 are actually the four bytes just before the DTCP, which are written twice ?!? How the hell can this happen ?

hex

axledentaldj commented 2 years ago

Hmm, is there a way to "proof of concept" way that if I hex edit the DTCP in the m2ts file to be 0x0ffffcfc to see if that fixes it?

jcdr428 commented 2 years ago

@axledentaldj yes replace all 05 04 48 44 4d 56 88 04 4d 56 88 04 with 05 04 48 44 4d 56 88 04 0f ff fc fc in the ISO

axledentaldj commented 2 years ago

OOh, that's tricky, I might not be skilled enough to hex edit directly the ISO, but I'll take a look and try now. Thanks.

I have Hex Fiend app.

Screen Shot 2022-05-05 at 4 04 38 PM
jcdr428 commented 2 years ago

Yes that should do it. Maybe you'll need to remove the spaces.

axledentaldj commented 2 years ago

OMG, that worked!!! I tested it twice. The 2nd time was on a fresh remux of the 00000-tsmuxer-mac-git-e85de68_B.iso and made sure it did not work on my Oppo-203, then I carefully hex edited like you described, no spaces, and it worked!!

jcdr428 commented 2 years ago

:) :) :) I was focusing on the UDF formatting when it was the m2ts... At least now the ISO is perfect. Now we have to find the bug. @xavery any chance of a leak in the putBits method (bitStream.h line 180), e.g. in m_curVal <<= (INT_BIT - m_bitWrited); where INT_BIT = 32 ?

jcdr428 commented 2 years ago

@axledentaldj can you please try https://github.com/jcdr428/tsMuxer/suites/6394846808/artifacts/232610946 (change type of m_curval from unsigned int to uint_32)

axledentaldj commented 2 years ago

Just tried it. 00000-tsmuxer-mac-git-a247641.iso did not play on the Oppo-203 (File Not Supported). Nor does hex editing it make it play. Download it here: https://mega.nz/file/kdICjYSJ#dP1DwHfrLWBtz5MdESQ4bPCZeLstOKabekDq0a24aE4

jcdr428 commented 2 years ago

@axledentaldj sorry but without access to a MacOS I am kind of working blind and can only guess what could cause the issue / try various fixes. Could you please try https://github.com/jcdr428/tsMuxer/suites/6413396056/artifacts/233885964 ?

axledentaldj commented 2 years ago

Nope, still same issue. I know its going to be hard to fix. You dont have an Oppo-203. Do you have any standalone Blu-ray player. I think this happens on 1080p Blu-ray ISOs...? Ill re-check. Yes, same with 1080p Blu-rays. At least I can hex edit it and fix it.

jcdr428 commented 2 years ago

I don't have any standalone player. Can you please post the latest iso ?