Kink the video, not your neck

If you’re anything like me when shooting short video clips with your camera, you regularly find that you’ve captured a great little clip with one exception – the video is turn on its side. Here is a little script to get you out of that dilemma, since I’ve found that it’s not as easy as it should be with most video editors for Linux.

#!/usr/bin/env perl
# Naulilus (or command line) script to rotate one or more videos, renaming
# each one from, e.g., ‘dir/input.avi’ to ‘dir/output (rotated).avi’
# Author: Taylor Braun-Jones
use File::Basename;

my ($input, $output);
my ($filebase, $dir, $suffix);

# open DBG, “>/tmp/rotate_video_debug” and select DBG;
} else {
@videos = @ARGV;

foreach $input ( @videos ) {
chomp $input;
($filebase, $dir, $suffix) = fileparse(“$input”, ‘\..*$’) or die “Failed
to parse filename: $input”;
$output = “$dir$filebase (rotated)$suffix”;
print “Rotating: ‘$input’ -> ‘$output’\n”;
system “mencoder -vf rotate=1 -o \”$output\” -oac copy -ovc lavc \”$inpu
close DBG if DBG;

Just drop this script into $HOME/.gnome2/nautilus-scripts/ and give it execute permsions


Also, make sure you have mencoder installed. On Debian-based systems (like Ubuntu) it’s as simple as:

sudo apt-get install mencoder

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.