Help - Search - Members - Calendar
Full Version: FLAC to Vorbis in linux
Hydrogenaudio Forums > Lossless Audio Compression > FLAC
metrom
Is it possible to transcode from flac (with oggtags) to vorbis in console (linux) and not loosing the oggtags?
Almost like Oggifier for windows without the GUI? smile.gif


metrom
kjoonlee
If you compile the CVS version of oggenc 'successfully,' then it should work. You'll need all the relevant development libraries, including those for FLAC.

I've never been able to do that on my system though.
Slo Mo Snail
The cvs version of oggenc does not support FLAC
you need the patch from http://www.ph.utexas.edu/~volsung/patches/

btw... the tags are called vorbiscomments and not oggtags as they aren't implemented into the ogg layer
kjoonlee
Oops. I stand corrected.

I asked volsung himself about this, and he says the patches will be merged into CVS. He was gracious to say that he'll tell me when it's done.

Sorry for the incorrect information, have a nice day. : )
dch
Strangely enough I wrote a shell script to do this a few days ago. Here it is.

CODE

#!/bin/bash

set -e

while [ -n "$1" ]
do
 out=$(basename $1 | sed 's/flac$/ogg/')
 flac -sdc "$1" | oggenc -q 6 -o "$out" -
 metaflac --export-vc-to=- "$1" | grep -v ^REPLAYGAIN_ |
 vorbiscomment -w "$out" "$out".tmp.$$ &&
 mv "$out".tmp.$$ "$out"
 shift
done
dem
Also strangely, I too wrote a Perl script last week to do the same thing. It generates Ogg Vorbis files if run as "flac2ogg", or MP3's if run as "flac2mp3", moving the tags in either case. I recently started ripping everything to FLAC, though I "compile" the files to MP3 for use with an Audiotron.

CODE

#!/usr/bin/perl
#
# flac2ogg / flac2mp3
#
# Converts FLAC files to Ogg Vorbis or MP3, depending on how
# this file is named.
#
# The encoded file is placed in the current directory, or optionally
# the directory specified with the -d option.
#
# Requires "metaflac", "oggenc", and "lame".

# MP3 quality setting
$preset = "standard";

# Ogg Vorbis quality setting
$q = "6";


use Getopt::Std;
use File::Basename;
use File::Spec;

$myname = (File::Spec->splitpath($0))[2];

getopts('td:', \%opt);

$dest = $opt{'d'} || ".";
$test = $opt{'t'} || 0;


# Convert each file name given on the command line.
while ($file = shift) {
   ($base, $path, $type) = fileparse($file, qr{\..*});
   next unless ($type eq '.flac');

   # Read in the tags
   %tags = ();
   open(METAFLAC, "metaflac --export-vc-to=- $file |") || die;
   while (<METAFLAC>) {
       chop;
       ($key, $value) = split('=');
       $tags{uc($key)} = $value;
   }
   close(METAFLAC);

   $flac = "flac -d -c -s $file";

   if ($myname eq "flac2ogg") {
       $tags = "\"=oggenc -q $q\"";
       foreach $key (sort (keys %tags)) {
           $tags .= " -c \"$key=$tags{$key}\"";
       }

       $encode = "oggenc -o $dest/$base.ogg -q $q -Q -c $tags -";
   }
   elsif ($myname eq "flac2mp3") {
       $tags  = "--ta \"$tags{'ARTIST'}\" "      if ($tags{'ARTIST'});
       $tags .= "--tl \"$tags{'ALBUM'}\" "       if ($tags{'ALBUM'});
       $tags .= "--tt \"$tags{'TITLE'}\" "       if ($tags{'TITLE'});
       $tags .= "--ty \"$tags{'DATE'}\" "        if ($tags{'DATE'});
       $tags .= "--tg \"$tags{'GENRE'}\" "       if ($tags{'GENRE'});
       $tags .= "--tn \"$tags{'TRACKNUMBER'}\" " if ($tags{'TRACKNUMBER'});
       $tags .= "--tc \"lame --preset $preset\"";
       
       $encode = "lame --quiet --preset $preset $tags - $dest/$base.mp3";
   }
   else {
       exit 1;
   }

   if ($test) {
       print "$flac | $encode\n";
   }
   else {
       system("$flac | $encode");
   }
}

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.