eftychia: Me in poufy shirt, kilt, and Darth Vader mask, playing a bouzouki (vader)
Add MemoryShare This Entry
posted by [personal profile] eftychia at 11:24am on 2007-04-11 under ,

Last night on the way to [livejournal.com profile] anniemal's after rehearsal, I started thinking about camera-phone video shot from a bumpy, moving car. I was wondering how easily the bumps and jitters could be removed from the video by splitting it into individual frames, re-registering each frame so that a feature of the car -- say a mark on the dashboard -- was at the same location within each frame, cropping each frame to the area common to all the tranlated frames, and reassembling them into a video file.

So, since I was sitting in the passenger seat, I shot a bunch of video clips to play with later, either by trying to figure out how to automatically indentify the reference feature in each frame and feed the location to ImageMagick, or by Googling for existing software already designed to de-shake phone video.

This morning I considered my to-do list and asked, "What was I thinking? When am I going to get around to that?" Whoops.

But I still need to figure out how to split a 3GPP MPEG file into individual frames (or convert it directly to an abnimated GIF) for a completely separate, much smaller project. ImageMagick, at least the versions I've got handy, doesn't seem to like 3GPP video. And a shareware tool advertised as doing what I want insisted that I needed to install a new codec even though the Windows machine I was running it on could display the video already (implying that the right codec was already present on the machine) and even after I tried downloading another codec from the web site mentioned in the error message. (I'm trying to compile another tool now.)

[Update: the tool I said I was trying to compile failed to compile under Cygwin/WinXP but did compile -- and do exactly what I had hoped it would do -- under Mac OS X. I hope it also runs at my house in case I need it again in the future -- my guess is that its working correctly on the first try under Linux is more likely than not. Now to re-read the ImageMagick 'convert' man page...]

There are 11 comments on this entry. (Reply.)
ceo: (Default)
posted by [personal profile] ceo at 03:50pm on 2007-04-11
The Linux tool mplayer has options to do that (it also has options to butter your toast and change your oil). I once used it and a few other tools to extract the subtitles from a DVD into a text file.
 
posted by [identity profile] dglenn.livejournal.com at 02:29am on 2007-04-12
Do which, de-jitter a video, split a 3GPP video into individual JPEG frames, or both? (In whichever case: ooh, cool, I had no idea it would do that.)

I've got mplayer on my Debian box at home, but I think I'll wait until I get home to play with it even if it turna out to have a command-line interface for those tricks, rather than shuffling video files back and forth. (Though I could try it from here if there's a CLI -- there's a [consumer grade] broadband connection at each end ... Hmmmmm....)
ceo: (Default)
posted by [personal profile] ceo at 02:35am on 2007-04-12
Split a video into frames. I forget the format; it was whatever my cheap digital camera does for videos. mplayer is all command line; it has about twice as many command-line options as ls.
 
posted by [identity profile] unix-vicky.livejournal.com at 03:18am on 2007-04-12
...is the file-to-file version of mplayer (understands the same formats). If you have it installed, a simple "man mencoder" will give you a listing of the options, but not a good idea of how to combine them to do what you want. I did manage to get it to do the opposite (convert a series of JPEG images into an AVI video file). More expensive cameras will store (uncompressed) "DV format" video. Cheaper ones will do Motion-JPEG (one JPEG after another) or perhaps MPEG4 (of which DivX is a variant).

Google is your friend.

 
posted by [identity profile] dglenn.livejournal.com at 03:27am on 2007-04-12
This is from a cell phone, in the (as far as I can tell, especially-for-phones(?)) 3GPP version of MPEG4 (if I'm correctly remembering what I read half-asleep), which some tools -- including ImageMagick -- couldn't handle even though they said they support MPEG4. If it turns out I already had one or two tools installed that do handle it ... oh well, I got my frames either way.

Huh. I just telnetted home to the Debian box for a peek, and the man page lists both mplayer and mencoder, but 'which mencoder' doesn't find mencoder on my path. Odd. It does see mplayer in /usr/bin.
 
posted by [identity profile] dglenn.livejournal.com at 03:40am on 2007-04-12
Speaking of who-doesn't-support-what, I need to start doing some sort of configuration management. I got ffmpeg to compile on [livejournal.com profile] anniemal's Mac, which I was accessing via telnet from [livejournal.com profile] syntonic_comma's work laptop (only reason he's got a Windows machine in the house is because work told him to and handed it to him), but some of the flags to 'convert' didn't work like the ImageMagick web site said. So I switched to a local xterm and it worked right on the WinXP machine. So I somehow managed to install different versions of ImageMagick on the two machines, and probably have wound up with at least one more version at home.

So now I'm thinking about how to maintain coherency of environment across at least three different operating systems in two geographical locations on machines where I'm a guest as well as ones I own. (I'm not sure whether to count different versions of Windows, or different distros of Linux, as separate operating systems when it comes to counting how many environments I'm trying to coordinate -- and then there's the whole Windows-native versus Cygwin thang.)
 
posted by [identity profile] unix-vicky.livejournal.com at 04:51am on 2007-04-12
Well, to me, there are "families" of Linux. RedHat and Fedora are in one family (SuSe might be a sort of cousin, as it does use RPM for packages). Debian is probably the older brother of Ubuntu. Slackware is the old looney uncle that no-one wants to admit to knowing. :-)

But I know what you mean. In my house, my spouse and our housemate use Windows (2K and XP), as do I at work. I use Fedora for my main machine and our household fileserver. Our main web/mail/shell server uses FreeBSD, and I also have a couple NetBSD servers (running MRTG/Apache, secondary mail service, and DNS).

Going back to the topic, though... I would think mencoder/mplayer should be able to handle that video (they steal a lot of codecs from Windows, look for separate codec packages like "all-20050412.tar.bz2" or "essential-20061022.tar.bz2"). And, I'm not sure why you might have mplayer but not mencoder. I think they're usually in the same package. Could you have run out of disk space during the install? Did you install from binary package, or source, or repository (aptget or whatever)?

 
posted by [identity profile] dglenn.livejournal.com at 05:23am on 2007-04-12
Yah, I was considering grouping distros by update tool.

Mplayer and mencoder share a single man page (out of curiousity, on your system are they separate binaries or two links to the same file?) I've no idea why mencoder should be missing -- mplayer was either on the box when I got it, or I added it using aptitude later; I'm sure I had to either upgrade or re-install it using aptitude at some point (I've had a couple of apt-mishaps on that box, and occasionally it decides to remove packages that I'd been using regularly).
 
posted by [identity profile] unix-vicky.livejournal.com at 05:58am on 2007-04-12
percheron(685)% ls -l `which mplayer ; which mencoder`
-rwxr-xr-x 1 root root 5376264 Dec 11 2005 /usr/bin/mencoder
-rwxr-xr-x 1 root root 6027784 Dec 11 2005 /usr/bin/mplayer

I installed mine via yum, probably from the instructions on this page.
 
posted by [identity profile] unix-vicky.livejournal.com at 06:00am on 2007-04-12
That should look like this:
percheron(685)% ls -l `which mplayer ; which mencoder`
-rwxr-xr-x  1 root root 5376264 Dec 11  2005 /usr/bin/mencoder
-rwxr-xr-x  1 root root 6027784 Dec 11  2005 /usr/bin/mplayer

 
posted by [identity profile] gclectic [typekey.com] at 09:04am on 2007-04-12
I'll be interested in hearing how this comes out. One of my first products once I ditch my day job is a similar but potentially more ambitious project. It should involve doing the same thing, but without the reference point. As long as there are no really abrupt transitions, some simple optimization techniques (i.e. newton's method) should be able to figure out a coordinate transformation that that minimizes the difference between any two adjacent frames, and thus allows you to chain the transforms to put all frames into the same coordinate system.

If I ever get it to work for my application, it might work for yours as well.

(BTW, don't be confused by the funky pseudo-anon identity -- we've chatted and jammed at cons. Perhaps I'm the only Irish harpist you've ever formed an impromptu blues trio with, though I'm not counting on it.)

Links

January

SunMonTueWedThuFriSat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24
 
25
 
26
 
27
 
28
 
29
 
30
 
31