Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What are my options with VCN VAAPI transcoding?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
jpsollie
Apprentice
Apprentice


Joined: 17 Aug 2013
Posts: 291

PostPosted: Mon Aug 07, 2023 2:25 pm    Post subject: What are my options with VCN VAAPI transcoding? Reply with quote

So, small intro:
- I got lots of ntsc mpeg2 files > 4gb which should be archived. Archived in a way it fits on a fat32 filesystem
Streaming is not a thing.
- electricity is expensive
- I use AMD for my dedicated GPU (navi23)rather thans nvidia because the non-proprietary drivers are better and it supports both vdpau and vaapi.

So, what are my options here for archiving?

- I heard the h.264 encoder on AMD sucks. That leaves only h.265 as a possibility.
- I'd like to investigate the quality loss after archiving. Simply to check. I saw ffmpeg has a PSNR filter to compare both streams, but what do those numbers say?
- is there *ANY* reason I should prefer AMF over VAAPI?
- are general options like 'compress' in ffmpeg encoder options implemented on hevc_VAAPI? Or simply ignored?
_________________
The power of Gentoo optimization (not overclocked): [img]https://www.passmark.com/baselines/V10/images/503714802842.png[/img]
Back to top
View user's profile Send private message
wippie
n00b
n00b


Joined: 27 Apr 2004
Posts: 62

PostPosted: Tue Aug 08, 2023 9:57 pm    Post subject: Reply with quote

AMD hardware encoder for both h.264 and h.265 aren't awesome. They are intendent for streaming, hence they are fast rather than high quality. The same goes for nvidia tho. They can still be useful of course.

First of all, verify your VAAPI works. You can use vainfo in the media-video/libvia-utils package for this. You should see some VAEntrypointEncSlice entries in its output.

Second, you can use ffmpeg to transcode the video, using the hardware encoder. E.g for h.265 to mkv container:
Code:
ffmpeg -i "<input video file>" -vaapi_device /dev/dri/renderD128 -vf format=nv12,hwupload -c:v hevc_vaapi -qp 25 -c:a copy -c:s copy -map 0:a? -map 0:s? -map 0:v "<output video file.mkv>"

Adjust parameters as you see fit your needs.
Back to top
View user's profile Send private message
jpsollie
Apprentice
Apprentice


Joined: 17 Aug 2013
Posts: 291

PostPosted: Wed Aug 09, 2023 4:22 am    Post subject: Reply with quote

wippie wrote:
AMD hardware encoder for both h.264 and h.265 aren't awesome. They are intendent for streaming, hence they are fast rather than high quality. The same goes for nvidia tho. They can still be useful of course.

First of all, verify your VAAPI works. You can use vainfo in the media-video/libvia-utils package for this. You should see some VAEntrypointEncSlice entries in its output.

Second, you can use ffmpeg to transcode the video, using the hardware encoder. E.g for h.265 to mkv container:
Code:
ffmpeg -i "<input video file>" -vaapi_device /dev/dri/renderD128 -vf format=nv12,hwupload -c:v hevc_vaapi -qp 25 -c:a copy -c:s copy -map 0:a? -map 0:s? -map 0:v "<output video file.mkv>"

Adjust parameters as you see fit your needs.


Yes, I knew that, thanks :)
however VCN 3.0 seems to have improved its hevc encoder up to a level where I think it's pretty useful. I even decode it in hardware:
Code:

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i title_t00.mkv -map 0:v -map 0:a:0 -map 0:s -c:v hevc_vaapi -rc_mode:v 1 -qp 22 -compression_level:v 7 -c:a libfdk_aac -ac:a 2 -vbr:a 3 -disposition:a:0 default -c:s copy compressed.mkv

but honestly, I do not have a clue what those parameters mean:
- I know qp defines image quality, and I know a higher value defines a lower quality, but how high should it be set for old DVDs?
- I know compress is a ffmpeg variable that can be used in every encoder, but does vaapi actually use it?
- I know ffmpeg's PSNR filter has some ideas of calculating the difference between the reference and encoded stream, but it gives a number from 0 to 60. What numbers should be acceptable?

*EDIT*:
I based myself on this article: https://www.techpowerup.com/293494/gpu-hardware-encoders-benchmarked-on-amd-rdna2-and-nvidia-turing-architectures
so yes, amd's encoder is the worst, but as long as I'm not too constrained on bitrate (which isn't that much of a problem), the electric costs of decoding / encoding in software will probably more of a concern ;)
_________________
The power of Gentoo optimization (not overclocked): [img]https://www.passmark.com/baselines/V10/images/503714802842.png[/img]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum