FranceBB
7th May 2021, 14:44
Hi there,
in MPV tonemapping is applied using Hable, Mobius or Reinhard on a scene by scene basis by using the HDR Compute Peak, the HDR Peak Decay Rate and the HDR Scene Threshold.
Those three parameters are what are really doing the trick to the very good SDR representation of MPV:
--hdr-compute-peak=<auto|yes|no>
Compute the HDR peak and frame average brightness per-frame instead of relying on tagged metadata. These values are averaged over local regions as well as over several frames to prevent the value from jittering around too much. This option basically gives you dynamic, per-scene tone mapping.
--hdr-peak-decay-rate=<1.0..1000.0>
The decay rate used for the HDR peak detection algorithm (default: 100.0). This is only relevant when --hdr-compute-peak is enabled. Higher values make the peak decay more slowly, leading to more stable values at the cost of more "eye adaptation"-like effects (although this is mitigated somewhat by --hdr-scene-threshold). A value of 1.0 (the lowest possible) disables all averaging, meaning each frame's value is used directly as measured, but doing this is not recommended for "noisy" sources since it may lead to excessive flicker. (In signal theory terms, this controls the time constant "tau" of an IIR low pass filter)
--hdr-scene-threshold-low=<0.0..100.0>, --hdr-scene-threshold-high=<0.0..100.0>
The lower and upper thresholds (in dB) for a brightness difference to be considered a scene change (default: 5.5 low, 10.0 high). This is only relevant when --hdr-compute-peak is enabled. Normally, small fluctuations in the frame brightness are compensated for by the peak averaging mechanism, but for large jumps in the brightness this can result in the frame remaining too bright or too dark for up to several seconds, depending on the value of --hdr-peak-decay-rate.
I know that tonemapping is something we've been talking about a LOT in the last... well... 5 years (or more) and that there are different open source tonemapping implementation both in FFMpeg and in Avisynth like HDRTools and DGTonemap and I've been using HDRTools inside Avisynth for quite some time (heck, I was even one of the few lucky people to constantly get non-public betas from Jean Philippe when we were sharing contents back in the days), but I'd like to ask to some FFMpeg guys, a thing.
You see, I generally do things in Avisynth but this time round I need to put something together in FFMpeg.
I know that in FFMpeg there's a way to perform tonemapping with zscale and this thing has been discussed on Doom9 over and over and over again (https://forum.doom9.org/showthread.php?t=175125) BUT what I'd like to ask you is: is this thing static or is there a way to tweak it to make it act on a scene by scene basis like in MPV? And is there a way to set how many frames have to be used for the scene-by-scene detection and a threshold to tweak how much change there has to be for a "scene change" to be considered as such?
In other words, can a dynamic scene by scene tonemapping be done in FFMpeg?
Yes, all of this in FFMpeg, which, again, is not my territory as you all know that I'm an Avisynth guy and I use it only as a muxer and encoder for MPEG-2.
Thank you in advance,
Frank
in MPV tonemapping is applied using Hable, Mobius or Reinhard on a scene by scene basis by using the HDR Compute Peak, the HDR Peak Decay Rate and the HDR Scene Threshold.
Those three parameters are what are really doing the trick to the very good SDR representation of MPV:
--hdr-compute-peak=<auto|yes|no>
Compute the HDR peak and frame average brightness per-frame instead of relying on tagged metadata. These values are averaged over local regions as well as over several frames to prevent the value from jittering around too much. This option basically gives you dynamic, per-scene tone mapping.
--hdr-peak-decay-rate=<1.0..1000.0>
The decay rate used for the HDR peak detection algorithm (default: 100.0). This is only relevant when --hdr-compute-peak is enabled. Higher values make the peak decay more slowly, leading to more stable values at the cost of more "eye adaptation"-like effects (although this is mitigated somewhat by --hdr-scene-threshold). A value of 1.0 (the lowest possible) disables all averaging, meaning each frame's value is used directly as measured, but doing this is not recommended for "noisy" sources since it may lead to excessive flicker. (In signal theory terms, this controls the time constant "tau" of an IIR low pass filter)
--hdr-scene-threshold-low=<0.0..100.0>, --hdr-scene-threshold-high=<0.0..100.0>
The lower and upper thresholds (in dB) for a brightness difference to be considered a scene change (default: 5.5 low, 10.0 high). This is only relevant when --hdr-compute-peak is enabled. Normally, small fluctuations in the frame brightness are compensated for by the peak averaging mechanism, but for large jumps in the brightness this can result in the frame remaining too bright or too dark for up to several seconds, depending on the value of --hdr-peak-decay-rate.
I know that tonemapping is something we've been talking about a LOT in the last... well... 5 years (or more) and that there are different open source tonemapping implementation both in FFMpeg and in Avisynth like HDRTools and DGTonemap and I've been using HDRTools inside Avisynth for quite some time (heck, I was even one of the few lucky people to constantly get non-public betas from Jean Philippe when we were sharing contents back in the days), but I'd like to ask to some FFMpeg guys, a thing.
You see, I generally do things in Avisynth but this time round I need to put something together in FFMpeg.
I know that in FFMpeg there's a way to perform tonemapping with zscale and this thing has been discussed on Doom9 over and over and over again (https://forum.doom9.org/showthread.php?t=175125) BUT what I'd like to ask you is: is this thing static or is there a way to tweak it to make it act on a scene by scene basis like in MPV? And is there a way to set how many frames have to be used for the scene-by-scene detection and a threshold to tweak how much change there has to be for a "scene change" to be considered as such?
In other words, can a dynamic scene by scene tonemapping be done in FFMpeg?
Yes, all of this in FFMpeg, which, again, is not my territory as you all know that I'm an Avisynth guy and I use it only as a muxer and encoder for MPEG-2.
Thank you in advance,
Frank