Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: keenblade432 on March 04, 2021, 02:41:37 PM

Title: Unable to open *.ts files properly (Transport Stream Files)
Post by: keenblade432 on March 04, 2021, 02:41:37 PM
Hi,

I recently downloaded version 2.76 and realized that it has problems opening transport streams with 4K HEVC streams inside. Avidemux opens the *.ts files and then hangs. Unable to move around the clip.

I was previously using version 2.70 and this same *.ts file opened fine. I think somewhere along the way, something was broken.

The only reason i tried upgrading from 2.70 to 2.76 was because 2.70 was not able to fully index the large 4K streams (around 20+GB).

Wondering if anyone has any idea how to resolve this issue? Some change in settings?

Sample clip for reference. Remove the spacing in between  -  h t t p s : / / w w w .mediafire.com/file/vu5k7jj9vv1u35z/Test20210304.ts/file
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: eumagga0x2a on March 04, 2021, 03:30:43 PM
Quote from: keenblade432 on March 04, 2021, 02:41:37 PMI was previously using version 2.70 and this same *.ts file opened fine. I think somewhere along the way, something was broken.

Thank you for the sample, Avidemux definitely cannot handle it correctly as of now, I suspect an issue in the MPEG-TS demuxer. The file itself might be broken, but FFmpeg is capable of remuxing it in copy mode. Avidemux is then able to open the resulting TS file and navigate in it.

Still, I get a lot of warnings "First slice in a frame missing." from internal FFmpeg when seeking to keyframes, so either the stream is really broken (access units cut across frames) or we are doing something very wrong during indexing.

I'll try to look deeper into the issue soon. If I manage to develop fix, it will be in a future 2.7.8 nightly.

From 2.7.0 to the current 2.7.7 so many hundreds of bugs were fixed, that it is entirely possible that some rare scenarios regressed (this can easily happen when some stuff relies on actual bugs like missing length check and such to work).
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: keenblade432 on March 04, 2021, 04:11:29 PM
Thanks for the quick response.

I'm able to play the TS file in both VLC and PotPlayer. Also able to open that same TS file in TS Doctor, which reported no errors and was able to view/cut the same clip.

Could probably be as you suspected that something broke along the way.

If you need additional clips for testing, just let me know.
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: eumagga0x2a on March 04, 2021, 05:15:32 PM
VLC, which is also based on FFmpeg, cannot play the clip on my system, partially for performance reasons (too slow hardware), but mpv, which allows to disable audio track and also disable frame dropping, struggles very much too, with errors matching those Avidemux issues for the stream remuxed with FFmpeg. It looks like the video stream is really broken, but maybe we can handle it better.

Quote from: keenblade432 on March 04, 2021, 04:11:29 PMIf you need additional clips for testing, just let me know.

Thank you, it would be helpful to know the source of the stream, i.e. which application or device has generated this stream.
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: eumagga0x2a on March 04, 2021, 08:41:20 PM
I understand now the root cause of the problem: the HEVC stream in the sample lacks access unit delimiters (AUDs), which Avidemux expects to be present. Remuxing the stream with FFmpeg inserts AUDs where they belong and almost everything (except of other defects in the stream, but they are non-fatal) is back to normal.

Avidemux didn't handle MPEG-TS video streams with AUDs properly prior to version 2.7.2. Among related fixes, the commit [demuxers/MpegTS] Fix HEVC indexer to start each frame at NAL_AUD (https://github.com/mean00/avidemux2/commit/422fc732800d754ea3492f91bec3dcea30617570) destroyed the ability of the indexer to handle video streams without AUDs. I didn't have a single sample of this kind and nobody cried foul in all these years. Until now.

Looking into our options.
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: eumagga0x2a on March 05, 2021, 01:51:41 AM
Should be fixed by [demuxers/MpegTS] Fix indexing of HEVC streams without access unit delimiters, consistently use uint64_t for variables holding file offsets to avoid wrapping-around (https://github.com/mean00/avidemux2/commit/fd93320877a07416bb244952aaca885690f06971).

Thank you for your report.
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: keenblade432 on March 05, 2021, 05:47:21 AM
Wonderful. How do I access this fix for testing?

Can I test it with one of the nightly builds? Or do I have to wait for the next official release?
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: eumagga0x2a on March 05, 2021, 06:23:28 AM
The latter, probably later today (CET time zone), keeping fingers crossed.
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: keenblade432 on March 06, 2021, 01:45:58 PM
I tested the TS file on the latest nightly build of "avidemux_r210306_win64Qt5_56", seems to work fine even for large files around 15GB. Thanks

What's the difference between the "avidemux_r210306_win64Qt5_56" and the "avidemux_2.7.8 r210306_win64" nightly builds apart that one comes with a Windows installer and the other doesn't?

I always prefer to use the zip instead of the Windows Installer versions. Able to install multiple versions without overriding the previous ones
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: butterw on March 06, 2021, 02:33:41 PM
nightlies for Windows:
-cross-compiled with MinGW on Linux: https://avidemux.org/nightly/win64/ also provided as ZIP archives.
-native builds compiled with VC++ on Windows: https://avidemux.org/nightly/vsWin64/
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: eumagga0x2a on March 06, 2021, 03:15:10 PM
Quote from: keenblade432 on March 06, 2021, 01:45:58 PMWhat's the difference between the "avidemux_r210306_win64Qt5_56" and the "avidemux_2.7.8 r210306_win64" nightly builds apart that one comes with a Windows installer and the other doesn't?

It is just packaging. These binaries represent the 2.7.8 release which is 2.7.7 + fix for the bug you have reported + minor refinement for the size of time display in the main window and filter preview.

Quote from: keenblade432 on March 06, 2021, 01:45:58 PMI always prefer to use the zip instead of the Windows Installer versions. Able to install multiple versions without overriding the previous ones

There is no need to run the installer, 7zip can extract the payload of NSIS installers directly, the QtIF installer of VC++ builds needs some extra effort (someone wrote a Windows cmd.exe script to extract it, just can't find it at the moment...), but it is basically a set of concatenated 7z archives. Avidemux itself doesn't use registry, so if you don't want to mess with third-party cmd scripts, you always can copy the earlier installation to a different location, install a new version, copy the application directory elsewhere (delete the uninstaller, it is not needed) and uninstall the new version, keeping both.

Please be aware of possible configuration incompatibilities. In this case it is safer to make "portable" version (all versions are always portable, but on Windows it implies that configuration is saved in application directory, which needs to be writable by user for that purpose) by renaming avidemux.exe into avidemux_portable.exe.

Please avoid running multiple instances simultaneously (avoid in sense "never ever").
Title: Re: Unable to open *.ts files properly (Transport Stream Files)
Post by: butterw on March 07, 2021, 10:05:49 AM
Using the portable install allows to have multiple versions installed (each one with it's own settings), which is useful for testing.
You can safely run multiple versions at the same time (ex: the VC++ and Mingw version), but not multiple instances sharing the same settings (which could potentially cause issues).