title: How can I create a YUV422 frame from a JPEG or other image on Ubuntu
body: <p>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.</p>
  
  <p>I've tried ImageMagick but am clearly doing something wrong:</p>
  
  <pre><code>convert -size 640x480 -depth 24 test.jpg -colorspace YUV -size 640x480 -depth 16 -sampling-factor 4:2:2 tmp422.yuv
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/YdV3c.jpg" alt="enter image description here"></p>
  
  <pre><code>convert -colorspace YUV -size 640x480 -depth 16 -sampling-factor 4:2:2 tmp422.yuv -size 640x480 -depth 24 -colorspace RGB test2.jpg
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/I79o1.jpg" alt="enter image description here"></p>
  
  <p>I've also install the mpegtools package on Ubuntu, in order to use jpeg2yuv:</p>
  
  <pre><code>&gt;&gt; jpeg2yuv -f 1 test.jpg
     INFO: [jpeg2yuv] Reading jpeg filenames from stdin.
     INFO: [jpeg2yuv] Parsing &amp; checking input files.
  
  **ERROR: [jpeg2yuv] System error while opening: "": No such file or directory
  </code></pre>
  
  <p>Clearly, something else is wrong. Could someone please shed some light on how I might accomplish this? Thanks -</p>