Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.


Go Back   Doom9's Forum > General > Newbies

Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 24th July 2023, 00:34   #1  |  Link
Registered User
Join Date: Sep 2020
Posts: 19
Help verify RGB to YUV conversion

Hi, I'm authoring sRGB clips and I'd like guidance on converting them to the YUV colorspace and verify it was done correctly.

my first source is this page https://www.silicondust.com/yuv-to-r...-for-tv-video/
they link to the ITU-R REC-BT.709-6 and give an equation, I punch that into an excel spreadsheet and my own guess on what page 6/19 says

to avoid any decoder YUV->RGB conversion, I'll be reading the raw.yuv with ImHex as the hex editor, data visualizing: Hexadecimal (8 bits)
with the answer from this source https://stackoverflow.com/questions/...v422-raw-video
I should be looking at the right addresses for Y0 U0 V0

to start I'll open paint and select a custom color of RGB 52,52,52, fill the canvas, then crop the canvas to 2x2 pixels, then save it as a 24bit bitmap named 52_52_52.bmp
the spreadsheet says my YUV values should be 52,128,128, those values converted by DEC2HEX should be 33,80,80
however my results are 3D,80,80 with multiple methods which I'll list below (and attached an image)

ffmpeg -y -i 52_52_52.bmp -pix_fmt yuyv422 -f rawvideo ffmpeg.yuv
ffmpeg -y -color_trc iec61966-2-1 -i 52_52_52.bmp -pix_fmt yuyv422 -f rawvideo ffmpeg.yuv
ffmpeg -y -colorspace bt709 -color_trc iec61966-2-1 -i 52_52_52.bmp -pix_fmt yuyv422 -f rawvideo ffmpeg.yuv
ffmpeg -y -i 52_52_52.bmp -vf zscale=r=limited:matrix=709 -color_trc iec61966_2_1 -colorspace bt709 -color_primaries bt709 -pix_fmt yuyv422 -f rawvideo ffmpeg.yuv

yuy2.avs | ConvertToYUY2(ImageReader("n:\52_52_52.bmp",0000,0000))
ffmpeg -y -i yuy2.avs -f rawvideo avisynth.yuv

52_52_52.bmp in virtualdub2 | save video… Uncompressed… Pixel Format YUYV-709… save as 'any format by ffmpeg'... vd2.yuv
52_52_52.bmp in virtualdub2 | filters… convert format… YUY2 Rec. 709 Limited… save video… Uncompressed… Pixel Format… Filters checked… save as 'any format by ffmpeg'... vd2.yuv
With 3 tools agreeing that 52_52_52.bmp should be 3D,80,80 and not 33,80,80.. can someone clear up my confusion?
Attached Images
LStation is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 02:00.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.