user27889: for a noprofit project I do shoot with (up to 5x) Canon HF100 camera(s) but, as stated in this interesting artile, it genetates a "custom RGB range" (16-255) files.
Thanks to this cool repository I've generated this GIF of 10s of source video:
http://www.forart.it/_priv/cultura/HF100_measurement.gif (33 Mb, so can't post. Click to watch)
It graphically shows how recorded video exceed the broadcast range.
The question is: how to "shift down" everything (and constrain inside broadcast range, of course) in order to preserve the maximum possible color quality ?
(note: someone already suggested me to use " Levels(0, 16, 255, 16, 235, coring=false) " in AviSynth but, if possible, I want to do it only with FFMPEG)
Thanks in advance to anyone that can/will help.
Marco

user1871: You can use the geq filter to remap the pixel value ranges.
ffmpeg
 -i input
 -vf "geq=lum='(p(X,Y)-16)/(255-16)*(235-16)+16':cb='(p(X,Y)-16)/(255-16)*(240-16)+16'"
 -c:v libx264 -c:a copy out.mp4

The geq filter rescales the input luma from 16-255 to 16-235, and both the input chroma from 16-255 to 16-240, which is  the legal range for broadcast 8-bit signals.

27889: <p>for a noprofit project I do shoot with (up to 5x) Canon HF100 camera(s) but, as stated in <a href="http://nerdfever.com/video-editing-for-scientific-analysis/" rel="nofollow noreferrer">this interesting artile</a>, it genetates a "custom RGB range" (16-255) files.</p>

<p>Thanks to <a href="https://github.com/dericed/ffmpeg-mpeg2video-clipping" rel="nofollow noreferrer">this cool repository</a> I've generated this GIF of 10s of source video:</p>

<p><a href="http://www.forart.it/_priv/cultura/HF100_measurement.gif" rel="nofollow noreferrer">http://www.forart.it/_priv/cultura/HF100_measurement.gif</a> (33 Mb, so can't post. Click to watch)</p>

<p>It graphically shows how recorded video exceed the broadcast range.</p>

<p>The question is: how to "shift down" everything (and constrain inside broadcast range, of course) in order to preserve the maximum possible color quality ?</p>

<p>(note: someone already suggested me to use " <em>Levels(0, 16, 255, 16, 235, coring=false)</em> " in AviSynth but, if possible, I want to do it only with FFMPEG)</p>

<p>Thanks in advance to anyone that can/will help.</p>

<p>Marco</p>
 1871: <p>You can use the geq filter to remap the pixel value ranges.</p>

<pre><code>ffmpeg
 -i input
 -vf "geq=lum='(p(X,Y)-16)/(255-16)*(235-16)+16':cb='(p(X,Y)-16)/(255-16)*(240-16)+16'"
 -c:v libx264 -c:a copy out.mp4
</code></pre>

<p>The geq filter rescales the input luma from 16-255 to 16-235, and both the input chroma from 16-255 to 16-240, which is  the legal range for broadcast 8-bit signals.</p>
