Help - Search - Members - Calendar
Full Version: oggenc2 batch file?
Hydrogenaudio Forums > Lossy Audio Compression > Ogg Vorbis > Ogg Vorbis - Tech
vacoradio
Hello everyone!!

I have a little problem, I have about 20 shows that are in Flac format that I would like to convert to Ogg format. I would rather not type all the file names or drag each show to the executable.

so I would like to write a batch file for windows/dos to do this. but i am having some problems with it. I have tried a few different routes, wildcards, redirecting output, piping, and none have seemed have worked, i even tried so unix type commands(i have the gnu windows port).

Here are some examples of what i tried:

CODE


oggenc2 *.flac

dir /b > oggenc2

dir /b | oggenc2

ls *.flac | cat > oggenc2

ls *.flac > oggenc2

ls *.flac | cat > files.txt
files.txt > oggenc2



i dont knwo what else to try to convert multiple files with out drag-n-droping or typing all the file names on the command line.

Any help or idea would be great!!

Thank YOU!!!

hangman
How about:

for %%f in (*.flac) DO (oggenc2.exe "%%f" "%%~nf.ogg")
Synthetic Soul
It looks like you were attempting to pipe from FLAC to OGGENC.

The format there would be:

CODE
FLAC --decode --stdout file.flac | OGGENC2 - file.ogg

... but as hangman subtely points out, OGGENC will take FLAC as an input file, so no need to pipe decoded data.

NB: If you have your files tagged and want to copy over the tags you may do best to use foobar, or maybe use Tag as a second process, e.g.:

CODE
FOR %%f IN (*.flac) DO (OGGENC2.EXE "%%f" "%%~nf.ogg" && TAG.EXE --fromfile "%%f" "%%~nf.ogg")
john33
As mentioned above, it will take the FLAC files as direct input, and will also copy the FLAC tags. smile.gif
Synthetic Soul
I did wonder. That's cool. smile.gif
gameplaya15143
is there any reason to even bother with a batch file?

this task would be much easier IMO with dBpowerAMP or foobar2000 unsure.gif
Deep_Elem
Or try out Speek's multi-frontend to make the batchfile for you.
Synthetic Soul
With a batch file you can just drag a folder onto the icon (or a shortcut) and all FLAC files within the folder will be converted, with no middle-tier overhead.

I don't see how you can get easier than that.

Come to think of it, oggdropXPd springs to mind. smile.gif
Deep_Elem
Dang, I should have mentioned oggdropxpd - an excellent suggestion!
Deep_Elem
If you are still interested in the batchfile idea, here's some code for you. Put the batchfile inside the folder that contains all your flac folders and it will recursively go through each folder and convert the flac files to ogg, without deleting:



@echo off
for /D %%D in (*.*) do call :convert "%%D"

vorbisgain -ar "*.ogg"
goto :EOF

:convert
pushd "%1"
for %%F in (*.flac) do oggenc2 -q6 -p4 "%%F"
popd


After converting, this will apply album replaygain to each folder recursively if you have vorbisgain.exe in your system path. Delete the vorbisgain line if you don't need it. Note that it uses quality 6 (-q6) and adds 4KB of padding (-p4) for tags. You can change that, of course. If your flac files are already fully tagged and replaygained you probably won't need the padding.

Make sure none of your flac files have an exlamation mark in the file name as this will cause oggenc2.exe to skip over it.

Hope this helps. smile.gif
manuelator
Nice batch, but you know how to do with subfolders?

Thanks
Deep_Elem
Yes it can be modified to put the output files into subfolders. Where would you like the subfolders exactly? Inside each flac folder, or somewhere else?
VEG
CODE
lame --quiet --decode "%~dpn1.mp3" - | oggenc -q0 -o "%~dpn1.ogg" -
Isn't working correctly with rarewares build of lame:(
CODE
c:\Temp>lame --quiet --decode test.mp3 - | oggenc -o test.ogg -
Opening with wav module: WAV file reader
Encoding standard input to
        "test.ogg"
at quality 3,00
       [  1,9%] [24m22s remaining] |/

Done encoding file "test.ogg"

       File length:  3m 48,0s
       Elapsed time: 0m 28,0s
       Rate:         8,1726
       Average bitrate: 107,5 kb/s
john33
It's the progress indicator that's wrong, the output is correct.
VEG
QUOTE(john33 @ Feb 11 2006, 01:22 PM)
It's the progress indicator that's wrong, the output is correct.
*


Please try to listen end of encoded file.
john33
Yep, I detect a spike at the end of the ogg file which is not present on the original mp3, nor on the wave file produced by decoding the mp3.

Edit: On further examination, a particular ogg file has acquired an additional 11 samples at the end that are not on the mp3 file, not on the decoded mp3 file, nor are they on a decoded mp3 written as a wave file via stdout, so it doesn't, at first glance, look like lame is the offending link in this chain. Further research obviously needed!! blink.gif

Edit 2: The problem is lame. When writing output via the pipe, it is attempting to rewrite the wave header at the end of file. I have confirmed this by disabling the rewrite and the resulting ogg file is of the correct length, in samples, and does not contain the glitch. I'll look further into providing a proper fix.
john33
QUOTE(john33 @ Feb 12 2006, 02:33 PM)
Yep, I detect a spike at the end of the ogg file which is not present on the original mp3, nor on the wave file produced by decoding the mp3.

Edit: On further examination, a particular ogg file has acquired an additional 11 samples at the end that are not on the mp3 file, not on the decoded mp3 file, nor are they on a decoded mp3 written as a wave file via stdout, so it doesn't, at first glance, look like lame is the offending link in this chain. Further research obviously needed!! blink.gif

Edit 2: The problem is lame. When writing output via the pipe, it is attempting to rewrite the wave header at the end of file. I have confirmed this by disabling the rewrite and the resulting ogg file is of the correct length, in samples, and does not contain the glitch. I'll look further into providing a proper fix.
*


Following a quick PM exchange with Gabriel, I will be reporting this as a bug on the LAME lists. In the meantime, I will post a fixed version at Rarewares later today pending the official fix.
john33
lame 3.97b2 and 3.98a3 fixed executables are now at Rarewares. smile.gif
VEG
Thank you!
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.