IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
FLAC to Ogg
verloren
post Jul 25 2002, 20:33
Post #1





Group: Members
Posts: 156
Joined: 28-March 02
From: Hants, UK
Member No.: 1637



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
Go to the top of the page
+Quote Post
spoon
post Jul 25 2002, 21:01
Post #2


dBpowerAMP developer


Group: Developer (Donating)
Posts: 2724
Joined: 24-March 02
Member No.: 1615



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).


--------------------
Spoon http://www.dbpoweramp.com
Go to the top of the page
+Quote Post
Infophreak
post Jul 25 2002, 21:09
Post #3





Group: Members
Posts: 35
Joined: 20-June 02
Member No.: 2354



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 biggrin.gif


--------------------
Close the world - TXeN eht nepO
Go to the top of the page
+Quote Post
verloren
post Jul 25 2002, 21:11
Post #4





Group: Members
Posts: 156
Joined: 28-March 02
From: Hants, UK
Member No.: 1637



Looks good - thanks!
Go to the top of the page
+Quote Post
Emanuel
post Jul 25 2002, 22:10
Post #5





Group: Members
Posts: 284
Joined: 13-January 02
From: Sthlm, Sweden
Member No.: 999



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
Go to the top of the page
+Quote Post
john33
post Jul 25 2002, 22:42
Post #6


xcLame and OggDropXPd Developer


Group: Developer
Posts: 3726
Joined: 30-September 01
From: Bracknell, UK
Member No.: 111



Paul, a simple batch file like:
CODE
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/
Go to the top of the page
+Quote Post
jcoalson
post Jul 26 2002, 01:35
Post #7


FLAC Developer


Group: Developer
Posts: 1526
Joined: 27-February 02
Member No.: 1408



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
Go to the top of the page
+Quote Post
meff
post Jul 26 2002, 02:12
Post #8





Group: Members
Posts: 87
Joined: 10-January 02
Member No.: 976



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
#!/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";
}
Go to the top of the page
+Quote Post
Dezibel
post Jul 26 2002, 09:34
Post #9





Group: Members
Posts: 91
Joined: 7-March 02
Member No.: 1455



...and a little bit cleaner:

CODE
#!/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
Go to the top of the page
+Quote Post
Jon Ingram
post Jul 26 2002, 09:52
Post #10





Group: Members
Posts: 315
Joined: 29-September 01
Member No.: 53



All this Perl... my eyes are watering. Do none of you use a decent programming language?

wink.gif
Go to the top of the page
+Quote Post
Dezibel
post Jul 26 2002, 10:03
Post #11





Group: Members
Posts: 91
Joined: 7-March 02
Member No.: 1455



nope biggrin.gif

Dezibel
Go to the top of the page
+Quote Post
meff
post Jul 26 2002, 10:03
Post #12





Group: Members
Posts: 87
Joined: 10-January 02
Member No.: 976



QUOTE
Originally posted by Jon Ingram
All this Perl... my eyes are watering. Do none of you use a decent programming language?

wink.gif


Python laugh.gif
I rather code C# tongue.gif

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..
Go to the top of the page
+Quote Post
Dezibel
post Jul 26 2002, 10:10
Post #13





Group: Members
Posts: 91
Joined: 7-March 02
Member No.: 1455



QUOTE
Originally posted by meff
but I have the most fun with perl..


...yes!

Dezibel

--
tr "windolfs" "linux"
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th April 2014 - 05:02