Unable to encode YUV4:2:0 data to color JPEG image
I have video streaming (YUV 4:2:0 1920x1080) that comes from hardware. I was able to encode and muxing this video to MPEG2, MPEG4 and H.264 file, but I have the problem to save a single frame as jpeg file.
I have buffer with raw YUV 4:2:0 video frame (1920x1080) and using a sample code from UIC jpeg I only was able to encode the data only as image with GRAY color. I tried to manipulate with different configuration and parameters but the image file has 0 size or if the file doesn't have 0 bytes size when I try to open the image I receive the message that the file can't be opened because the file appears to be damaged, corrupted, or is too large.
Any ideas what could be wrong?
I tried to use the SaveImageJPEG functions from jpeg.cpp without and play around with data that I am passing to it. This is the sample of one of my try code before using SaveImageJPEG function