I extracted a raw video frame with "spirit ffms" (bindings for python to the ffmpegsource), and i opened the file in an hex editor to get the YUV values and i dont know how to do it since the h264 specification says that for each component (luma e chrominances) must have from 8 to 14 bits with a total of 1 luma for each pixel + 1 of each U and V every 4 pixels square, and i can get only the Y component because:
-frame resolution = 1920x1080 = 2073600 pixels
-total of bytes of the frame: 2108160
2108160 - 2073600 = 34560 remaining bytes
which means that i have to convert from only the Y component or all three components are in just one byte. I dont think the UV components are in the remaining bytes for two reasons: 1- 34560 * 8 = 276480 bits and 2073600 / 4 = 518400 (2x2 squares), so even if it have just one chrominance component with one bit, for each 2x2 square it would not fit all (squares), and even dividing 276480 / 129600 (16x16 squares) = 2,133.... it doesnt match the calculations.
2- analising the final of the frames in the hex editor i found that they are the same.
All the frames are "I" frames, and i know the frame is right because i converted the video to raw video with ffmpeg and the resultas are the same. Anyone knows anything that can help?
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 16 of 16
Thread
-
Last edited by toshyuki; 7th Oct 2012 at 05:22.
-
Yes, assuming 8 bit channels you should have a 1920x1080 luma plane followed by two 960x540 chroma planes.
Code:2,073,600 + 518,400 + 518,400 --------- 3,110,400
-
add -pix_fmt rgb24 to use swscale to convert yuv=>rgb
e.g.
ffmpeg -i input.ext -vcodec rawvideo -pix_fmt rgb24 -an output.rgb -
-
-
Exaclty what are you asking for? The equation for YUV to RGB ?
http://www.fourcc.org/fccyvrgb.php -
Since your source is high definition you probably need the rec.709 matrix (unless the video is flagged differently).
http://en.wikipedia.org/wiki/YUV#BT.709_and_BT.601 -
-
What's the command line you're using? I'll see if I can duplicate the problem.
I made a 10 frame 1920x1080 MP4 file and used the following command line to create a raw YV12 file:
Code:ffmpeg -i bn.mp4 -vcodec rawvideo -pix_fmt yuv420p -an output.yuv
Y:
V:
U:
Last edited by jagabo; 7th Oct 2012 at 21:23.
-
But even if something is wrong and incorrectly signaled - difference will quite subtle and for most normal colors unnoticeable even for hex values (and even for this case error can be calculated) - i still don't understand what is purpose of the author question and how to solve his problem.
Perhaps author ask how to upsample data from 4:2:0 to 4:4:4? then how to perform YCbCr>RGB conversion?
But this is only guessing - intention of author question(s) are completely unclear for me. -
Similar Threads
-
AVS to YUV
By fidogenial in forum Video ConversionReplies: 1Last Post: 21st Oct 2010, 21:53 -
PS3 MPEG4 AVC - RGB or YUV?
By Colmino in forum Newbie / General discussionsReplies: 1Last Post: 28th Jun 2008, 14:50 -
Separation of YUV and RGB video components
By Dave1024 in forum ProgrammingReplies: 0Last Post: 24th Jun 2008, 04:19 -
App to identify whether a video is RGB or YUV?
By Colmino in forum Newbie / General discussionsReplies: 2Last Post: 12th Jun 2008, 23:52 -
Optimized Conversion between YUV and RGB
By Dave1024 in forum ProgrammingReplies: 14Last Post: 27th May 2008, 01:40