Jump to content

Can I limit transcoding FPS?


Vitz

Recommended Posts

So this seems to be an issue that was introduced when I upgraded to TrueNAS Core 12.0 and Emby 4.5.4 (either that or somehow I never noticed it before, but that seems unlikely). It appears whenever one of the users on my server watches something that needs to be transcoded, it does so at ~300fps, nearly saturating my CPU in the process. Despite limiting transcoding to use 3 threads, it still seems to be firing on all cylinders instead (i7 4770K with 8 threads). This causes playback issues (especially when multiple users are watching something simultaneously) until the entire video file has been transcoded, upon which CPU usage drops back down to 6-8%.

Is there a way to limit transcoding FPS to, let's say, 70fps? I have no video files that go above 60fps so that sounds like a reasonable limit and it should cut my CPU some slack so there's room for other tasks.

Edited by Vitz
Link to comment
Share on other sites

I think you are looking for the throttle which you can find in the transcoding settings.
Try to activate it and see if it does what you want.

Link to comment
Share on other sites

1 minute ago, neik said:

I think you are looking for the throttle which you can find in the transcoding settings.
Try to activate it and see if it does what you want.

Thank you for your input. Unfortunately, this option was already enabled and it doesn't seem to help in this case.

Link to comment
Share on other sites

On 06/02/2021 at 07:34, Luke said:

Hi there, can we please look at an example? Thanks.

Hi Luke, thank you for your reaction. What kind of example are you looking for, exactly? A screenshot of the admin dashboard whenever transcoding occurs? Perhaps a log from somewhere?

Edited by Vitz
Link to comment
Share on other sites

  • 3 weeks later...

Apologies for the delay. Life intervened.

I have included several logs (censored to mask my server URL) that include the time frame when a user streamed a video that needed to be transcoded and in turn hammered my CPU on all threads by doing so. The transcoding log in particular displays my specific problem as this shows how transcoding is done at nearly x7 speeds, which seems excessive and unnecessary. That's what I'm hoping to solve. If this could be limited to x2, I'd be more than happy.

 

hardware_detection-63749889261.txt ffmpeg-transcode-7e27698f-7e7c-4b16-b2b7-09debd039a53_1.txt embyserver.txt

Link to comment
Share on other sites

Happy2Play

You logs does not show Throttling enabled, your only other option is adjusting Transcoding thread count.

Quote

Transcoding thread count: 

Select the maximum number of threads to use when transcoding. Reducing the thread count will lower cpu usage but may not convert fast enough for a smooth playback experience. Not all encoders and decoders support multi-threading, so this may have an effect in some cases but not others.

But there currently is no way to set a X speed level for transcoding.

Link to comment
Share on other sites

1 minute ago, Happy2Play said:

You logs does not show Throttling enabled, your only other option is adjusting Transcoding thread count.

But there currently is no way to set a X speed level for transcoding.

Hmm, I don't know what to tell you. The throttling option is very much enabled. I disabled and enabled it again just to make sure but I'm pretty certain I've done that before.

Regarding the transcoding thread count, that's probably where the main problem lies. I've adjusted this setting multiple times but it doesn't seem to do anything. Regardless of how many threads I set it to, transcoding will always utilise all eight of them.

Link to comment
Share on other sites

Hi, how did you install Emby Server? This installation is missing our custom ffmpeg build, so that's why you're not getting the throttle feature.

Link to comment
Share on other sites

13 hours ago, Luke said:

Hi, how did you install Emby Server? This installation is missing our custom ffmpeg build, so that's why you're not getting the throttle feature.

Interesting. I'm using the TrueNAS Community plugin (the one called "Emby"; not "Emby Server"). Not something I would go for were I to install it these days but I had zero knowledge of jails and whatnot when I first set up this machine.

Is there a way for me to upgrade ffmpeg to the desired version? Also, along with throttling, would this enable the thread limiter?

Edited by Vitz
Link to comment
Share on other sites

13 hours ago, Luke said:

Hi, how did you install Emby Server? This installation is missing our custom ffmpeg build, so that's why you're not getting the throttle feature.

Looking at the community plugin json, it appears to install the standard ffmpeg pkg after installing the emby-server pkg. The emby-server pkg would install the custom ffmpeg build, but then the plugin installer overwrites it.

https://raw.githubusercontent.com/ix-plugin-hub/iocage-plugin-index/master/emby-server-stable.json

 

I see the same for the Emby NAT plugin as well

https://raw.githubusercontent.com/ix-plugin-hub/iocage-plugin-index/master/emby.json

 

No clue who maintains these, but the only pkg needed should be emby-server since it installs all the dependencies with it.

Link to comment
Share on other sites

4 minutes ago, MRobi said:

Looking at the community plugin json, it appears to install the standard ffmpeg pkg after installing the emby-server pkg. The emby-server pkg would install the custom ffmpeg build, but then the plugin installer overwrites it.

https://raw.githubusercontent.com/ix-plugin-hub/iocage-plugin-index/master/emby-server-stable.json

 

I see the same for the Emby NAT plugin as well

https://raw.githubusercontent.com/ix-plugin-hub/iocage-plugin-index/master/emby.json

 

No clue who maintains these, but the only pkg needed should be emby-server since it installs all the dependencies with it.

Does this mean that even if I were to find out how to upgrade to the custom ffmpeg, any future update to the plugin would simply revert it back?

Link to comment
Share on other sites

2 hours ago, Vitz said:

Does this mean that even if I were to find out how to upgrade to the custom ffmpeg, any future update to the plugin would simply revert it back?

If you're using the plugin to update than I would assume so.

Link to comment
Share on other sites

Just now, MRobi said:

If you're using the plugin to update than I would assume so.

I suppose that wouldn't be that much of a problem if I figure out how to replace this version of ffmpeg with the one I need.

I found Emby's FreeBSD 12 package on Github and it contains the ffmpeg files that would include the functionality I need. Would you happen to know if this is simply a matter of shutting the jail down, replacing said files through shell and powering it back up? I can't really imagine it being that easy but I just don't know.

Link to comment
Share on other sites

1 hour ago, Vitz said:

I suppose that wouldn't be that much of a problem if I figure out how to replace this version of ffmpeg with the one I need.

I found Emby's FreeBSD 12 package on Github and it contains the ffmpeg files that would include the functionality I need. Would you happen to know if this is simply a matter of shutting the jail down, replacing said files through shell and powering it back up? I can't really imagine it being that easy but I just don't know.

from the shell of the jail try

pkg install -f emby-server

this should re-download the emby-server repository and force install it over the one already installed, which should at that point re-install the custom ffmpeg that comes with that pkg.

Link to comment
Share on other sites

26 minutes ago, MRobi said:

from the shell of the jail try

pkg install -f emby-server

this should re-download the emby-server repository and force install it over the one already installed, which should at that point re-install the custom ffmpeg that comes with that pkg.

Thank you for the instructions. This server is heavily in use, though. I assume this wouldn't do anything functionally for others? I suppose I could make a snapshot beforehand and just go for it.

Link to comment
Share on other sites

Baenwort
11 hours ago, MRobi said:

Looking at the community plugin json, it appears to install the standard ffmpeg pkg after installing the emby-server pkg. The emby-server pkg would install the custom ffmpeg build, but then the plugin installer overwrites it.

https://raw.githubusercontent.com/ix-plugin-hub/iocage-plugin-index/master/emby-server-stable.json

 

I see the same for the Emby NAT plugin as well

https://raw.githubusercontent.com/ix-plugin-hub/iocage-plugin-index/master/emby.json

 

No clue who maintains these, but the only pkg needed should be emby-server since it installs all the dependencies with it.

I think I was the last one to touch it but any member of the community can pitch in and help maintain them. Both plug ins are community plugins now that iXsystems has dropped maintaining the Emby plugin. I put all the pkgs that the instructions at: https://emby.media/freebsd-server.html but didn't think about the order.

If no one beats me to it I'll fix the order in the json files.

  • Like 2
Link to comment
Share on other sites

9 hours ago, Baenwort said:

I think I was the last one to touch it but any member of the community can pitch in and help maintain them. Both plug ins are community plugins now that iXsystems has dropped maintaining the Emby plugin. I put all the pkgs that the instructions at: https://emby.media/freebsd-server.html but didn't think about the order.

If no one beats me to it I'll fix the order in the json files.

The only pkg that should be needed is emby-server. If you check it out here on freshports, you can see it installs all of the needed dependencies already. Although it may be helpful to included a newer version of mono than the pkg available, but that would likely complicate things a bit and I've only seen a couple people actually need it.

Now if you were to pull the emby image from their github, then you need to install the dependencies in a list like that because it's not a pre-built package. IE: If you were to build a TrueNAS plugin for "Emby-Beta" (not a terrible idea to do), then you'd do exactly what you've got there but instead of emby-server you'd link to the github build and remove ffmpeg since it's built-in.

Edited by MRobi
Link to comment
Share on other sites

Baenwort
On 2/27/2021 at 7:40 AM, MRobi said:

The only pkg that should be needed is emby-server. If you check it out here on freshports, you can see it installs all of the needed dependencies already. Although it may be helpful to included a newer version of mono than the pkg available, but that would likely complicate things a bit and I've only seen a couple people actually need it.

Now if you were to pull the emby image from their github, then you need to install the dependencies in a list like that because it's not a pre-built package. IE: If you were to build a TrueNAS plugin for "Emby-Beta" (not a terrible idea to do), then you'd do exactly what you've got there but instead of emby-server you'd link to the github build and remove ffmpeg since it's built-in.

I think that could be a good idea to have a stable plugin and a beta plug in.

Are you volunteering to work with iX and convert them? It was enough of a go around for me to get them to keep a non-NAT version of the Emby plug-in that I'm done with them for a couple months.

I also don't want to be come the next Josh4trunks. :D I am strictly a engineer and not a programmer so I  do these kind of maintenance items only reluctantly and after waiting for someone else to step forward first.

Edited by Baenwort
Link to comment
Share on other sites

MRobi
8 hours ago, Baenwort said:

Are you volunteering to work with iX and convert them?

I turned off my TrueNAS system about 6 months ago or so and moved to Proxmox, and when I did use TrueNAS I never once used a plugin so I'm certainly not the guy to maintain the plugin.

Link to comment
Share on other sites

On 26/02/2021 at 22:33, MRobi said:

from the shell of the jail try

pkg install -f emby-server

this should re-download the emby-server repository and force install it over the one already installed, which should at that point re-install the custom ffmpeg that comes with that pkg.

Sadly, this doesn't appear to have worked. The command executed without errors and things were definitely installed, but the original issue persists so I'm guessing ffmpeg wasn't overwritten with Emby's custom one. Is there a way for me to force install just the required version of ffmpeg?

Edit: Could I maybe just follow the steps outlined on the Emby website's Downloads page for FreeBSD and install the latest beta? Or would that be opening a can of worms?

Edited by Vitz
Link to comment
Share on other sites

MRobi
On 10/03/2021 at 07:17, Vitz said:

Sadly, this doesn't appear to have worked. The command executed without errors and things were definitely installed, but the original issue persists so I'm guessing ffmpeg wasn't overwritten with Emby's custom one. Is there a way for me to force install just the required version of ffmpeg?

Edit: Could I maybe just follow the steps outlined on the Emby website's Downloads page for FreeBSD and install the latest beta? Or would that be opening a can of worms?

You could also run

pkg delete -a

This will delete all packages installed in the jail, including the FreeBSD instance you don't want in there. Then run pkg install emby-server

Link to comment
Share on other sites

20 minutes ago, MRobi said:

You could also run

pkg delete -a

This will delete all packages installed in the jail, including the FreeBSD instance you don't want in there. Then run pkg install emby-server

Is this safe in relation to Emby's database? Or would it mean setting everything back up?

Link to comment
Share on other sites

MRobi
22 hours ago, Vitz said:

Is this safe in relation to Emby's database? Or would it mean setting everything back up?

You should always do a snapshot before doing anything inside a jail or a backup of your emby-server settings. 

You could probably get away with just pkg delete ffmpeg and then re-install the emby package. Since it's just ffmpeg causing you the issue.

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