title: how to get pixel by pixel values from a YUY2 yuyv422 raw video?
body: <p>I have a video (extension is .ravi) that is the output of a IR camera software.
  I need to compute the temperature from each pixel for each frame within that video.
  The IR camera+software company already told me they would not help since such information would reveal much of their know-how.</p>
  <p>When I play the video, e.g. in mplayer, the temperature fields seem to display correctly. So the information that translates into a pixel color contains the information on its temperature.</p>
  <p>My idea is to isolate each frame into a file, find the pixel information for each pixel in each file. I am able to retrieve the temperature pixel by pixel for single frames with the original IR Camera software (though this is done by point and click, unfeasible for each frame). Then, with the pixel information on the one side, and the temperature information on the other side (both for the first frame), I hope to relate them by a function and hopefully that function applies to all the frames of the video.</p>
  <p>For that video, I get the following metadata (from FFMEPG):</p>
  <pre><code>Metadata:
  META            : (640,480,16,312500),(0,0,0,0),0,1,80
  Duration: 00:13:53.06, start: 0.000000, bitrate: 158338 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x481, 157619 kb/s, 32 fps, 32 tbr, 32 tbn, 32 tbc
  </code></pre>
  <p>I guess the color I see when playing the video, which is somehow related to the pixels temperature, comes from the YUV values for each pixel.</p>
  <p>How can I access that information?</p>
  <p>I have tried to convert each frame to an image (say PNG) with FFMPEG, and then get the value for each pixel (e.g. using ImageMagick), but I get RGB values.</p>
  <p>Following @VC.One advice I can convert every frame to a single file:</p>
  <pre><code>ffmpeg -i original.ravi -c copy -pix_fmt yuyv422 frame%05d.bmp
  </code></pre>
  <p>(If I use .yuv as extension instead of .bmp I get a single file, and not a file for each frame.)</p>
  <p>Now, with a file for each frame, I can look at it with ImageMagick:</p>
  <pre><code>convert -size 640x481 -depth 8 -sampling-factor 4:2:2 YUV:frame00001.bmp -colorspace YUV frame00001.txt
  </code></pre>
  <p>and this is how the output looks like:</p>
  <pre><code># ImageMagick pixel enumeration: 640,481,65535,yuv
  0,0: (12436,26650,58361)  #3068E3  yuv(48,104,227)
  1,0: (6314,29662,45762)  #1973B2  yuv(25,115,178)
  2,0: (15547,25111,19123)  #3C624A  yuv(60,98,74)
  </code></pre>
  <p>From the documentation I understand this information as follows:</p>
  <ul>
  <li>first line, the header, contains information on the number of pixels (640x481) and the maximum value for each YUV field: 65535 (this I guess comes from the -depth 8 option)</li>
  <li>then, for each pixel, a line: its position, the YUV values into brackets,</li>
  <li>then as a comment the RGB value</li>
  <li>and then something else I do not understand.</li>
  </ul>
  <p>Are the single frames really saved as yuv files, even though they have the .bmp extension?
  Do I read properly the output of ImageMagick?</p>