VideoHelp Forum




+ Reply to Thread
Results 1 to 6 of 6
  1. This is giving me good results converting full-range (8-bit 0 - 255) video to "limited" (8-bit 16 - 235) video.

    Note the use of ffv1 version 3 codec.

    Code:
    ffmpeg -y -hide_banner -i "C0042.mp4" -vf scale=w=1280:h=720,lutyuv=y='clip(val,16,235)',lutyuv=u='clip(val,16,240)',lutyuv=v='clip(val,16,240)',setparams=range="tv" -codec:v ffv1 -level 3 -pix_fmt:v yuv422p -color_range "tv" -vb 50M -color_primaries bt709 -color_trc bt709 -colorspace bt709 -c:a pcm_s16be clipped.mov
    Last edited by chris319; 27th Jul 2023 at 08:07.
    Quote Quote  
  2. 1080i version:

    Code:
    ffmpeg -y -hide_banner -i "C0015.mp4" -vf tinterlace=4:vlpf,scale=w=1920:h=1080,lutyuv=y='clip(val,20,223)',lutyuv=u='clip(val,16,240)',lutyuv=v='clip(val,16,240)',setparams=range="tv" -codec:v ffv1 -level 3 -pix_fmt:v yuv422p -color_range "tv" -vb 50M -color_primaries bt709 -color_trc bt709 -colorspace bt709  -flags +ilme+ildct  -movflags +write_colr  -c:a pcm_s16be clipped.mov
    Last edited by chris319; 27th Jul 2023 at 12:13.
    Quote Quote  
  3. You're not converting full range to limited range. You're clamping full range to limited range, losing dark and bright details.
    Quote Quote  
  4. That 1st command will work ok if the input video is flagged full range and it's read as full range. The clipping will occur after the full to limited scaling which occurs automatically if flagged full .

    The default behaviour of swscale if it encounters a full range flag is to scale to limited range. In other words, the hidden commands are
    Code:
    in_range=full:out_range=limited
    The lutyuv will hard clip values after the scale (resampling can create aliasing and out of range values) . If a video is not flagged full range, but is full range, you need to explicitly input the range parameters. It's good practice to enter them anyways .

    -vb 50M will do nothing with ffv1 is the video codec ; ffv1 will always use the bitrate required to achieve losslessness


    Why is the 1080i version different for lutyuv ? lutyuv=y='clip(val,20,223)' , not 16-235 ?
    Quote Quote  
  5. Originally Posted by poisondeathray View Post
    If a video is not flagged full range, but is full range, you need to explicitly input the range parameters.
    Ah, that's the problem I was having. The source I converted with the ffmpeg command line was not flagged as full range, but had a full range test pattern.
    Quote Quote  
  6. I discovered a flaw in the program I was using to check video levels. It has now been fixed.

    Bandwidth command removed. Changed video range. The input files are flagged as "limited". I have no control over that. The range of values is actually 0 - 255 despite being flagged as "limited". Using limiter instead of clipper.

    How's this?

    Code:
    ffmpeg -y -hide_banner -i "C0015.mp4" -vf scale=w=1280:h=720,setparams=range="tv",limiter=16:235:1,limiter=16:240:6  -codec:v ffv1 -level 3 -pix_fmt:v yuv422p -color_range "tv" -color_primaries bt709 -color_trc bt709 -colorspace bt709  -movflags +write_colr  -c:a pcm_s16be limited.mov
    Last edited by chris319; 27th Jul 2023 at 22:32.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!