I have an application that generates a bunch of jpg that I need to turn into video on the Internet. I am trying to get rgb data from jpegs into a vpxenc sample. I can see the main shapes from the original jpg in the output video, but everything is colored green (even pixels that should be black are about half green), and every other scan line contains garbage.
I am trying to pass VPX_IMG_FMT_YV12 data, which I assume is structured like this:
for each frame 8-bit data Y 8-bit average values ββof each block 2x2 V 8-bit average values ββof each block 2x2 U
Here is the original image and a screenshot of the video that comes out:
Images
It is possible that I am doing RGB-> YV12 incorrectly, but even if I only encode 8-bit Y data and set the U and V blocks to 0, the video looks pretty much the same. I basically control RGB data through this equation:
// (R, G, and B are 0-255) float y = 0.299f*R + 0.587f*G + 0.114f*B; float v = (Ry)*0.713f; float u = (Bv)*0.565f;
.. and then produce 2x2 filtered values ββfor U and V that I write in vpxenc, I just do (a + b + c + d) / 4, where a, b, c, d is the U or V of each block 2x2 pixels .
So, I am wondering:
Any help would be greatly appreciated.
source share