Skip to main content
Topic: VLC hardware mpg decoding (Read 865 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

VLC hardware mpg decoding

I get errors for a specific mpg recording on intel hardware for one specific mpg I see

Code: [Select]
VLC media player 3.0.21 Vetinari (revision 3.0.21-0-gdd8bfdbabe8)
[0000575c41ab2520] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000072919cc0a580] avcodec decoder: Using Intel iHD driver for Intel(R) Gen Graphics - 24.2.5 () for hardware decoding
[mpeg2video @ 0x729198007940] Failed to upload decode parameters: 18 (invalid parameter).
[mpeg2video @ 0x729198007940] Failed to end picture decode after error: 18 (invalid parameter).
[mpeg2video @ 0x729198007940] hardware accelerator failed to decode first field
[mpeg2video @ 0x729198007940] Failed to upload decode parameters: 18 (invalid parameter).
[mpeg2video @ 0x729198007940] Failed to end picture decode after error: 18 (invalid parameter

the video does not show, sound is fine. The recording plays fine if I turn off hardware decoding.

I assume I need some extra plugin or library installed. Other recordings give a similar error, but video does show..

On an amd machine I see this error message even though hardware decoding is disabled. The video output is set as any.

Code: [Select]
Failed to open VDPAU backend libvdpau_radeonsi.so: cannot open shared object file: No such file or directory

is there such a library and if so which package contains it?


Re: VLC hardware mpg decoding

Reply #1
I would try "mpv --hwdec=auto …" to compare.

With vlc I had often Problems with hwdec, so I don't use it anymore.


Re: VLC hardware mpg decoding

Reply #3
mpv does not enable hardware decoding for mpeg2video by default. You'd have to specify mpeg2video in --hwdec-codecs. Personally, I would recommend not bothering. There very little chance that your machine has problems software decoding such a video unless it's really old. Nobody has done measurements as far as I know, but it's doubtful you would meaningfully save any power even if your GPU/drivers have a working mpeg2video decoder.

As for the vdpau error, there's a mesa-vdpau package that provides vdpau for mesa drivers so that should work in theory. I would recommend not using it though and sticking to vaapi given that's a more actively supported hwdec backend. vdpau is kind of legacy.

Re: VLC hardware mpg decoding

Reply #4
I tried

mpv --hwdec=vaapi --hwdec-codecs=mpeg2video

on the VLC problem mpg and it works and claims to have vaapi acceleration, but setting va-api in the VLC hardware decoding doesn't fix the decoding errors and no video is seen. The problem mpg is only seen with vlc when I disable hardware decoding.



Re: VLC hardware mpg decoding

Reply #6
I don't see a great difference. Both mpgs were made using commands like this

dvbv5-zap -a 0 -c ~/.tzap/channels.dvbv5 -r "channelname" &
dd if=/dev/dvb/adapter0/dvr0 oflag=append of=good.mpg conv=noerror,notrunc &

ie set up the tuning with dvbv5-zap and then dd the raw dvr device into a file for a fixed time.

Good case ie video shows in VLC
Code: [Select]
$ ffprobe -v warning Videos/good.mpg 
[mpeg2video @ 0x63cb5c6eea40] Invalid frame dimensions 0x0.
    Last message repeated 31 times
[mpegts @ 0x63cb5c6c47c0] start time for stream 2 is not set in estimate_timings_from_pts
[mpegts @ 0x63cb5c6c47c0] start time for stream 3 is not set in estimate_timings_from_pts
[mpegts @ 0x63cb5c6c47c0] start time for stream 4 is not set in estimate_timings_from_pts
[mpegts @ 0x63cb5c6c47c0] PES packet size mismatch
[mpegts @ 0x63cb5c6c47c0] Packet corrupt (stream = 0, dts = 6882731104).
[mpegts @ 0x63cb5c6c47c0] PES packet size mismatch
[mpegts @ 0x63cb5c6c47c0] Packet corrupt (stream = 1, dts = 6882655054).
[mpegts @ 0x63cb5c6c47c0] stream 2 : no TS found at start of file, duration not set
[mpegts @ 0x63cb5c6c47c0] Could not find codec parameters for stream 2 (Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels): unspecified frame size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x63cb5c6c47c0] Could not find codec parameters for stream 5 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x63cb5c6c47c0] Could not find codec parameters for stream 6 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Unsupported codec with id 98305 for input stream 4
Unsupported codec with id 0 for input stream 5
Unsupported codec with id 0 for input stream 6

bad case no video shows
Code: [Select]
$ ffprobe -v warning Videos/bad.mpg 
[mpeg2video @ 0x62500c96c040] Invalid frame dimensions 0x0.
    Last message repeated 6 times
[mp3float @ 0x62500c98b680] Header missing
[mpeg2video @ 0x62500c96c040] Invalid frame dimensions 0x0.
    Last message repeated 23 times
[mpegts @ 0x62500c964840] PES packet size mismatch
[mpegts @ 0x62500c964840] Packet corrupt (stream = 0, dts = 4000499184).
[mpegts @ 0x62500c964840] PES packet size mismatch
[mpegts @ 0x62500c964840] Packet corrupt (stream = 1, dts = 4000434654).
[mpegts @ 0x62500c964840] Could not find codec parameters for stream 2 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x62500c964840] Could not find codec parameters for stream 3 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3

Re: VLC hardware mpg decoding

Reply #7
Maybe there's the case of broken stream. Some hardware decoders are sensitive to such breaks when software decoders just skip them. Sometimes you can repair stream without transcoding by putting it into another container like

Code: [Select]
ffmpeg -i bad.mpg -c copy repaired.mkv

but often that doesn't help and you need to fully transcode.

Re: VLC hardware mpg decoding

Reply #8
Maybe the "Header missing" of the bad.mpg is the Problem. The others shouldn't be critical, as far a I know.

I dont know dvbv5-zap. - I record DVB-S(2) with Xoro Satreceivers (8500 and 8590) and open + cut (+ ususual recode + DeLogo) them with Avidemux.

Re: VLC hardware mpg decoding

Reply #9
Maybe the "Header missing" of the bad.mpg is the Problem. The others shouldn't be critical, as far a I know.

I dont know dvbv5-zap. - I record DVB-S(2) with Xoro Satreceivers (8500 and 8590) and open + cut (+ ususual recode + DeLogo) them with Avidemux.
the missing header might be the issue, it's almost guaranteed that the streams are imperfect given they come over the air.

dvbv5-zap is zap for version 5 of the DVB API &  is part of v4l-utils

Re: VLC hardware mpg decoding

Reply #10
Code: [Select]
ffmpeg -i bad.mpg -c copy repaired.mkv
That's a good idea.

I found (the ffmpeg-Manpage is terrible!) this, what could repair more  and I think it is better to keep .mpg:
Code: [Select]
ffmpeg -hide_banner -nostats -ignore_unknown -fflags +discardcorrupt -i bad.mpg -c copy repaired.mpg

the missing header might be the issue, it's almost guaranteed that the streams are imperfect given they come over the air.
I know: s. Attachment - At Sunday there was no Sun…  ;)

Quote
dvbv5-zap is zap for version 5 of the DVB API &  is part of v4l-utils
2008 I used Fedora 8+9 (may first Try with Linux) and had a Technisat Skystar 2. - For recording I used Kaffeine.

Re: VLC hardware mpg decoding

Reply #11
I tried yesterday with mpeg2-hwdec *), but for me it's no Option, because (@ least on my Radeon RX 560D) the Deinterlace is ugly (s. A. - SD on FullHD-Display) and works bad (with "," and "." you can control it Picture by Picture).

*) because of the low CPU-usage I didn't care until now: mpeg2 is simple and only SD

This is my "~/.config/mpv/mpv.conf":
Code: [Select]
hwdec   #=auto-copy
#hwdec-codecs=all
#vo=gpu-next
deinterlace=auto
scale=spline36
interpolation
tscale=oversample
video-sync=display-resample-vdrop
osd-duration=2000
idle=once
autofit-larger=90%x90%
audio-channels=auto

I needed "=auto-copy" a few month ago, because a new mesa made Trouble - just "hwdec" is "auto"
"hwdec-codecs=all" if I want to test it again
"vo=gpu-next" it had disadvantages, but maybe someday it's better
"scale=spline36" good as lanczos, but lower CPU-usage
"interpolation", "tscale" and "video-sync" for smoother view (i. e. 25 fps on 60 Hz Display)

For more Info: "man mpv"

Re: VLC hardware mpg decoding

Reply #12
What you're trying to do doesn't make much sense, interpolation is a big resource hog, and hardware decoding is usually recommended to be left off especially on <1080p60 video, it's not just the pixelation you see (probably buggy hw scaler somewhere before the player's e.g. pixel aspect ratio, or the deinterlacer is wrong), but also the fact that the reproduced image won't look it's best with hw decoding, for instance with color mastering sw decoding is forced.

What you've traded for disabled hwdec and interpolation in gpu load you can supplant with cscale and a discrete denoise/upscale shader, and get a way better picture for the same load.

Re: VLC hardware mpg decoding

Reply #13
What you're trying to do doesn't make much sense, interpolation is a big resource hog,
The Sense is, that I want to see it as good as possible.
Quote
and hardware decoding is usually recommended to be left off especially on <1080p60 video, it's not just the pixelation you see (probably buggy hw scaler somewhere before the player's e.g. pixel aspect ratio, or the deinterlacer is wrong), but also the fact that the reproduced image won't look it's best with hw decoding, for instance with color mastering sw decoding is forced.
No, it's definitely the DI: On Progressive there is nearly no Difference between hwdec and swdec (s. A.) Again SD on FullHD with my above Settings: On the Ear there is a slightly Disadvantage for hwdec.

Quote
What you've traded for disabled hwdec and interpolation in gpu load you can supplant with cscale and a discrete denoise/upscale shader, and get a way better picture for the same load.
How?

 

Re: VLC hardware mpg decoding

Reply #14
Now i see that you have a RX560D as a graphics card.
That means you can employ a few light shaders.

cscale=spline64 (or use lite chroma shader from https://github.com/Artoriuz/glsl-chroma-from-luma-prediction)
scale=ewa_lanczos instead of spline36
then
either lite denoise shader (https://github.com/AN3223/dotfiles/blob/master/.config/mpv/shaders/LQ/nlmeans_sharpen_denoise.glsl, see if the temporal one works for you with vo=gpu-next, will play nicer with deinterlaced stuff https://github.com/AN3223/dotfiles/blob/master/.config/mpv/shaders/LQ/nlmeans_temporal_sharpen_denoise.glsl)

or an upscale shader like ArtCNN or FSRCNNX (if your gpu can handle it, search for them they are easy to find)