Jump to content

Hardware transcoding using Ryzen APUs


kaledi

Recommended Posts

kaledi

I've done a bit of reading, but can't seem to get a clear answer to the following:

Do the Ryzen APUs (i.e. CPU with built in GPU) offer hardware acceleration for the following scenarios (my assumption is that the target codec is always H264)

HEVC > H264

HEVC HDR > H264 HDR at a lower bit rate and / or resolution

HEVC HDR > H264 SDR at a lower bit rate and / or resolution with tone mapping

Link to comment
Share on other sites

If you don't have this combo and looking to purchase I personally would ignore the Ryzen and go Intel either with built in Quicksync or with a Nvidia GPU added.

These are tried and true environments that just work.

Link to comment
Share on other sites

kaledi

Thanks, and I agree, it is clearer for Intel, however, that isn't an option in this case, for a number of reasons.

I won't bore you with the reasons why, but given the popularity of Ryzen today it would be good to know.

Link to comment
Share on other sites

If you do what Sammy did and add an Nvidia GPU it should work great.

Link to comment
Share on other sites

kaledi

yep, I get that an Nvidia GPU paired with a Ryzen would be great.

Unfortunately, there is no room to fit one in the case 😆, hence my asking.

This would be a 'headless' server (and I see in the set up guids AMD AMF requires connection to a monitor so it won't literally be headless) consuming as minimal power as possible that the latest generation 4xxxxGE and mobile 4xxxxU offer, using a NAS as the media storage.  These processors really are very good.  Indeed, I suspect that they would do software transcoding in real time without much trouble for all but 4K HDR.

Link to comment
Share on other sites

Sammy

Rosewill (Newegg) has some mighty fine cases for well under $100. Sometimes they're a little tight to work in but how often do you do that?

I have this "mini" tower with 13 HDD's in it in addition to the NVMe boot drive.

Link to comment
Share on other sites

kaledi

thanks @SammyI've built many PC over the years so will consider.

Anyhow, back to my question, since I'm interested from a technical persepective and have several Ryzen machines so would like to know.

When I listed a couple of the latest Ryzen CPUs above, it suddenly dawned on me that I have a recent Ryzen laptop and I hadn't even considered I could use it to test out the capabilities, so that is what I will do.  I've installed Emby server on it and will do some testing and report back

 

Link to comment
Share on other sites

Basically to put it kindly for transcoding work you want an Intel or Nvidia GPU.  CPU isn't of much concern if it has a bit of grunt to it. :)

Link to comment
Share on other sites

kaledi

So I've just done a quick dirty test using the following

AMD Ryzen 4500U (6 core / 6 thread processor) running windows 10 and the latest Beta of EMby server

I used a test 4K HDR10+ (original high bit rate file) and 1080p file and played them on my tablet that is HDR capable

Both played fine by direct play with no CPU/GPU utilisation.

I then set the quality and resolution to various settings and with HDR to SDR mapping enabled.

In short I was seeing about 12 to 17 % CPU utilisation at between 1.4 and 2 GHZ (this CPU scales up to 4GHZ when required on one core) and GPU utilisation of between 30 to 60 % depending on the original file.

Seems to me that Emby is utilising hardware transcoding very well on AMD CPU/GPUs.

I'll do some more test later and record more specific numbers and will play on a couple of other devices. 

@cayarsOne question I do have regarding the transcoding of HDR material - in the latest beta you can tone map to SDR, can you re-encode with HDR still intact i.e. if this option is left unselected?

Link to comment
Share on other sites

That's a lot better than I would have thought for HDR.  I guess softworkz has been killing this stuff in ffmpeg more so than I thought. LOL

Could you try playing back that same file forcing transcoding to another device as well so you have two HDR to SDR transcodes going at the same time.  Would love to know the resources used for 2.

To the best of my knowledge you can't transcode video leaving the HDR in tact in Emby.  So if it needs video transcoding it will apply tone-mapping assuming you're setup for this and have it configured.

Link to comment
Share on other sites

kaledi

Yes, good suggestion, I shall do that. 

Regarding hdr transcoding, it should be possible as it can be done offline. That would be a very useful feature. 

At the moment I have 2 versions of hdr movies, one being low bit rate, whxih can be used on a firestick or mobile device when bandwidth is an issue or device can't handle high bit rates. 

Getting to a position where I don't have to have multiple versions would be great as my current work arounds using different user profiles for different devices that expose only certain file versions is a bit clunky and doesn't work well with trakt

Link to comment
Share on other sites

kaledi

Transcoding 2 4k HDR clips to lower bit rate and resolution results in about 25 % CPU utilisation for each FFMPEG thread so total of 50 % utilisation and the processor speed jumps to about 3.6 GHZ.  The GPU utilisation (the video encode section) jumps to 80 to 90 %

Testing it now, I also note that I don't believe that tone mapping is working correctly with this configuration.  The menu for selecting HDR tone mapping suggest other drivers may be required.  What are these?

 

Link to comment
Share on other sites

5 minutes ago, kaledi said:

Transcoding 2 4k HDR clips to lower bit rate and resolution results in about 25 % CPU utilisation for each FFMPEG thread so total of 50 % utilisation and the processor speed jumps to about 3.6 GHZ.  The GPU utilisation (the video encode section) jumps to 80 to 90 %

Testing it now, I also note that I don't believe that tone mapping is working correctly with this configuration.  The menu for selecting HDR tone mapping suggest other drivers may be required.  What are these?

 

https://support.emby.media/support/solutions/articles/44001160148-hardware-acceleration-overview

Link to comment
Share on other sites

The problem with AMD doesn't start with tone mapping. It's rather that elementary things are missing. You can start reading here:

To summarize what's missing from AMD in ffmpeg:

  • AMD HW Context
  • AMD Decoder Implementations
  • HW Video Processing Filters 

Unfortunately, it still doesn't seem to be a high priority for them: https://github.com/GPUOpen-LibrariesAndSDKs/AMF/issues/199

As long as they don't provide the same capabilities through ffmpeg like Intel and Nvidia, we can only provide partial support  (like we're doing already), but that excludes things like hw scaling, hw deinterlacing, hw color conversion, hw overlay and hw tone mapping - which means in most cases: no hw-only video processing. 

Link to comment
Share on other sites

Just to demonstrate how Intel compares to AMD in that matter. Here's the current list of Intel's pending contributions to ffmpeg:

 https://github.com/intel-media-ci/cartwheel-ffmpeg/tree/master/patches
(hundreds of commits already made in the past, more than 10 developers working on contributing to ffmpeg)

I'm not directly an Intel fan and had many AMD setups as well. But for hw video acceleration, AMD is not a good choice at this time and Intel's dedication to that area really deserves to be acknowledged!

Edited by softworkz
  • Like 2
  • Agree 2
Link to comment
Share on other sites

  • 1 year later...
aaronb44

I found this site for setting -- FFMPEG 

https://sick.codes/linux-mac-ffmpeg-render-convert-or-export-video-using-amd-gpu-graphics-card-in-arch-linux-mint-debian-manjaro/

Worked perfect on my laptop. – Amd 4500U

Before speed=1.5
After speed-2.4

I didn’t think a moble APU had the funtion to do this. The  CPU runs much cooler

Here is the scrip it offered

Quote

# init device
ffmpeg -init_hw_device vaapi=gpu:/dev/dri/renderD128
IN_VIDEO=NOVA.ts
OUT_VIDEO=NOVA.mp4
ffmpeg -i "$IN_VIDEO" -vaapi_device /dev/dri/renderD128 -vcodec h264_vaapi -vf format='nv12|vaapi,hwupload' "$OUT_VIDEO"

 

Link to comment
Share on other sites

Yes, that is using the Mesa VAAPI driver which in turn uses the UVD (Unified Video Decoder) and VCE (Video Coding Engine) hardware found in recent AMD graphics cards and APUs.

Decoding is limited to H.264, MPEG-2, MPEG-4 part 2 and VC-1 since Southern Islands with H.265 support added in Volcanic Islands and H.265 10-bit in Arctic Islands.

MPEG-4 part 2 is only partially working and disabled by default. H.264 encode is working, but is still incomplete. No other codecs are supported by Mesa for encoding. No support for encoding interlaced content, etc See the limitations @softworkz mentioned above.

21 hours ago, aaronb44 said:

Before speed=1.5
After speed-2.4

What are the speeds in reference to? Is that real-time speed?

Link to comment
Share on other sites

On 1/31/2023 at 7:21 PM, aaronb44 said:

I found this site for setting -- FFMPEG 

https://sick.codes/linux-mac-ffmpeg-render-convert-or-export-video-using-amd-gpu-graphics-card-in-arch-linux-mint-debian-manjaro/

Worked perfect on my laptop. – Amd 4500U

Before speed=1.5
After speed-2.4

I didn’t think a moble APU had the funtion to do this. The  CPU runs much cooler

Basically, this should work with Emby on Linux. I hadn't seen any log for this for quite a while but we verified such setup to be working just a few days ago (latest beta).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...