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

会有一股神秘感。 提交于 2019-12-13 11:50:12

问题


I want to create a sample YUV422 Frame on Ubuntu from any image so I can code a YUV422 to RGB888 function for the sake of learning. I'd really like to be able to use a trusted tool to create a sample and convert back to a jpeg.

I've tried ImageMagick but 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

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

I've also install the mpegtools package on Ubuntu, in order 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. Could someone please shed some light on how I might accomplish this? Thanks -


回答1:


Do it with ffmpeg:

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


来源:https://stackoverflow.com/questions/14427648/how-can-i-create-a-yuv422-frame-from-a-jpeg-or-other-image-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!