You are not logged in.

#26 2010-07-21 20:18:07

Hantabaru
Member
Registered: 2009-02-25
Posts: 58

Re: [SOLVED] Converting flac to ogg loses tagging info

Army wrote:

I usually use this script

oggenc -q6 *.flac
mv *.ogg /path/to/my/rockbox

(kinda)
Works!

Thanks but really want it to .create the folder ./artist/album/ automatically

Last edited by Hantabaru (2010-07-21 20:20:41)

Offline

#27 2010-07-21 20:20:21

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [SOLVED] Converting flac to ogg loses tagging info

Hantabaru wrote:

The script i was talking about was for batch converting lots of flac files and the one supplied by Foucault worked well.

Batch converting is as easy as running

oggenc -q 6 *flac

A script for something like that is overkill. If you're lazy, you could add set an alias for that. But a script...

I hope the info you got from this thread gets your problem solved though wink.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#28 2010-07-21 20:23:54

Hantabaru
Member
Registered: 2009-02-25
Posts: 58

Re: [SOLVED] Converting flac to ogg loses tagging info

.:B:. wrote:
Hantabaru wrote:

The script i was talking about was for batch converting lots of flac files and the one supplied by Foucault worked well.

Batch converting is as easy as running

oggenc -q 6 *flac

A script for something like that is overkill. If you're lazy, you could add set an alias for that. But a script...

I hope the info you got from this thread gets your problem solved though wink.

D'oh!

Obviously, this is the simplest solution...

Yes, got all the info I needed...have marked thread as solved.

Offline

#29 2012-03-24 15:08:55

cedricmc
Member
From: Valencia, Spain
Registered: 2011-11-20
Posts: 62

Re: [SOLVED] Converting flac to ogg loses tagging info

Foucault wrote:

...

...
title=`metaflac --show-tag="title" "$file.flac" | sed "s/title=//"`
...

flac -c -d "$file.flac" | oggenc -t "$title" -a "$artist" -G "$genre" -l "$album" \
 -d "$date" -n "$track" -o $file.ogg -q $qual -

The tag fields in sed may should be capitalized ("TITLE" and not "title").

Also there are double quotes missing in the last call to "$file".

Thx for the script.

Offline

#30 2013-02-12 17:50:37

DexterLB
Member
Registered: 2011-06-20
Posts: 51

Re: [SOLVED] Converting flac to ogg loses tagging info

The script in the above posts has a disadvantage - it doesn't copy all tags, only the ones that are specified. After reading some manpages, I found out that metaflac --export-tags-to can be used with vorbiscomment to transfer all the tags.
However, after some testing, it turned out that metaflac supports neither escaping nor \0-terminated output, so I had to process tags one by one.

This script will copy most tags correctly, even if they have newlines (lyrics etc); it will however break on tags that contain null characters or lines starting with "foo=". If someone has an idea how to fix this, please share

#!/bin/bash
inf=${1}
outf=${2}
if [[ -z ${quality} ]]; then
    quality=7
fi

echo "   File: $inf"

flac -scd "$inf" | oggenc -o "$outf" -q ${quality} -

metaflac "$inf" --export-tags-to=- \
    | perl -ne 'if (m/^([\w]+)\=/) {print "$1\n"}' \
    | while read tag; do
        metaflac "$inf" --show-tag="$tag" \
            | perl -0777pe 's/\n$//;s/\//\/\//g;s/[\n\r]/\\n/g;s/(.)$/$1\n/'
    done | vorbiscomment -ea "$outf"

The best solution to a problem is usually the easiest one.

Offline

Board footer

Powered by FluxBB