gallileo 1 Posted November 14, 2018 Share Posted November 14, 2018 Hi there, I have played around a bit with HDR tonemapping filters for ffmpeg. I was wondering if you would accept a PR that adds a tonemapping filter to the MediaEncoding part of Emby? (As an alpha option of course) Or would you accept a PR / help with creating one, that allows plugins to change the ffmpeg parameters / add filters? Kind regards, Leo Link to comment Share on other sites More sharing options...
Luke 36999 Posted November 14, 2018 Share Posted November 14, 2018 Hi, this part of emby is not open source but can you give some examples of what you'd like to do? Thanks ! Link to comment Share on other sites More sharing options...
gallileo 1 Posted November 19, 2018 Author Share Posted November 19, 2018 Well as far as I can see, the part that generates the command line options for ffmpeg seems to be opensource here: https://github.com/MediaBrowser/Emby.Common/blob/master/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs? I would like to add something like this as a filter (see the tonemap_opencl part): ffmpeg -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device \opencl=ocl@va -hwaccel vaapi -hwaccel_device va -hwaccel_output_format \vaapi -i INPUT -filter_hw_device ocl -filter_complex \'[0:v]hwmap,tonemap_opencl=t=bt2020:tonemap=linear:format=p010[x1]; \[x1]hwmap=derive_device=vaapi:reverse=1' -c:v hevc_vaapi -profile 2 OUTPUTThis was taken from here: https://gist.github.com/Brainiarc7/4f831867f8e55d35cbcb527e15f9f116 From my testing this allows a hardware transcode at almost 2x speeds for full 4K blurays. And I am currently looking into speeding this up even more. Ideally, (depends on how the options are integrated) one could even specify a different tonemapping filter (e.g. replace linear with hable, clip, etc.). For the plugins, ideally, one could either override IMediaEncoding or EncodingHelper. This way, a plugin can specify custom parameters for ffmpeg, but this would probably need some more revamping. Link to comment Share on other sites More sharing options...
Luke 36999 Posted November 19, 2018 Share Posted November 19, 2018 How do we detect when this should be applied? Link to comment Share on other sites More sharing options...
Guest asrequested Posted November 20, 2018 Share Posted November 20, 2018 And what if hardware acceleration wasn't being used? Link to comment Share on other sites More sharing options...
gallileo 1 Posted November 20, 2018 Author Share Posted November 20, 2018 @ I haven‘t yet looked at this in depth. I would imagine that we could use opencl anyways (just on the cpu), but I don‘t know. @@Luke I would have an option to enable it. Then I would check that, as well as the color info from the media info that is already scanned into Emby (i.e. does it say bt2020). Link to comment Share on other sites More sharing options...
Luke 36999 Posted November 20, 2018 Share Posted November 20, 2018 There is a performance impact to this, right? Link to comment Share on other sites More sharing options...
gallileo 1 Posted November 21, 2018 Author Share Posted November 21, 2018 (edited) @@Luke Depends. When using hardware transcoding, there does not seem to be any performance impact, since the limit is hardware transcoding itself. However, I haven‘t tried a lot with hardware transcoding on different gpus or a cpu. I suspect it would not impact it that much though. If software decoding is used, I have no idea. If the tonemapping is done without opencl, I only get around 3-4 fps. However, even with software decoding, the opencl filter should be usable. But I do not know whether the software or opencl filter will be limiting there. Edited November 26, 2018 by gallileo 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now