"Canon RGB" color space *shift* to broadcast range with FFMPEG 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
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.