ipod-encoder 0.1
Arjan Scherpenisse <arjan@scherpenisse.net>
The ipod-encoder is a commandline tool for convenient encoding of video files for use on the new iPod video. It uses the ffmpeg tool.
- Features
-
- Encoding of single files
- Optional specification of a/v bitrates
- Recursively encode all files in a directory
- Generating a podcast.xml for convenient use in iTunes
The program can be used in a cronjob which periodically checks directories for new files and encodes them without user intervention.
- Options
--version show program's version number and exit
-h, --help show this help message and exit
-R, --recursive Process directories recusively
-f, --force Force re-encode existing iPod videos
-t, --test Only encode first 10 seconds, to produce test videos
-e EXTENSIONS, --extensions=EXTENSIONS
Comma separated list of input extensions. Default: avi
-i IPODEXT, --ipodext=IPODEXT
iPod extension. Default: .ipod.mp4
-b VIDEO_RATE, --video-rate=VIDEO_RATE
Video bit rate, in kbps (default: 1024)
-a AUDIO_RATE, --audio-rate=AUDIO_RATE
Audio bit rate, in kbps (128)
-W WIDTH, --width=WIDTH
Video width, in pixels (default: 320)
-H HEIGHT, --height=HEIGHT
Video height, in pixels (default: 240)
-P, --pretend Do not really encode, just print out the ffmpeg
commands which would be executed
-v, --verbose Enable verbose output
Podcast options:
-p, --podcast Generate a podcast.xml file for each directory.
--podcast-documentroot=PODCAST_DOCUMENTROOT
Podcast document root; eg. /var/data/Movies/
--podcast-baseurl=PODCAST_BASEURL
Podcast base URL; eg. http://localhost/
If podcasting is enabled, the directory of the encoded files must be a subdirectory of the podcast documentroot. A web server is supposed to be running at the podcast base URL, serving files from the podcast document root.
So, the following command:
ipod-encoder -R -p --podcast-documentroot=/var/data/Movies --podcast-baseurl=http://localhost/ /var/data/Movies
would generate:
/var/data/Movies/Movie1.avi --> becomes /var/data/Movies/Movie1.ipod.mp4 /var/data/Movies/subdir/Movie2.avi --> becomes /var/data/Movies/subdir/Movie2.ipod.mp4 ...etc..
and /var/data/Movies/podcast.xml would contain references to:
http://localhost/Movie1.ipod.mp4
http://localhost/subdir/Movie2.ipod.mp4
...
DEFAULT OPTIONS
At startup, the program tries to read the file $HOME/.ipod-encoder file, for parsing default options. In this file, default options can be specified which you want to have for all calls to ipod-encoder.
The .ipod-encoder options file is in standard Python dictionary format:
{ "key": "value"
[, "key": "value" [, "key": "value"]] ...
}
The options you can use in this file are equal to the 'long' options on the commandline, only the dashes in the names are replaced by underscores. Note that numeric values (width, height, ...) should NOT contain quotes. An example .ipod-encoder file can contain the following:
{
"width": 480,
"height": 360,
"podcast_baseurl": "http://www.podcast.com/"
}
Subsequent calls to ipod-encoder would produce 480x360 files instead of the default 320x240.
Windows users:
You have to set the HOME environment variable to the directory you store the .ipod-encoder file in, otherwise the .ipod-encoder file cannot be read.
To set the HOME variable in Windows, do the following: Right click on My Computer, choose 'properties'. Choose the Advanced tab, and click on the Environment Variables button. In the next dialog you see a list titled 'user variables for <username>'. Click 'new', and enter HOME as the variable name, and the directory you stored the .ipod-encoder file in as the variable value. Click OK. Open a command prompt, and type "echo %HOME%" to verify that the variable is set.
