You are visitor number
since Feb. 2006
UnpackMP4 AVI (shortname: UnpackMP4) is a Java rewrite of UnpackCL (written in C# by moitah). UnpackCL is a command line version of the excellent MPEG4Modifier tool (again, written in C# by moitah) that's used to detect and unpack AVIs that are encoded in DivX or XviD and have packed bitstream. Unpacking is useful when you want to play the AVI on many standalone players, since AVI with packed bitstream play as if they were recorded at 10fps (they look jumpy).
UnpackMP4 version 1.2 is based on UnpackCL v1.1.2 and has the exact same functionality except for the following:
You may download the executable JAR file or a zipped source of UnpackMP4. The source comes as an Eclipse 3.1 project.
If you choose to download and view the source, please remember this is a rough port from C#, hence many of the names start with an upper-case letter, which is against the Java standard
Depending on the arguments, UnpackMP4 can be used to unpack (or check) a single file or multiple files. To unpack a single file, use the following arguments:
java -jar unpackmp4.jar [-i] source-path [dest-path]
In this case, the arguments are the same as in UnpackCL:
-i | Display detailed information about the video. |
source-path | The path of the avi file to be unpacked. In the file is already unpacked, nothing will be performed. |
dest-path | The path of the avi file to be created (the unpacked version). If this path is not specified, UnpackMP4 will just check if the source-path is unpacked or not. |
To unpack (or check) multiple files, use the following arguments:
java -jar unpackmp4.jar [-i] [-s suffix] [-d dest-folder] [-c] source-path1 source-path2 ...
The -i argument works as before, and in addition:
-s suffix | Process all specified files, derive the unpacked file names
by appending suffix to the original file name. If the file name ends with .avi the suffix will
be added before the .avi. For example, if we use -s .unpack, mymovie will be
unpacked into mymovie.unpack, and hismovie.avi will be unpacked into hismovie.unpack.avi |
-d dest-folder | Process all specified files, and store the unpacked files i the
dest-folder folder. |
-c | Check all files and report if they are packed or not. Do not unpack. |
source-path1 source-path2 ... | The list of files to unpack or check. Wildcards are not allowed
but fortunately, using (for example) *.avi in bash (and other shells, I assume) translates to the list
of all files, so it works in Linux (and possibly other Unix flavors) using a little help from the shell. |
While converting to Java, I tried to improve performance to sweeten the deal of those who already use the wonderful UnpackCL (like myself) and consider switching to UnpackMP4. The result is presented in the following table:
| Test | UnpackCL on Windows | UnpackMP4 on Windows | UnpackMP4 on Linux |
|---|---|---|---|
| Unpack 5 packed files, 350MB each, using 5 calls within a bat/sh file | 0:05:51.7 | 0:03:00.9 | 0:03:36.7 |
| Check 5 packed files, 350MB each, using 5 calls within a bat/sh file | 0:00:50.7 | 0:00:50.1 | 0:01:16.9 |
Notes:
For those who care (probably not too many), here are some notes regarding the conversion from C# to Java:
RandomAccessFile is notoriously slow.
I noticed that in most cases the file access is sequential, so I wrote a wrapper that buffers reads and writes to improve I/O
performance. The same trick might be used to improve the C# code (If random access is also slow there).