View previous topic :: View next topic |
Author |
Message |
rndusr Guru
Joined: 04 Dec 2005 Posts: 392
|
Posted: Tue Jun 08, 2010 4:42 pm Post subject: Track length missing from metadata in flac [Solved] |
|
|
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 |
|
|
cdstealer Guru
Joined: 30 Oct 2005 Posts: 431 Location: Leeds
|
Posted: Thu Jun 17, 2010 4:35 am Post subject: |
|
|
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 |
|
|
rndusr Guru
Joined: 04 Dec 2005 Posts: 392
|
Posted: Fri Jun 18, 2010 7:01 pm Post subject: |
|
|
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 |
|
|
|