The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

iPod::Squish - Convert songs on an iPod in place using lame or FFmpeg::Command.

SYNOPSIS

        use iPod::Squish;

        my $squisher = iPod::Squish->new(
                volume => "/Volumes/iPod Name"
                target_bitrate => 128,
        );

        $squisher->run;

DESCRIPTION

This module uses lame or FFmpeg::Command to perform automatic conversion of songs on an iPod after they've been synced.

Since most headphones are too crappy to notice converting songs to a lower bitrate is often convenient to save size.

Only files with a bitrate over target_bitrate will be converted.

Currently only MP3 files will be converted and the output format is MP3 as well. AAC support would be nice, see "TODO".

A tip to sync more data than iTunes is willing is to do it in several steps by using a smart playlist and limiting the number of songs in the playlist by the number of free megabytes on the player. Then you can run the squishing script, and repeat ad nauseum.

ATTRIBUTES

volume

The mount point of the iPod you want to reencode.

target_bitrate

The bitrate to encode to.

Only songs whose bitrate is higher than this will be encoded.

use_lame

Use the lame command directly instead of FFmpeg::Command.

Defualts to true if lame is in the path, because it's more flexible than lame through ffmpeg.

Note that using lame is generally slower for the same target_bitrate because of the -h flag passed to lame.

jobs

The number of parallel lame instances to run. Defaults to 2. Useful for multi processor or multi core machines.

METHODS

run

Do the conversion by recursing through the iPod's music directory and running process_file for each file (possibly in parallel, see jobs).

process_file $file

Attempt to convert the file, and if conversion succeeds replace the original with the new version.

The file will only be converted if its an MP3.

reencode_file $file

Does the actual encoding/move of the file.

LOGGING

This module uses MooseX::LogDispatch, which in turn uses Log::Dispatch::Config. This allows you to control logging to your heart's content. The default is to just print the messages to STDERR.

TODO

VBR

I'm not quite sure how to specify varible bitrate for ffmpeg. Should look into that.

m4a

Support m4a type AAC files (I don't think ffmpeg allows this, but I'm not quite sure). Encoding to AAC definitely is supported.

format consolidation

Check if an iPod will swallow files in a format different than the name/library entry implies.

If not, try to use rewrite library entries, as long as this doesn't affect synchronization.

Perhaps look at Mac::iPod::DB for details.

OSX agent integration

Using an app called Lingon (http://lingon.sourceforge.net/) you can easily create an agent that will run every time a disk is mounted.

My entry is:

        nice /usr/local/bin/perl -I /Users/nothingmuch/Perl/iPod-Squish/lib /Users/nothingmuch/Perl/iPod-Squish/script/isquish

Because the script loops until no more songs are converted, and copying is likely faster than encoding it should generally Just Work™ automatically.

Make sure you have lame or ffmpeg in the path, and if you want lame to STFU then set TERM to something as well.

This can be done by using

        env TERM=xterm-color PATH=...

to actually run the script.

SEE ALSO

FFmpeg::Command, Audio::File, Mac::iPod::DB,

VERSION CONTROL

This module is maintained using Darcs. You can get the latest version from http://nothingmuch.woobling.org/code, and use darcs send to commit changes.

AUTHOR

Yuval Kogman <nothingmuch@woobling.org>

COPYRIGHT

        Copyright (c) 2008 Yuval Kogman. All rights reserved
        This program is free software; you can redistribute
        it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 336:

You forgot a '=back' before '=head1'