VideoHelp Forum
+ Reply to Thread
Results 1 to 2 of 2
Thread
  1. I'm trying to convert h.264 rgb to h.264 4:4:4, problem is the colors change when using FFmpeg as decoder.
    I used:
    Code:
    ffmpeg -y -loglevel fatal -noautorotate -nostdin -threads 8 -i "C:\Users\Selur\Desktop\bandicam 2021-07-17 13-06-48-101.avi" -map 0:0 -an -sn -vf  scale=in_range=pc:out_range=pc -sws_flags accurate_rnd+full_chroma_inp -pix_fmt yuv444p -vsync 0 -f rawvideo - | x264 --preset fast --crf 18.00 --profile high444 --level 4.1 --direct auto --b-adapt 0 --sync-lookahead 48 --qcomp 0.50 --rc-lookahead 40 --qpmax 51 --partitions i4x4,p8x8,b8x8 --no-fast-pskip --subme 5 --trellis 0 --aq-mode 0 --vbv-maxrate 50000 --vbv-bufsize 187500 --sar 1:1 --non-deterministic --range pc --colormatrix bt709 --demuxer raw --input-res 1360x768 --input-csp i444 --input-range pc --input-depth 8 --fps 25/1 --output-csp i444 --output-depth 8 --output "E:\Temp\2021-07-17@13_27_55_0010_01.264" -
    the part for the color conversion:
    Code:
    -vf  scale=in_range=pc:out_range=pc -sws_flags accurate_rnd+full_chroma_inp -pix_fmt yuv444p
    problem is comparing the colors using:
    Code:
    clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/bandicam 2021-07-17 13-06-48-101.avi", format="YUV444P8", cache=0, prefer_hw=0)
    clip2 = core.lsmas.LibavSMASHSource(source="E:/Output/bandicam 2021-07-17 13-06-48-101.mp4")
    # making sure input color matrix is set as 709
    clip = core.resize.Point(clip, matrix_in_s="709",range_s="full")
    clip2 = core.resize.Point(clip, matrix_in_s="709",range_s="full")
    # making sure frame rate is set to 25
    clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
    # Setting color range to PC (full) range.
    clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
    clip2 = core.std.SetFrameProp(clip=clip2, prop="_ColorRange", intval=0)
    
    clip = core.std.Interleave([clip, clip2])
    one can see color changes:


    This does not happen when I do the color conversion in Vapoursynth using:
    Code:
    # adjusting output color from: RGB24 to YUV444P8 for x264Model (i444@8)
    clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="709", range_s="full")
    and then feed x264 through vspipe.

    So the question is: How to avoid this using FFmpeg?

    Cu Selur
    Image Attached Files
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  2. DOH, got it the color matrix needs to be set:
    Code:
    -vf  scale=in_range=pc:out_range=pc:out_color_matrix=bt709 -sws_flags accurate_rnd+full_chroma_inp -pix_fmt yuv444p
    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  



Similar Threads

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