How can I create a YUV422 frame from JPEG or another image on Ubuntu

I want to create a YUV422 Frame sample on Ubuntu from any image so that I can encode the YUV422 function for RGB888 for the sake of learning. I would really like to have a reliable tool for creating a sample and converting back to jpeg.

I tried ImageMagick, but I am clearly doing something wrong:

convert -size 640x480 -depth 24 test.jpg -colorspace YUV -size 640x480 -depth 16 -sampling-factor 4:2:2 tmp422.yuv 

enter image description here

 convert -colorspace YUV -size 640x480 -depth 16 -sampling-factor 4:2:2 tmp422.yuv -size 640x480 -depth 24 -colorspace RGB test2.jpg 

enter image description here

I also installed the mpegtools package on Ubuntu to use jpeg2yuv:

 >> jpeg2yuv -f 1 test.jpg INFO: [jpeg2yuv] Reading jpeg filenames from stdin. INFO: [jpeg2yuv] Parsing & checking input files. **ERROR: [jpeg2yuv] System error while opening: "": No such file or directory 

Clearly, something else is wrong. Can anyone shed some light on how I can do this? Thanks -

+6
source share
1 answer

Do this with ffmpeg :

 ffmpeg -i a.jpg -s 640x480 -pix_fmt yuv422p a.yuv ffmpeg -pix_fmt yuv422p -s 640x480 -i a.yuv b.jpg 
+10
source

All Articles