如何在Ubuntu上从JPEG或其他图像创建YUV422帧 [英] How can I create a YUV422 frame from a JPEG or other image on Ubuntu
问题描述
我想从任何图像上在Ubuntu上创建一个示例YUV422框架,因此为了学习起见,我可以将YUV422编码为RGB888.我真的很希望能够使用受信任的工具来创建样本并将其转换回jpeg.
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.
我尝试过ImageMagick,但显然做错了什么:
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
为了使用jpeg2yuv,我还在Ubuntu上安装了mpegtools软件包:
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 -
推荐答案
使用ffmpeg
进行操作:
ffmpeg -i a.jpg -s 640x480 -pix_fmt yuv422p a.yuv
ffmpeg -pix_fmt yuv422p -s 640x480 -i a.yuv b.jpg
这篇关于如何在Ubuntu上从JPEG或其他图像创建YUV422帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!