aoakley.com

Unpacking "Packed Bitstream" AVI MP4 files under Linux

Ever burned an AVI MP4 DivX or Xvid file to a data DVD/CD, only to find that when you try to play it back on your supposedly MP4-compatible DVD player, it skips, judders, has jerky movement and generally misbehaves? This is caused by the video files having a Packed Bitstream, and your player not supporting Packed Bitstream.

Microsoft Windows users can use the excellent MPEG4 Modifier by Moitah but for Linux users it's a little more complicated. MPEG4 Modifier is a .NET program, and sure, under Linux you can install Mono and run Moitah's UnpackCL.exe and it will work just fine. But what if you can't install Mono, or don't want to?

The solution is Barak's UnpackMP4 which is a re-write of Moitah's UnpackCL but written in Java rather than .NET . Sure, some GNU purists are as wary of Java as they are of Mono, but for most people, the chances are that Java is either already installed on your Linux distro, or is installed very easily.

Installing Java on a headless Ubuntu server

Ubuntu Server, in its minimal configuration, does not have a Java virtual machine installed. If you try to install the usual desktop Java VM, it won't work if you don't have a desktop, X-Windows/Xorg set up etc. The solution is to install a "headless" JVM such as:

$ sudo apt-get install gcj-jre-headless

You can then run java -jar unpackmp4.jar [-i] source-path [dest-path] or whatever.

Installing Java using Optware/Ipkg on a Netgear Stora, OpenWRT etc.

This can be done, but probably won't be much use for unpacking packed-bitstream AVIs, since embedded devices such as the Stora don't tend to have enough memory (RAM) to unpack videos more than a few minutes long. As a rough rule of thumb, your free memory needs to, at least, equal the size of the video file to be unpacked. With half an hour of standard-definition telly taking up around 250MB, and most embedded devices such as the Stora only have 128MB memory, you're stuffed from the start. Sure, you could extend your swap, but running memory-intensive applications, in a virtual machine, in swap... that's going to be slow.

Still, if you decide to try anyway, there are several Java virtual machines available for Optware, including PhoneME and JamVM. You'll need to install Optware/Ipkg on your Stora or whatever device you have. It's then simply a case of:

$ sudo ipkg update
$ sudo ipkg install jamvm

Note that the VM is called jamvm rather than java, so you need to replace this in the call to unpackmp4: jamvm -jar unpackmp4.jar [-i] source-path [dest-path]

Public Domain - Andrew Oakley - 2011-12-12

Top - More Broadcasting Articles - More  Computing Articles - Article Index - aoakley.com