Skip to main content

Topic: FLAC to Ogg (Read 3939 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • verloren
  • [*][*][*]
FLAC to Ogg
I'm looking for suggestions of the easiest way to transcode between FLAC and Ogg.  I really like OggDropXPd, so anything similarly straightforward would be great.

Cheers, Paul
--
Rarewares mirror at http://audio.ciara.us/rarewares

  • spoon
  • [*][*][*][*][*]
  • Administrator
FLAC to Ogg
Reply #1
dBpowerAMP Music Converter - with the Ogg Codec (now Version 1) and FLAC (now 1.0.3) from codec central on my site, it will keep your ID tags - and even map the correct tag name (Ogg has different ones for Track Number than the rest of the world).

FLAC to Ogg
Reply #2
IIRC, there is a FLAC commandline decoder. Under the assumption that it is called "flacdec" (probably wrong, but you get the point), which decodes a FLAC compressed file to console (not to a file), a usable commandline would be:

flacdec "filename.wav" | oggenc -q 5 -o "output.ogg" -

obviously, you'd need flacdec and oggenc to be in your path (/bin, /usr/bin, c:winnt or whatever your current OS likes)

for doing the same to multiple FLAC files under windows, try the following:

for %f in (*.flac) do flacdec "%f" | oggenc -q 5 -o "%f.ogg" -

the only problem with this command is that you get a bunch of files named .flac.ogg, but that's nothing a short perl-script can't fix.

If the windows commandline supported escaped characters (fat chance that'll ever be impletmented), i'd write:

for %f in (*.flac) do flacdec "%f" | oggenc -q 5 -o "%fbbbbogg" -

but alas, the commandline has gotten worse and worse ever since win98 :

if you are running a pre win2k version of windows, you might need to do a LFNFOR ON in the console first.

feel free to use any other quality parameter, that you like
Close the world - TXeN eht nepO

  • verloren
  • [*][*][*]
FLAC to Ogg
Reply #3
Looks good - thanks!

  • Emanuel
  • [*][*][*][*]
FLAC to Ogg
Reply #4
OggdropXPd uses libsndfile for handling file formats. The author Erik wrote that he will have some work to do until 1.0.0rc3 is finished. Version 1.0.0 will follow soon after, and then he will have a look at FLAC support. I hope John33 will have the serious look at FLAC support as he stated on the thread here:
http://www.hydrogenaudio.org/forums/showth...ht=oggdrop+flac

Spoon: I do like your app! I think the more support FLAC and Vorbis will get, it's for the better.

Emanuel

  • john33
  • [*][*][*][*][*]
  • Developer
FLAC to Ogg
Reply #5
Paul, a simple batch file like:
Code: [Select]
rem Usage: flac2ogg quality (like 0, or 6.25) input file name

@echo off

flac.exe -s -d -c %2 | oggenc.exe -q %1 - -o %2.ogg

will process one at a time.
John
----------------------------------------------------------------
My compiles and utilities are at http://www.rarewares.org/

  • jcoalson
  • [*][*][*][*][*]
  • Developer
FLAC to Ogg
Reply #6
Quote
Originally posted by verloren
I'm looking for suggestions of the easiest way to transcode between FLAC and Ogg.  I really like OggDropXPd, so anything similarly straightforward would be great.


You might also look into sonice

Josh

  • meff
  • [*][*]
FLAC to Ogg
Reply #7
heres my nix code for flac -> mpp
you can easily modify it for ogg

a bit hackish though i wrote it very quickly awhile ago..

convertflactompp.pl
Code: [Select]
#!/usr/bin/perl -w
#
# quick&dirty.
# convert flac's in specified directory to mpp(mpc).
# rodney "meff" gordon ii.
#
# sat9feb 7.01pm 2002
#

use strict;

if(!defined($ARGV[0]) || !defined($ARGV[1])) {
       print "not enough arguments.n";
       print "runopts: ./thisexec srcdir dstdirnnsucks from src and spits into dst.n";
       exit;
}

my @flacs;

# set this to a dir with lots of space (holds uncompressed wavs)
my $tmpDir = '/home/meff/tmp/';

my $srcDir = $ARGV[0];
my $dstDir = $ARGV[1];

# sanity checks
unless(-d $srcDir && -d $dstDir) {
       print "either src or dst dir does not exist.n";
       exit;
}

# read in the files, sort out the flacs
opendir(DIR, $srcDir);
my @dirRead = readdir(DIR);
closedir(DIR);
foreach(@dirRead) {
       if($_ =~ m/.flac$/) {
               push(@flacs, $_);
       }
}


##
## CORE
##

# main loop
foreach(@flacs) {
       ConvertToMpp($_);
}
exit;


sub ConvertToMpp {
       my $flac = shift;

       # generate the names
       my $flacWav = $flac;
       my $flacMpp = $flac;
       $flacWav =~ s/.flac/.wav/;
       $flacMpp =~ s/.flac/.mpc/;

       print "converting $srcDir/$flac to $tmpDir/$flacWav" . "...n";
       system("flac -d -o "$tmpDir/$flacWav" "$srcDir/$flac"");
       print "n";

       print "encoding $tmpDir/$flacWav to $dstDir/$flacMpp" . "...n";
       system("mppenc --xtreme "$tmpDir/$flacWav" "$dstDir/$flacMpp"");
       print "n";

       print "cleaning up...n";
       system("rm "$tmpDir/$flacWav"");
       print "n";

       print "$srcDir/$flac conversion to $dstDir/$flacMpp complete.n";
}

  • Dezibel
  • [*][*]
FLAC to Ogg
Reply #8
...and a little bit cleaner:

Code: [Select]
#!/usr/bin/perl



# flac2ogg Version 0.2

# Copyright (C) 2002 Dezibel <dezibel@email.com>





my $flac = "flac";         # replace with 'C:Programmeflac.exe' for windows

my $encoder = "oggenc";    # replace with 'C:Programmeoggenc.exe' for windows

my $comline = "-q6";       # replace with your commandline





if($ARGV[0] eq '') { die "nno path given! try "flac2ogg <path>"nn"; }



chdir("$ARGV[0]") or die "ncan't change to $ARGV[0]!nn";

@flacs = glob("*.flac");



foreach(@flacs) {

   @name = split /./, $_;

   rename("$_", "tmp.flac");

   system("$flac -d tmp.flac");

   rename("tmp.flac", "$_");

   system("$encoder $comline tmp.wav");

   unlink("tmp.wav");

   rename("tmp.ogg", "$name[0].ogg");

}



print "nall jobs done!nn";


put this code to an file "flac2ogg"
change ther rights from this file: "chmod ugo+x flac2ogg"
and copy this file as root to "/usr/bin/flac2ogg"

to transcode: flac2ogg <path> (the destinations files are in source path)

edit: little modifications for portability.

Dezibel

  • Jon Ingram
  • [*][*][*][*]
FLAC to Ogg
Reply #9
All this Perl... my eyes are watering. Do none of you use a decent programming language?


  • Dezibel
  • [*][*]
FLAC to Ogg
Reply #10
nope

Dezibel

  • meff
  • [*][*]
FLAC to Ogg
Reply #11
Quote
Originally posted by Jon Ingram
All this Perl... my eyes are watering. Do none of you use a decent programming language?



Python
I rather code C#

Well, perl, php.. i386 and sparc asm, and c.. and various shell languages, all have ups and downs, but I have the most fun with perl..

  • Dezibel
  • [*][*]
FLAC to Ogg
Reply #12
Quote
Originally posted by meff
but I have the most fun with perl..


...yes!

Dezibel

--
tr "windolfs" "linux"