Monday, March 16, 2009

Encode video files for ipod-touch/iphone and T-Mobile G1/Andriod [Linux Hacks]

I posted an article back in February on how to re-encode movies for ipod and other pmp devices in linux, based on my mini_encoder.py script. I have a few more updates now to add to the script for your enjoyment. Release notes as follows:

-Now uses optparse python module for command line argument process handling
-New option for iphone/ipod-touch in addition to ipod-video and default modes
-Uses ffmpeg for processing ipod/iphone videos (H.264 and AAC codecs encoded to mp4 format)
-General code cleanup and slight re-factoring
-More verbose help options

The main takeaway from this version is that mini_encoder.py is now capable of resizing mpg or avi video files for your ipod-video, iphone/ipod-touch or even your T-Mobile G1/Android, in addition to any other pmp player that is capable of handling avi or mpg video streams.

The default resolution is 320x240, but for the iphone/ipod-touch and G1, it bumps it up to 480x320 to fit nicely on the screen and utilize the larger screen size. See the help option for more info


$ ./mini-encoder.py --help
./mini-encoder.py - Encodes and resizes video files (avi or mpg) to fit
small screen resolution pmp devices. Resolution and codec formulas:

default - 320x240 (preserves original codecs from source video file)
ipod - 320x240 (re-encodes to mp4 using H.264 and AAC codecs)
iphone - 480x320 (re-encodes to mp4 using H.264 and AAC codecs)

Supply a path to the movie file you wish to encode (required):
./mini-encoder.py [options] --movie /path/to/file.avi
Options:
--version Print the version number of this program
-m, --movie Path to video file you wish to encode
-p, --ipod Encodes to mp4 format for use with ipod-video
-i, --iphone Encodes to mp4 format for use with iphone/ipod-touch

Usage: mini-encoder.py [options]

Options:
--version show program's version number and exit
-h, --help show this help message and exit
-m INMOVIE, --movie=INMOVIE
Input video file to encode
-p, --ipod Encode to ipod-video format
-i, --iphone Encode to iphone/ipod-touch format

Example for encoding for iphone/ipod-touch:
./mini_encoder.py --iphone --movie /path/to/movie.avi


Requirements for running this program are:
1. A recent version of python
2. transcode package
3. ffmpeg package

Please feel free to download it and let me know what you think.

No comments:

Post a Comment