WMV/ASF plugin fixed crash when load large wmv

Started by zeas, September 16, 2018, 06:15:28 AM

Previous topic - Next topic

zeas

Modified the original plugin to fix crash issue when load large wmv/asf files.
Replace all member/local variant refer to offset/filesize to uint64_t

Only win32 now, tested on 2.7.1


The patch above based on official 2.7.1 released source code.

=====================================
ADM_asf.h
82c82
<   uint32_t  _chunkStart;
---
>   uint64_t  _chunkStart;
132c132
<     uint32_t                _dataStart;
---
>     uint64_t                _dataStart;
199c199
<     uint32_t                _dataStartOffset;
---
>     uint64_t                _dataStartOffset;

=====================================
ADM_asfPacket.h
51c51
<     uint8_t         skip( uint32_t how);
---
>     uint8_t         skip( uint64_t how);
53,55c53,55
<     uint32_t        packetStart;
<     uint8_t         segmentId;
<     uint32_t        pakSize;
---
>       uint8_t         segmentId;
>       uint64_t        packetStart;
>     uint64_t        pakSize;
58c58,59
<     uint32_t        _offset;
---
>     uint64_t        _offset;
>     uint64_t        _startDataOffset;
60d60
<     uint32_t        _startDataOffset;

=====================================
ADM_asfPacket.cpp
81c81
<    uint32_t offset=_startDataOffset+packet*pakSize;
---
>    uint64_t offset=_startDataOffset+packet*pakSize;
101c101
<         pts=read32()*1000; // PTS
---
>         pts=(uint64_t)read32()*1000; // PTS
183c183
<    dts=1000*read32(); // Send time (ms)
---
>    dts=1000*(uint64_t)read32(); // Send time (ms)
194c194
<    uint32_t payloadLen;
---
>    uint32_t payloadLen = 0;
369c369
<    uint32_t go;
---
>    uint64_t go;
398c398
<  uint8_t   asfPacket::skip( uint32_t how)
---
>  uint8_t   asfPacket::skip( uint64_t how)

=====================================
ADM_asfHeaders.cpp
415c415
<   uint32_t fSize;
---
>   uint64_t fSize;


eumagga0x2a

Quote from: zeas on September 16, 2018, 06:15:28 AM
Modified the original plugin to fix crash issue when load large wmv/asf files.

Thanks, I'll try to look into it later. How large were the wmv/asf files to trigger the problem? Did you really encounter WMV > 4 GiB in size?

zeas

Quote from: eumagga0x2a on September 17, 2018, 07:23:27 AM
Thanks, I'll try to look into it later. How large were the wmv/asf files to trigger the problem? Did you really encounter WMV > 4 GiB in size?

Yes. And WMV > 2GB may cause crash in previous version (<2.6)
By the way, some large WMV < 4GB may not cause crash but cannot seek frames after a time point, due to pts = read32() * 1000 larger than 0xFFFFFFFF and be truncated.

eumagga0x2a

Please try the latest (r181024 or later) nightly (win32, win64). It should fare better when dealing with large wmv files.

coolgit

#4
The error before using the latest update was that the wmv would not go over 1 hr 11 minutes. Now it does... great.

However now batch processing using py won't work, before it did.

#
# Load all the files in c:\tmp with .avi extension.
# That's it.
#
ext="wmv"
inputFolder="E:\\Silent\\"
#
def convert(filein):   
    if(0 == adm.loadVideo(filein)):
        ui.displayError("oops","cannot load "+filein)
        raise
    # ---------- Inserting project start------------
    adm.videoCodec("HUFFYUV", "encoderType=1")
    adm.audioCodec(0, "PCM");
    adm.setContainer("AVI", "odmlType=1")
    # ---------- Inserting project end------------
    adm.save(filein+".edit.avi") # save the file
    print("Done")
 
#
# Main
#
ui=Gui()
adm = Avidemux()
#
list=get_folder_content(inputFolder,ext)
if(list is None):
    raise
for i in list:
        convert(i)
print("Done")

It say can not find demuxers??

I can still do one file at a time...weird.

It just got stranger. I had the latest version on another directory so i thought to load the old version 2.71. Thus version 2.71 was opened then using the latest version i got batch processing to work. I closed the 2.71 version and batch processing stopped working.

eumagga0x2a

First of all, please don't mix Avidemux versions, install only one at a time.

Which build exactly have you downloaded? I didn't have time yet to try any of the new Visual Studio generated builds, I don't know their limitations. Please use MinGW (win64) builds for now, the latest one has been generated on 2018-11-28 so far.

QuoteIt say can not find demuxers??

Please open the script console in Avidemux and evaluate the following script:

ext="wmv"
inputFolder="E:\\Silent\\"
list=get_folder_content(inputFolder,ext)
for i in list:
  print(i)
print("\n")


Does the output lists correctly the content of the folder?

coolgit

I got it to work now using fresh install.

The website example http://www.avidemux.org/admWiki/doku.php?id=tinypy:tinypybatch2 shows adm=Avidemux() which doesn't work until i used adm = Avidemux()

Just thought you may like to know.