Avidemux Forum

Avidemux => Unix-Like (Linux/Bsd/...) => Topic started by: yorickk on March 27, 2021, 07:56:23 AM

Title: Error when loading video
Post by: yorickk on March 27, 2021, 07:56:23 AM
I am using Avidemux 2.7 in Ubuntu 20.04 to process videos recorded on my Topfield PVR.  They are transferred to the Ubuntu PC using an external HDD formatted in ext2.  I am doing this because the transfer is faster with ext2 format rather than NTFS.  I previously loaded them onto a Windows PC but since the latest Windows 10 updates the ext2 file reader is not stable.  When I load the videos into Avidemux I am intermittently getting a corrupted opening frame.  It displays what appears to be a mixture of Ubuntu panels with black bars and rectangles interspersed. I do a video and audio copy in Avidemux to quickly get a clean transport stream file. At the end of the processing I get a message about being unable to find 00.00.000 and after clicking OK the processing finished panel pops up.  I copy the processed files onto an USB thumb drive and transfer them to my Windows PC where they look ok without the corrupted first frame.

I am flagging this up here as its my first post and I am not sure if it is the correct place.  Has this phenomena been reported before?
Title: Re: Error when loading video
Post by: eumagga0x2a on March 27, 2021, 03:20:03 PM
Are you using 2.7.8 (or the latest git)? Anything older is unsupported. If you do, please check whether the problem persists when you reduce the maximum number of libavcodec threads for decoding to 2.
Title: Re: Error when loading video
Post by: yorickk on March 28, 2021, 05:54:38 AM
I am using avidmuxLinux-_2.7.8_GLIBC_2.28_amd64.appImage.

If this is the wrong version can you advise the exact website where I should download from.

I have used Edit > Preferences > Threading tab to change lavc threads from Auto-detect to Custom = 2 (note both boxes in the HW Accel tab are unticked). I assume this is what you are asking me to do - there is no mention of libav codec.

I get the same result - in fact I have also found that if I close down Avidemux and re open with the same video file I get a different scrambled first frame each time.  In front of me now is a display showing very scrambled content including what appear to be Avidemux panels ie "Select Video File" (I have also had "Avidemux" panel header with the underscore line, box, and cross on the right). On the present display there are also some vertical black bars below the "Select Video File" bar interspersed with scrambled text. The bottom third of the display is nearly all black with a few vertical and horizontal white lines.  I initially thought the problem might be the video driver but the scrambled data appears to be coming from within Avidemux.
Title: Re: Error when loading video
Post by: eumagga0x2a on March 28, 2021, 01:01:06 PM
In this case, the version (the last release) should be fine, albeit the latest nightly (https://avidemux.org/nightly/appImage4Buster/) (the 210326_0846 one) has some bugs (two crashes and swapped red and blue gamma sliders in the eq2 video filter) fixed and a truckload of new video filters added.

Garbage shown on decoding failure is a purely visual glitch, it is the decoding failure which is the problem to assess.

Do other applications like mpv play the streams which Avidemux fails to decode fine? If so, then please provide a (preferably short, 100-200 MiB) sample via WeTransfer, Mega, Dropbox or Google Drive.
Title: Re: Error when loading video
Post by: yorickk on March 29, 2021, 10:57:34 AM
Before we get too technical I am not an in-depth user so some of the things you talk about are over my head.

I do not have the mpv player installed. I have just tried to install it but it failed!

When I play the video from the external HDD it plays ok with "vlc" and "videos" players (may stutter a bit first off but ok on subsequent tries - no funny first frames).

Please note that the Avidemux "next frame" and "next key frame" buttons do not work on the corrupted videos but do work on uncorrupted videos.  At present this is why I am still using my Windows 10 PC Software and not Avidemux on my Ubuntu PC to edit and render the videos.

I will need to set up to provide sample data and at the same time I have noticed some other things that are happening.  I intend to do a comprehensive review of what is occurring to give you as much info at the one time instead of in dribs and drabs. The Ubuntu PC is a fairly old one that had windows 7 initially and was then updated to Windows 10 before I decided to try Ubuntu so I am a bit concerned that it may turn out to be a hardware issue. This may take a few days.  Thanks for the comments so far.
Title: Re: Error when loading video
Post by: eumagga0x2a on March 29, 2021, 03:21:10 PM
Quote from: yorickk on March 29, 2021, 10:57:34 AMI have just tried to install it but it failed!

Did mpv fail to play the videos? Or was it the installation of the package which failed?

Quote from: yorickk on March 29, 2021, 10:57:34 AMWhen I play the video from the external HDD it plays ok with "vlc" and "videos" players (may stutter a bit first off but ok on subsequent tries - no funny first frames).

In this case a sample (preferably short) which can be played in vlc and in totem and which cannot be played (decoded) with Avidemux would be indeed helpful. To be sure that the problem is not related to things like an issue with the external storage, please test with local samples only.

Quote from: yorickk on March 29, 2021, 10:57:34 AMPlease note that the Avidemux "next frame" and "next key frame" buttons do not work on the corrupted videos but do work on uncorrupted videos.

This is the natural consequence of the inability to decode the first keyframe of the stream. You may be able to advance past the non-decodable frame by dragging the navigation slider.

Quote from: yorickk on March 29, 2021, 10:57:34 AMThe Ubuntu PC is a fairly old one that had windows 7 initially and was then updated to Windows 10 before I decided to try Ubuntu so I am a bit concerned that it may turn out to be a hardware issue.

This would be immediately obvious from the dmesg output.
Title: Re: Error when loading video
Post by: yorickk on March 31, 2021, 12:15:59 PM
mpv failed to install  - something about the server not being secure. However I have now installed it and have played the "corrupted" videos with it and vlc player - ok in both cases.  mpv seems to be quicker to start than vlc and shows the timeline count up and down ok but vlc counts up but shows 0 in the countdown.

I have tried using Avidemux to cut a short "corrupted" video using the slider but the saved video shows as a text document and cannot be played. In fact none of the edit buttons work including the A and B ones but as you said this is presumably a natural consequence of the inability to decode the first frame. Where to from here - using the Windows PC to edit (I use Video Redo TV Suite v6) introduces external factors. At present I do not have any other video editing software installed in Ubuntu.

In Avidemux I set audio and video to copy and select the output format as MpegTsMuxer(ff) and save without editing to a different folder.  When I load the output file back into Avidemux the first frame is still corrupted. I have also noted that the output video is 10 to 15 % smaller in size than the original.

One last thing I have just tried is to convert the unedited vide to mp4 format.  Settings: Video Output = Mpeg4 AVC (x264) 1500MB size :Audio Output = AC3(lav) :  Output Format = MP4 Muxer   Error message "Cannot set up encoder..etc".

Since the output videos seem to transfer ok to the Windows PC I may have to put up with the annoyance of the corrupt first frame and continue to use VRDTVS6 to do the editing



 
Title: Re: Error when loading video
Post by: eumagga0x2a on March 31, 2021, 12:26:51 PM
Please provide an unalterated sample (the first ~100 MiB should suffice) of such a MPEG-TS stream via WeTransfer, Mega, Dropbox or Google Drive.

head -c 100M /path/to/source.ts > /path/to/sample.ts
Title: Re: Error when loading video
Post by: eumagga0x2a on March 31, 2021, 12:35:45 PM
Quote from: yorickk on March 31, 2021, 12:15:59 PMWhen I load the output file back into Avidemux the first frame is still corrupted.

Obviously, copying a frame won't fix anything if the data is corrupted.

Quote from: yorickk on March 31, 2021, 12:15:59 PMOne last thing I have just tried is to convert the unedited vide to mp4 format.  Settings: Video Output = Mpeg4 AVC (x264) 1500MB size :Audio Output = AC3(lav) :  Output Format = MP4 Muxer  Error message "Cannot set up encoder..etc".

If the source cannot be decoded, it cannot be re-encoded because there is nothing to re-encode...

The most promising approach without having a chance to inspect a sample would be to cut away the beginning of the file and try to load the remainder:

tail -c +50M /path/to/source.ts > /path/to/cut-starting-from-50-mebibytes-offset.ts
Title: Re: Error when loading video
Post by: yorickk on April 01, 2021, 07:16:58 AM
I have loaded 3 newly recorded videos to Avidemux today. 2 were ok but the third video had a corrupted first frame.

I have used the command you provided to create the smaller head video (just over 100M) from the third video above, but am unable to transfer via WeTransfer as I do not have an email address to send it to. None of the other transfer applications are installed.

I have used the other command to create the larger tail video from the third video above , but ... when I load it to Avidemux I still get a corrupted first frame.   

One thing I noticed was that when I loaded the 2 "good" videos a frame flashed up very very briefly (too quick to see anything) before the good first frame appeared. On the third one the corrupted first frame appeared immediately. This something that I recall seeing before but thought it to be just part of the loading process. Note that I am using File > Open to select the next video.






Title: Re: Error when loading video
Post by: eumagga0x2a on April 01, 2021, 08:30:53 AM
Quote from: yorickk on April 01, 2021, 07:16:58 AMI have used the command you provided to create the smaller head video (just over 100M) from the third video above, but am unable to transfer via WeTransfer as I do not have an email address to send it to.

No email address is required for WeTransfer despite the provider trying hard to make it look at the first glance as if one were necessary.

Quote from: yorickk on April 01, 2021, 07:16:58 AMNone of the other transfer applications are installed.

No local clients are needed to use them, a browser suffices (but contrary to WeTransfer, you need an account, at least for Google Drive).

Quote from: yorickk on April 01, 2021, 07:16:58 AMI have used the other command to create the larger tail video from the third video above , but ... when I load it to Avidemux I still get a corrupted first frame.

This means the issue is not just some occasional damaged frame.
Title: Re: Error when loading video
Post by: yorickk on April 01, 2021, 09:37:08 AM
The head video is at this link: https://we.tl/t-xvU88eSluL (I agree its not clear what the WeTransfer processes is but I got there in the end!)

I will await your testing of the video. Many thanks for your help so far. 
Title: Re: Error when loading video
Post by: eumagga0x2a on April 01, 2021, 10:59:07 AM
Thank you for the sample, this is again an issue with decoder multi-threading. This sample is decodable only with multi-threading disabled completely. You should enable HW accelerated decoding (VDPAU if your PC has a NVIDIA graphics card with NVIDIA driver active, VA-API if you have Intel; you are probably out of luck with AMD Radeon) to reduce the burden put on the CPU instead.
Title: Re: Error when loading video
Post by: eumagga0x2a on April 01, 2021, 11:54:33 AM
As mpv and ffplay decode the video stream in the sample in software with multi-threading enabled just fine, even with 8 threads, I suspect that we are doing something wrong in the way we handle libavcodec.

libavcodec decoder multi-threading was enabled very late in the last release cycle, therefore no in-depth assessment of compatibility with existing design was possible. The feature has proven to be very useful in many scenarios, but it would be great to cut the rough edges. On my todo list.
Title: Re: Error when loading video
Post by: yorickk on April 01, 2021, 12:21:06 PM
I am so glad that you have found the "problem".  In fact my old Ubuntu PC does use an AMD Radeon video card and driver:
lshw -c video gives following data:
-display                 
       description: VGA compatible controller
       product: Caicos [Radeon HD 6450/7450/8450 / R5 230 OEM]
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 0
       bus info: pci@0000:01:00.0
       version: 00
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=radeon latency=0
       resources: irq:40 memory:e0000000-efffffff memory:fe620000-fe63ffff ioport:e000(size=256) memory:c0000-dffff

With Multi-threading disabled and VDPAU selected it loads ok and there clearly a frame flashing up for a very short time.

What seems odd though is that all the videos that load ok are recorded on the same recorder and transferred on the same HDD. They had Auto - detect threading initially (then custom = 2 after your earlier suggestion) with HW Acceleration turned off.

Also pleased that my discussion with you has proved fruitful. 

Thanks
Title: Re: Error when loading video
Post by: eumagga0x2a on April 01, 2021, 01:07:00 PM
Quote from: yorickk on April 01, 2021, 12:21:06 PMproduct: Caicos [Radeon HD 6450/7450/8450 / R5 230 OEM]

With Multi-threading disabled and VDPAU selected it loads ok and there clearly a frame flashing up for a very short time.

Does H.264 video decoding via VDPAU work on your hardware, i.e. do you get "VDPAU" shown as video decoder (at the left) in Avidemux? Can you use VDPAU as display output?

If you disable VDPAU, does decoding via VA-API work (LibVA shown as video decoder)? If it does, does libva display output work too?

Garbage briefly flashing during video display resizing like when loading a video is aestetically not pleasing but completely harmless.

Quote from: yorickk on April 01, 2021, 12:21:06 PMWhat seems odd though is that all the videos that load ok are recorded on the same recorder and transferred on the same HDD.

The only thing which matters is the internal structure of the video stream as generated by the broadcaster. Unless they corrupt data, the receiver and the medium used for data transfer don't matter.
Title: Re: Error when loading video
Post by: yorickk on April 03, 2021, 03:26:32 AM
In all the tests below I used the smaller head video I provided to you.

Preferences set as follows:
Display = VDPAU, HWAccel = VDPAU, Threading = Disabled
Video Decoder = VDPAU VDPAU(configure greyed out),Video Output = Mpeg4AVC(x264), Audio Output = AC3(lav), Output Format = MP4 Muxer
With these settings the display and editing functions work and Avidemux works to give mp4 output file which plays ok in mpv. Also works with Video Output = HVEC (x265).

Initially I was unable to get Video Decoder = LibVA by just changing the preferences but after closing Avidemux and reloading the video it appeared.

Preferences set as follows:
Display = LIBVA, HWAccel = LIBVA, Threading = Disabled
Video Decoder = LIBVA LibVA (configure greyed out),Video Output = Mpeg4AVC(x264), Audio Output = AC3(lav), Output Format = MP4 Muxer
With these settings the display and editing functions works and Avidemux works to give mp4 output file which plays ok in mpv. Also works with Video Output = HVEC (x265).

Note that for each test I created a separate mp4 output file so I did not overwrite existing files.

You mention VA-API but I do not see it anywhere in the preferences or settings.

One other thing I noted is that the display in Avidemux shows start time as 00:00:00:864 ie it is not zero.
Title: Re: Error when loading video
Post by: eumagga0x2a on April 03, 2021, 06:14:17 PM
Quote from: yorickk on April 03, 2021, 03:26:32 AMVideo Decoder = VDPAU VDPAU
Video Decoder = LIBVA LibVA

This is all I wanted to know (it was about playback / preview, not saving video) regarding viability of Avidemux on AMD graphics hardware, thank you very much.