Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: zeas on September 16, 2018, 06:15:28 AM

Title: WMV/ASF plugin fixed crash when load large wmv
Post by: zeas on September 16, 2018, 06:15:28 AM
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;

Title: Re: WMV/ASF plugin fixed crash when load large wmv
Post by: eumagga0x2a on September 17, 2018, 07:23:27 AM
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?
Title: Re: WMV/ASF plugin fixed crash when load large wmv
Post by: zeas on September 17, 2018, 03:32:28 PM
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.
Title: Re: WMV/ASF plugin fixed crash when load large wmv
Post by: eumagga0x2a on October 25, 2018, 08:10:51 AM
Please try the latest (r181024 or later) nightly (win32 (https://avidemux.org/nightly/win32/), win64 (https://avidemux.org/nightly/win64/)). It should (https://github.com/mean00/avidemux2/commit/d7de4c2045a9b75a25d0dc5d4754b430a9737ccd) fare better when dealing with large wmv files.
Title: Re: WMV/ASF plugin fixed crash when load large wmv
Post by: coolgit on December 12, 2018, 12:04:22 PM
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.
Title: Re: WMV/ASF plugin fixed crash when load large wmv
Post by: eumagga0x2a on December 12, 2018, 08:04:17 PM
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) (https://avidemux.org/nightly/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?
Title: Re: WMV/ASF plugin fixed crash when load large wmv
Post by: coolgit on December 13, 2018, 04:05:23 PM
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.