Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Track length missing from metadata in flac [Solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
rndusr
Guru
Guru


Joined: 04 Dec 2005
Posts: 392

PostPosted: Tue Jun 08, 2010 4:42 pm    Post subject: Track length missing from metadata in flac [Solved] Reply with quote

Some of my music has incorrect metadata, specifically the track length is set to zero. I believe this is due to some bug in an old version of k3b that was used for the ripping.

Now I am looking for some utility that can correct this for all those files. The format is flac, and it is only the track length tag that needs to be corrected. Can anyone recommend some neat utility to this end?

I estimate that approximately 25-35 of my ripped albums are affected, and I see too much hassle re-ripping them.

Thanks in advance!
_________________
If you've got nothing nice to say, you're probably not alone...


Last edited by rndusr on Sat Jun 19, 2010 11:39 am; edited 1 time in total
Back to top
View user's profile Send private message
cdstealer
Guru
Guru


Joined: 30 Oct 2005
Posts: 431
Location: Leeds

PostPosted: Thu Jun 17, 2010 4:35 am    Post subject: Reply with quote

I'm not aware of any apps in the wild that will allow you to edit the STREAMINFO block of flac metadata.

It could get messy as you'll have to deal with both the file size, samples and MD5sum. I believe you would be able to just decode and recode the file without any data/quality loss. But then, if all your flac files are tagged, they would need retagging.
Back to top
View user's profile Send private message
rndusr
Guru
Guru


Joined: 04 Dec 2005
Posts: 392

PostPosted: Fri Jun 18, 2010 7:01 pm    Post subject: Reply with quote

Indeed, recoding would not affect quality, as flac is lossless.

I shall read through the flac man page, and see if I can make a script.

EDIT: It was much easier than I had thought. I came up with the following script:
Code:
#!/bin/sh

TITLE=$(metaflac "$1" --show-tag=title)
DATE=$(metaflac "$1" --show-tag=date)
ARTIST=$(metaflac "$1" --show-tag=artist)
ALBUM=$(metaflac "$1" --show-tag=album)
TRACKNUMBER=$(metaflac "$1" --show-tag=tracknumber)
TMPFILE="/tmp/$(date +%N).wav"
flac --decode "$1" --output-name="$TMPFILE"
flac "$TMPFILE" --force --best --output-name="$1" --tag="$ARTIST" --tag="$TITLE" --tag="$TRACKNUMBER" --tag="$DATE" --tag="$ALBUM"
rm -f $TMPFILE

I ran it recursively with the command
Code:
find ~ -name "*.flac" -exec ./fixflaclength.sh {} \;

_________________
If you've got nothing nice to say, you're probably not alone...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum