2.8.0 repeatable crash - could be VC-1 video or LPCM audio related

Started by bconway, January 01, 2022, 01:47:24 AM

Previous topic - Next topic

bconway

I'm attempting to expand my collection of test files, and used MakeMKV to extract Harry Potter 1 from Blu-Ray. This is the first edition Blu-Ray, the one that doesn't have HD audio but has DD 5.1 and LPCM (arguably HD). Any attempt to load the file, or the 256 MB sample linked below, crashes with:

Assert failed :0
 file /Volumes/HudsonData/jenkins/MacOSX_Catalina/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkv.h, line 173

Link to a 256 MB sample, created with dd (public, close the modal to view/download):

https://www.dropbox.com/s/e7bep6ouwhrojxa/harry_potter_vc1_lpcm_test.mkv?dl=0

Thanks.

szlldm

Looks like audio related: "Overflow in reading  mkv audio".

szlldm

As a temporary solution, you could remove the LPCM track, for example with MKVToolNix.

bconway

Quote from: szlldm on January 01, 2022, 01:05:27 PMAs a temporary solution, you could remove the LPCM track, for example with MKVToolNix.
Thank you, I will do that. Hopefully the sample file is useful to someone.

eumagga0x2a

The problem arises because we assume AAC_LATM for the second track from encountering MS/ACM compatibility layer with non-zero extradata (replacing MKV_MUX_LATM with WAV_PCM "fixes" the second audio track, the question is only how to tell various MS/ACM encapsulated audio types from each other).


eumagga0x2a

diff --git a/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvEntries.cpp b/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvEntries.cpp
index 3ba20a63e..21ae0ac58 100644
--- a/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvEntries.cpp
+++ b/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvEntries.cpp
@@ -303,18 +303,21 @@ uint8_t mkvHeader::analyzeOneTrack(void *head,uint32_t headlen)
            {
                mixDump(entry.extraData,l);
                memcpy(&(t->wavHeader),entry.extraData,wavSize);
-                ADM_info("Encoding : %d\n",t->wavHeader.encoding);
-                wavSize+=2; // size of WAVEFORMATEX
+                ADM_info("Encoding : 0x%x\n",t->wavHeader.encoding);
+                if(t->wavHeader.encoding == 0xfffe)
+                    wavSize+=2; // size of WAVEFORMATEX
                int x=l-wavSize;
 
-                if(x>0) // If we have more than WAVEFORMATEX, it is extradata
+                if(t->wavHeader.encoding == 0xfffe)
+                {
+                    ADM_warning("Setting encoding to WAV_PCM\n");
+                    t->wavHeader.encoding = WAV_PCM;
+                }else if(x>0) // If we have more than WAVEFORMATEX, it is extradata
                {
                    ADM_info("Found %d bytes of extradata\n",x);
                    t->extraData=new uint8_t[x];
                    t->extraDataLen=x;
                    memcpy(t->extraData,entry.extraData+wavSize,x);
-                    if(t->wavHeader.encoding==0xfffe) // WAVE_FORMAT_EXTENSIBLE + extradata: might be AAC LATM
-                        t->wavHeader.encoding=MKV_MUX_LATM;
                }
                if(t->wavHeader.encoding==MKV_MUX_LATM)
                {

should fix that, just need to clarify whether it is okay to open the tree right now.


eumagga0x2a

This patch won't fix broken timestamps in the video stream, however.

Regarding the PCM audio track, the problem would have been avoided if MakeMKV had used the proper tag for the codec (A_PCM/INT/LIT).

eumagga0x2a

A more or less proper fix for the issue of misidentified audio track has been pushed to the repository. It may take quite a while until fresh nightly builds from the master branch get generated and uploaded, though.