Jump to content

Audio transcoding hammering my CPU. Video is on the GPU.


Recommended Posts

matticas
Posted

Hi there;

I have recently allowed 3 friends to use my Emby.  (milestone?! 😆 ).  One of the users is using Safari and I think Emby on a Amazone Firestick thing.  When he watches almost anything, the audio transcoding is hammering my CPU usage.

Is there anyway to reduce this, or can audio transcoding be offloaded onto the GPU?

 

Setup;

Ubuntu 24.04, Docker, NPM, Emby.  Nvidia GPU.

Docker;
 

...
runtime: nvidia
...
enviroment:
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=all
...
devices:
      - /dev/dri:/dev/dri
...

 

Emby Settings;

All preferred Hardware Decoders selected / checked;  MPEG-2, VC-1, H.264 (AVC), H.265(HEVC), VP8, VP9.

All preferred Hardware Encoders selected / checked; H.264(AVC), H.265(HEVC)

Software Encoders - default settings.

Every other setting in advanced checked.

 

 

Observation during playback (Emby Settings Activity Dashboard)

Stream MKV (71mbps) -> HLS (22mbps) Reducing bitrate due to quaility setting

Video 4K Dolby Vision HEVC -> Transcode (H264 22mbps) *hardware icon*,  -> Tone Mapping (Hable)

Audio English TRUEHD 7.1 (Default) -> Transcode (AC3 384 kbps)

Observation during playback (ubuntu top CLI process monitor);

ffmpeg /bin/ffmpeg CPU 556%

 

That high CPU load literally heats up my machine and slows everything down.

Viewing on nearly any other device doesn't have this issue.  Only my mate on his devices.

 

Anyway to reduce audio transcoding or force it onto his end?

Thanks

 

 

 

pwhodges
Posted

Why do you think it's the audio - that's a low load compared with video.

There has recently been an issue with Tone Mapping being done in software instead of hardware on some systems - could this be your problem?

Paul

matticas
Posted

Hi Paul;

I assumed audio because the emby dashboard indicated the video transcode was done by hardware, and I thought ffmpeg was audio only?

I will attempt to disable tone mapping and see the effects, however the emby tone mapping page states it's on the Nvidia CUDA?  

GrimReaper
Posted
6 hours ago, matticas said:

Observation during playback (Emby Settings Activity Dashboard)

Stream MKV (71mbps) -> HLS (22mbps) Reducing bitrate due to quaility setting

Video 4K Dolby Vision HEVC -> Transcode (H264 22mbps) *hardware icon*,  -> Tone Mapping (Hable)

Audio English TRUEHD 7.1 (Default) -> Transcode (AC3 384 kbps)

Post ffmpeg log for that session.

 

pwhodges
Posted
3 hours ago, matticas said:

I will attempt to disable tone mapping and see the effects, however the emby tone mapping page states it's on the Nvidia CUDA?  

The issue there has been was that the HW wasn't being used when expected.  If you have the diagnostics plugin, look at the user session to see what's actually happening.

Audio transcoding has no HW support as it's really trivial compared with video - just don't think about it (as a load).

Paul

matticas
Posted

Here is the log files for the same user playing that same movie.  CPU use was quite high, even got the fans excited.

Thanks for looking at these, I can't understand anything in them.  What are you looking for specifically?

I also looked for the diagnostics plugin, but can't see it in the plugin page list.  Do I need to manually install it? 

ffmpeg-transcode-6395477b-5775-47ac-951c-28b737485171_1.txt embyserver (1).txt ffmpeg-transcode-e94201b4-70e3-4840-98a6-758062a481e6_1.txt

GrimReaper
Posted (edited)
13 minutes ago, matticas said:

Thanks for looking at these, I can't understand anything in them.  What are you looking for specifically?

Pipeline.

Your CPU is struggling as decoding is done in software since it surpasses your GPU capabilities:

Quote

>>>>>>  FindVideoDecoder - MediaType: hevc, UseHardwareCodecs: True, HWA-Mode: Advanced
Info    Checking: 'NVDEC NVIDIA GeForce GTX 960 - H.265 (HEVC)'
NoMatch Bitrate (68 Mbit/s) exceeds maximum supported rate (59 Mbit/s)
Info    Decoder does not match
Info    Checking: 'CUVID NVIDIA GeForce GTX 960 - H.265 (HEVC)'
NoMatch Bitrate (68 Mbit/s) exceeds maximum supported rate (59 Mbit/s)
Info    Decoder does not match
Info    Checking: 'Automatic software decoder'
Info    Check successful - selecting 'Automatic software decoder'
Info    Tone Mapping would be desired, but the algorithm is set to 'None'

Encoding is being hardware acelerated:

Quote

>>>>>>  FindVideoEncoder - MediaType: h264, UseHardwareCodecs: True, HWA-Mode: Advanced
Info    Checking: 'NVENC NVIDIA GeForce GTX 960 - H.264 (AVC)'
Info    Check successful - selecting 'NVENC NVIDIA GeForce GTX 960 - H.264 (AVC)'

Resulting in SW+HW (decoding+encoding) combo plan :

Quote

>>>>>>  Processing Plan
        Name                                        CanDoInHW  WillDoInHW  Reason                                                 
        Automatic software decoder               >> False      False       Software Codec                                          
        VideoInput                               >> False      False       Not a hardware decoder                                  
        Scaling                                  >> True       True                                                                
        ToneMapping (when possible)              >> True       True                                                                
        VideoOutput                              >> True       True        Hardware encoder                                        
        NVENC NVIDIA GeForce GTX 960 - H.264 ... >> True       True        Hardware Codec 

Which in turn results in transcoding speeds 0.551x to 0.946x - in other words, your system doesn't have enough muscle to carry such process.

Quote

22:17:15.699 elapsed=00:00:01.96 frame=   25 fps= 13 q=20.0 q=-1.0 q=-1.0 q=-1.0 q=-1.0 size=N/A time=00:00:01.08 bitrate=N/A throttle=off speed=0.551x 

...

22:24:01.864 elapsed=00:06:48.09 frame= 9257 fps= 23 q=20.0 q=-1.0 q=-1.0 q=-1.0 q=-1.0 size=N/A time=00:06:26.13 bitrate=N/A throttle=off speed=0.946x

You should either disable 4K/high bitrate files transcoding altogether or upgrade your hardware.

Edited by GrimReaper
matticas
Posted

Hi GrimReaper, 

Thanks for this detailed response!

I should confess, this server cost me two jars of honey (I have bee hives) and the previous owner rolled it from our previous place of employ - it's an old dell T3600.

The end user hasn't complained about any playback qualities - or at least hasn't told me.  That transcode speeds been below 1.0 would mean eventually their end would pause and buffer?

To disable 4k transcode - is that the bottom option on the transcode page?  "Max transcoding resolution" -> drop down box, select below 4k, i.e. 1080p?

Thanks a million

 

GrimReaper
Posted
5 minutes ago, matticas said:

That transcode speeds been below 1.0 would mean eventually their end would pause and buffer?

Actually they should've already encountered it. 

6 minutes ago, matticas said:

To disable 4k transcode - is that the bottom option on the transcode page?  "Max transcoding resolution" -> drop down box, select below 4k, i.e. 1080p?

Yes. 

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...