^^^^
Exactly. Treating the footage with the RGB clipping sledgehammer in order to comply with some broadcast specs, or 'manipulating' the YUV (aka digital YCbCr) data to minimize the RGB clipping are two sides of the coin.
If Chris319 is concerned about his YUV (0....255) camcorder videos it may be easiest to open these in a tool (NLE) which treats the signal as YUV (or converts to RGB floats) and then make adjustments such that the resulting RGB parade looks "reasonable" (say none or only one of the RGB components getting clipped) and yet the picture looks "pleasing", IMO. Such legalizing YUV adjustments usually mean to move (shrink) CbCr towards their origin (128,128) until they hit the surface of the inner (valid RGB) block of the YCbCr cube (e.g. reduce the saturation, color grading tools).
+ Reply to Thread
Results 31 to 36 of 36
-
Last edited by Sharc; 17th Jan 2026 at 13:03.
-
Are you sure you really need to clip the RGB (assuming 'studio' YUV<->RGB conversion)? Clipping usually damages the footage. Doesn't the usual YUV levels adjustments do what is needed (in best case avoiding RGB clipping) - with less damage than clipping? Do you submit your material to broadcasters who request min/max RGB boundaries? Just curious.
-
Assuming your camera outputs limited range YUV with excursions in the 0...16 and 235...255 luma range, and you want to clip it to stated limits in RGB (16-235) or (5-246) acc. EBUr103 or whatever, I woud suggest in any case to add the colorspace (matrix) and range of the source and target to the scale filter, to prevent surprises with the conversion and clipping.
For the "720p" case of post #1 this would become, for example (adjust to your use cases):
Just trusting in defaults or (incorrect or undefined) flags may mess it up and/or give unexpected results, in my experience.Code:ffmpeg -hide_banner -i "%~1" -vf scale=interl=0:in_color_matrix=bt709:out_color_matrix=bt709:in_range=limited:out_range=limited:width=1280:height=720:flags='bilinear',"lutrgb=r='clip(val,16,235)':g='clip(val,16,235)':b='clip(val,16,235)'",setrange=range=limited -codec:v libx264 -crf 0 -pix_fmt:v yuv420p -color_range "tv" -color_primaries bt709 -color_trc bt709 -colorspace bt709 -movflags +write_colr -c:a copy "%~1_clipped_.mp4"
Last edited by Sharc; 25th Jan 2026 at 11:14.
-
Sharc:
Your code works!
Could you please add your code to the 1080i version? Thank you. -
For interlaced sources and EBUr103 preferred limits try something like
Code:ffmpeg -hide_banner -i "%~1" -vf scale=interl=1:width=1920:height=1080:in_color_matrix=bt709:out_color_matrix=bt709:in_range=limited:out_range=limited,setfield=tff,setsar=1/1,"lutrgb=r='clip(val,5,246)':g='clip(val,5,246)':b='clip(val,5,246)'",setrange=range=limited -codec:v libx264 -crf 16 -pix_fmt:v yuv420p -color_range "tv" -color_primaries bt709 -colorspace bt709 -flags +ilme+ildct -movflags +write_colr -c:a copy "%~1_clipped_.mp4"
-
to 720p 16 - 235
Pixel format = 4:2:2
Code:ffmpeg -y -hide_banner -i "C0015.mp4" -vf scale=interl=0:in_color_matrix=bt709:out_color_matrix=bt709:in_range=limited:out_range=limited:width=1280:height=720:flags='bilinear',"lutrgb=r='clip(val,16,235)':g='clip(val,16,235)':b='clip(val,16,235)'",setrange=range=limited -codec:v libx264 -crf 0 -pix_fmt:v yuv422p -color_range "tv" -color_primaries bt709 -color_trc bt709 -colorspace bt709 -movflags +write_colr -c:a copy "clipped_.mp4"
to 1080i 16 - 235
Pixel format = 4:2:2
Code:ffmpeg -y -hide_banner -i "C0015.mp4" -vf scale=interl=1:width=1920:height=1080:in_color_matrix=bt709:out_color_matrix=bt709:in_range=limited:out_range=limited,setfield=tff,setsar=1/1,"lutrgb=r='clip(val,16,235)':g='clip(val,16,235)':b='clip(val,16,235)'",setrange=range=limited -codec:v libx264 -crf 16 -pix_fmt:v yuv422p -color_range "tv" -color_primaries bt709 -colorspace bt709 -flags +ilme+ildct -movflags +write_colr -c:a copy "1080_clipped_.mp4"
Similar Threads
-
what broadcast camera
By marcorocchini in forum Newbie / General discussionsReplies: 0Last Post: 5th Sep 2025, 18:01 -
Broadcast TV
By David Banner in forum DVB / IPTVReplies: 3Last Post: 28th Oct 2023, 12:00 -
OBS: Broadcast Levels from Camera
By chris319 in forum Capturing and VCRReplies: 8Last Post: 5th Aug 2023, 15:22 -
Video Levels in Quicktime
By GaneshRavi1125 in forum Newbie / General discussionsReplies: 8Last Post: 4th Jan 2022, 11:04 -
VLC Correct Levels
By chris319 in forum Software PlayingReplies: 0Last Post: 28th Aug 2021, 23:39


Quote