FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 05-26-2012, 04:32 AM
Ian Pilcher
 
Default Cannot create MP3 with UTF-16LE tags

My script for creating MP3 files from FLAC files has broken in Fedora
17. Specifically, tags with accented characters are getting truncated
when I try to write them as UTF-16LE (which seems to be what most
players expect). The script, which I am attaching, worked fine when I
last used it in January back in January (presumably on Fedora 16).

Here is an example of what I'm seeing:

[pilcher@ian music]$ metaflac --show-tag=title track05.flac
title=Lento, rápido

[pilcher@ian music]$ flac2mp3 track05.{flac,mp3}

flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh
Coalson
flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions. Type `flac' for
details.

track05.flac: done
LAME 3.99.5 64bits (http://lame.sf.net)
polyphase lowpass filter disabled
Encoding <stdin> to track05.mp3
Encoding as 44.1 kHz j-stereo MPEG-1 Layer III VBR(q=0)

[pilcher@ian music]$ id3v2 -l track05.mp3
id3v2 tag info for track05.mp3:
TSSE (Software/Hardware and settings used for encoding): LAME 64bits
version 3.99.5 (http://lame.sf.net)
TIT2 (Title/songname/content description): Lento, r
TPE1 (Lead performer(s)/Soloist(s)): Unknown
TALB (Album/Movie/Show title): Spanish Schoolhouse
TRCK (Track number/Position in set): 5
TCON (Content type): Children's (255)
TLEN (Length): 118013
track05.mp3: No ID3v1 tag

You can see that the TIT2 tag has been truncated at the accented
character.

I am seeing exactly the same thing when I try to add the tag with id3v2.

I found a report of similar behavior in Debian here:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=655738

but my LANG is definitely set to en_US.UTF-8. (I verified that this is
true during script execution by adding an echo statement.)

Any ideas? (My wife is from Peru, so being unable to add songs with
accented characters in the title to her Squeezebox is really, really
important.)

Thanks!

--
================================================== ======================
Ian Pilcher arequipeno@gmail.com
"If you're going to shift my paradigm ... at least buy me dinner first."
================================================== ======================
#!/bin/bash

FLAC_FILE="$1"
MP3_FILE="$2"

ABSOLUTE_FLAC_FILE=`readlink -m "$FLAC_FILE"`
ART_FILE="${ABSOLUTE_FLAC_FILE%/*}/front.jpg"

TITLE=`metaflac --show-tag=title "$FLAC_FILE" | sed 's/^title=//' | iconv -f UTF-8 -t UTF-16LE`
ARTIST=`metaflac --show-tag=artist "$FLAC_FILE" | sed 's/^artist=//' | iconv -f UTF-8 -t UTF-16LE`
GENRE=`metaflac --show-tag=genre "$FLAC_FILE" | sed 's/^genre=//' | iconv -f UTF-8 -t UTF-16LE`
ALBUM=`metaflac --show-tag=album "$FLAC_FILE" | sed 's/^album=//' | iconv -f UTF-8 -t UTF-16LE`
TRACKNUMBER=`metaflac --show-tag=tracknumber "$FLAC_FILE" | sed 's/^tracknumber=//' | iconv -f UTF-8 -t UTF-16LE`

if [ -f "$ART_FILE" ]; then
flac -dc "$FLAC_FILE" | lame -V0 --id3v2-only --id3v2-utf16 --tt "$TITLE" --ta "$ARTIST" --tl "$ALBUM" --tn "$TRACKNUMBER" --tg "$GENRE" --ti "$ART_FILE" - "$MP3_FILE"
else
flac -dc "$FLAC_FILE" | lame -V0 --id3v2-only --id3v2-utf16 --tt "$TITLE" --ta "$ARTIST" --tl "$ALBUM" --tn "$TRACKNUMBER" --tg "$GENRE" - "$MP3_FILE"
fi
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
 
Old 05-26-2012, 05:58 AM
Ian Pilcher
 
Default Cannot create MP3 with UTF-16LE tags

On 05/25/2012 11:32 PM, Ian Pilcher wrote:
> My script for creating MP3 files from FLAC files has broken in Fedora
> 17. Specifically, tags with accented characters are getting truncated
> when I try to write them as UTF-16LE (which seems to be what most
> players expect). The script, which I am attaching, worked fine when I
> last used it in January back in January (presumably on Fedora 16).

New, working script attached for posterity.

--
================================================== ======================
Ian Pilcher arequipeno@gmail.com
"If you're going to shift my paradigm ... at least buy me dinner first."
================================================== ======================
#!/bin/bash

FLAC_FILE="$1"
MP3_FILE="$2"

ABSOLUTE_FLAC_FILE=`readlink -m "$FLAC_FILE"`
ART_FILE="${ABSOLUTE_FLAC_FILE%/*}/front.jpg"

TITLE=`metaflac --show-tag=title "$FLAC_FILE" | sed 's/^title=//'`
ARTIST=`metaflac --show-tag=artist "$FLAC_FILE" | sed 's/^artist=//'`
GENRE=`metaflac --show-tag=genre "$FLAC_FILE" | sed 's/^genre=//'`
ALBUM=`metaflac --show-tag=album "$FLAC_FILE" | sed 's/^album=//'`
TRACKNUMBER=`metaflac --show-tag=tracknumber "$FLAC_FILE" | sed 's/^tracknumber=//'`

# It doesn't seem to be possible to store UTF-16 strings in Bash variables, and LAME doesn't seem
# to be able to handle UTF-16 tags at all anymore. :-(

if [ -f "$ART_FILE" ]; then
flac -dc "$FLAC_FILE" | lame -V0 --ti "$ART_FILE" - "$MP3_FILE"
else
flac -dc "$FLAC_FILE" | lame -V0 - "$MP3_FILE"
fi

id3v2 -t "`echo $TITLE | iconv -f UTF-8 -t UTF-16LE`"
-a "`echo $ARTIST | iconv -f UTF-8 -t UTF-16LE`"
-g "`echo $GENRE | iconv -f UTF-8 -t UTF-16LE`"
-A "`echo $ALBUM | iconv -f UTF-8 -t UTF-16LE`"
-T "$TRACKNUMBER" "$MP3_FILE"
id3v2 -s "$MP3_FILE"
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
 

Thread Tools




All times are GMT. The time now is 04:31 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org