Friday, 26 October 2012

Playback/display YUV video file

I was trying to play a YUV file (e.g. the foreman.yuv clip from somewhere like here, or here) - the simplest way seems to be to get mplayer and run it like this (note the -rawvideo option indicates the file format - see mplayer man page for more info):
mplayer foreman.yuv -demuxer rawvideo -rawvideo cif

Or you can use Gstreamer (available for Linux, Windows, and OSX, though there's a problem using autovideosink on the cmd line on the Mac) like this:
gst-launch filesrc location=foreman.yuv ! videoparse width=352 height=288 framerate=25/1 ! ffmpegcolorspace ! autovideosink

You'll obviously need to change the resolution and potentially framerate for different video samples but these work with 'foreman' clip.

BTW if you want to compute the PSNR between two YUV files you can use ffmpeg's tiny_psnr utility like so:
tiny_psnr foreman.yuv foreman-mangled.yuv

Saturday, 20 October 2012

How to change the 'original' date on a JPEG photo

So you've got a photo with a weird date on it - how do you change it? Well on OSX or Linux you can do it the terminal using a handy utility called exif (which you'll need to get from macports or apt):

exif --tag 0x9003 --ifd='EXIF' --set-value='2012:10:17 16:30:37' myphoto.jpg

It will create a new file with the new date called myphoto.jpg.modified.jpg which you can then rename to the original or something else.

There are of course other tools but this one works for me. I'll list others if/when I come across them.

Note: In theory you could use iPhoto on OSX but it is unfortunately buggy - so if you have a date like 1/2/1911 and you try moving it forward with iPhoto then it sets a date earlier in time?!