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:
the part for the color conversion: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" -
problem is comparing the colors using:Code:-vf scale=in_range=pc:out_range=pc -sws_flags accurate_rnd+full_chroma_inp -pix_fmt yuv444p
one can see color changes: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])
This does not happen when I do the color conversion in Vapoursynth using:
and then feed x264 through vspipe.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")
So the question is: How to avoid this using FFmpeg?
Cu Selur
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 2 of 2
Thread
-
users currently on my ignore list: deadrats, Stears555
-
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
users currently on my ignore list: deadrats, Stears555
Similar Threads
-
Converting Blu-Ray YUV to RGB and back to YUV?
By killerteengohan in forum RestorationReplies: 17Last Post: 17th Mar 2020, 20:42 -
VirtualDub RGB to YUV with ffmpeg x264
By johnny27depp in forum Newbie / General discussionsReplies: 15Last Post: 14th Jun 2019, 11:35 -
Help Converting YUV to RGB
By chris319 in forum Video ConversionReplies: 7Last Post: 24th Sep 2018, 18:51 -
RGB to YUV to RGB
By chris319 in forum ProgrammingReplies: 70Last Post: 20th Feb 2017, 16:49 -
ffmpeg/x264 RGB to YUV
By SameSelf in forum Video ConversionReplies: 40Last Post: 14th Nov 2016, 18:40