MJPEG VidRotate
Introduction
If you're taking "long photos", and uploading them somewhere like flickr, it will feel perfectly natural to take them in a portrait orientation. So you need some way of taking the file, and turning it on its side.
VidRotate is a simple Windows batch script which brings together a bunch of utilities to rotate a MJPEG video in an AVI container, as produced by a digital camera. In particular, it's been tested with videos from *my* digital camera - a Casio Exilim EX-Z1050. Your mileage, as they say, may vary.
For more background, see the blog post announcing the scripts.
Use
- Download the latest zip file.
- Unzip somewhere on your hard-disk
- Open a Command Prompt
- Run path\to\rotate.cmd "input file.avi" "output file.avi"
If those instructions are too technical, you shouldn't be using this script right now. I can't stress enough that this is prototype-quality code, and is used at your own risk!
Known Limitations
- The script makes a number of assumptions, including that the video has 25 frames per second, that you want to rotate 90° clockwise, and that the frames can be rotated losslessly.
- The flickr desktop uploadr doesn't seem to like the resulting files. This seems to be a limitation of the uploadr itself, as uploading them to flickr through the web interface works fine.
- All metadata from the original video (creation time etc) will not be copied - exiftool can read the metadata from the source file, but not currently write it back to the rotated version.
Technical Info
The script is really a simple bit of glue to automate a series of command-line utilities. The utilities included are:
- MJPEG tools [GPL]
- provides the bulk of functionality
- jpegtran [Licence unclear]
- to rotate the images
- FFmpeg [LGPL / GPL], unofficial Windows autobuild
- a real sledgehammer-to-crack-a-nut, this is the only tool I've found so far to extract the audio from the original video
To Do
This is still pretty much prototype code, not least because my Windows CMD scripting skills are rudimentary at best.
- Error handling - currently, everything tries to carry on regardless
- Replace ffmpeg with something smaller, even if I have to compile something myself!
- Allow user to specify rotation and framerate
- The temp directory should check for existence
- Determine the ouput filename automatically if unspecified
- Include registry settings to add "Rotate MJPEG" options to appropriate right-click menus
- By which point, an installer would be nice!
Licensing and Contact Info
© Script Copyright Rowan Collins, 2009; included utilities copyright of their respective developers
This program is distributed under the GNU GPLv2
If you like - or hate - it, please contact me on vidrotate [[AAHTT]] rwec.co.uk