For an iphone, I imagine that a 128kbps MP3 would be perfectly adequate. After all, what equipment do you plan to hook up to the iphone? I think that MP3 files between 128 kpbs and 192 kbps is an optimal point of sound quality to file size.
You'll need 4 programs (in Linux, at least): flac (to extract the audio info from FLAC files), metaflac (to extract tags from FLAC files), lame (to encode MP3 files), and id3v2 (to tag the MP3 files).
Using Linux, you would execute a command such as:
flac -d -o - "FLAC_FILENAME_HERE" | lame -b MP3_BITRATE_HERE -h - > "MP3_FILENAME_HERE"
Then, to copy the tags (this example is a subroutine in Perl that accepts thet FLAC and MP3 filenames as parameters and copies the pertinent tags from the FLAC file to the MP3 file):
sub copy_tag_data
{
my $FLAC_filename = shift;
my $MP3_filename = shift;
my %tags;
my $tag_parameter;
# Read FLAC file tags
$tags{'title'} = `metaflac --show-tag=TITLE "$FLAC_filename"`;
$tags{'artist'} = `metaflac --show-tag=ARTIST "$FLAC_filename"`;
$tags{'album'} = `metaflac --show-tag=ALBUM "$FLAC_filename"`;
$tags{'genre'} = `metaflac --show-tag=GENRE "$FLAC_filename"`;
$tags{'tracknumber'} = `metaflac --show-tag=TRACKNUMBER "$FLAC_filename"`;
$tags{'date'} = `metaflac --show-tag=DATE "$FLAC_filename"`;
$tags{'ensemble'} = `metaflac --show-tag=ENSEMBLE "$FLAC_filename"`;
$tags{'composer'} = `metaflac --show-tag=COMPOSER "$FLAC_filename"`;
foreach $tag_parameter (keys %tags)
{
# Strip the "TAG=" part out
$tags{$tag_parameter} =~ s|^.*?=||;
# Get rid of double quotes or backtics
# (convert them to single quotes)
$tags{$tag_parameter} =~ s|[\"\`]|\'|g;
# Remove trailing newlines
chomp ($tags{$tag_parameter});
}
# Now write these tags to the MP3 file
`id3v2 --song \"$tags{'title'}\" --artist \"$tags{'artist'}\" --album \"$tags{'album'}\" --TCON \"$tags{'genre'}\" --TRCK \"$tags{'tracknumber'}\" --TCOM \"$tags{'composer'}\" --TYER \"$tags{'date'}\" "$MP3_filename"`;
}
I hope that helps!
Michael
You'll need 4 programs (in Linux, at least): flac (to extract the audio info from FLAC files), metaflac (to extract tags from FLAC files), lame (to encode MP3 files), and id3v2 (to tag the MP3 files).
Using Linux, you would execute a command such as:
flac -d -o - "FLAC_FILENAME_HERE" | lame -b MP3_BITRATE_HERE -h - > "MP3_FILENAME_HERE"
Then, to copy the tags (this example is a subroutine in Perl that accepts thet FLAC and MP3 filenames as parameters and copies the pertinent tags from the FLAC file to the MP3 file):
sub copy_tag_data
{
my $FLAC_filename = shift;
my $MP3_filename = shift;
my %tags;
my $tag_parameter;
# Read FLAC file tags
$tags{'title'} = `metaflac --show-tag=TITLE "$FLAC_filename"`;
$tags{'artist'} = `metaflac --show-tag=ARTIST "$FLAC_filename"`;
$tags{'album'} = `metaflac --show-tag=ALBUM "$FLAC_filename"`;
$tags{'genre'} = `metaflac --show-tag=GENRE "$FLAC_filename"`;
$tags{'tracknumber'} = `metaflac --show-tag=TRACKNUMBER "$FLAC_filename"`;
$tags{'date'} = `metaflac --show-tag=DATE "$FLAC_filename"`;
$tags{'ensemble'} = `metaflac --show-tag=ENSEMBLE "$FLAC_filename"`;
$tags{'composer'} = `metaflac --show-tag=COMPOSER "$FLAC_filename"`;
foreach $tag_parameter (keys %tags)
{
# Strip the "TAG=" part out
$tags{$tag_parameter} =~ s|^.*?=||;
# Get rid of double quotes or backtics
# (convert them to single quotes)
$tags{$tag_parameter} =~ s|[\"\`]|\'|g;
# Remove trailing newlines
chomp ($tags{$tag_parameter});
}
# Now write these tags to the MP3 file
`id3v2 --song \"$tags{'title'}\" --artist \"$tags{'artist'}\" --album \"$tags{'album'}\" --TCON \"$tags{'genre'}\" --TRCK \"$tags{'tracknumber'}\" --TCOM \"$tags{'composer'}\" --TYER \"$tags{'date'}\" "$MP3_filename"`;
}
I hope that helps!
Michael