Help - Search - Members - Calendar
Full Version: Trying to build ogg encoder
Hydrogenaudio Forums > Lossy Audio Compression > Ogg Vorbis > Ogg Vorbis - General
Seymour Clufley
Hi,

I'm making a program that allows the user to choose audio files on their computer and the program converts the files to OGG. I've been using OggEnc 2, controlled by command line.

It works fine with the usual OggEnc formats - raw, wav and aiff - and the lossless formats that you can get codecs for at RareWares (flac, ape, lpac etc.).

But is there any way to increase the number of input formats? I've been googling for OggEnc addons and plugins but can't find any.

If not, what would be necessary to increase the number of formats? Is there a more versatile encoder than OggEnc?

And one final question. Would it be legal for me to charge for a program that uses OggEnc as a separate exe, as described above?

Thanks for any advice,
Seymour.


PS. I confess to being a total amateur with this kind of stuff, so apologies if this post sounds naive.
pepoluan
Basically, all you need is a decoder that support piping. Pipe the output of the decoder as input to OggEnc2, and you're all set.

Can't answer about the legal stuffs, IANAL smile.gif
vlada
One solution for you would be to use a pipe between a CLI decoder and OggEnc. There are CLI decoders for most known formats. Or you could use programs such as Mencoder or FFMPEG to transcode almost anything to Ogg Vorbis.

AFAIK you can use GPL executable within a commercially licensed application. I wouldn't doubt if it was licensed uder LGPL, but OggEnc is GPL. So I'm not absolutely sure. Anyway you can use libvorbis, which is licensed under BSD.
caligae
According to the GPLv3 Wiki this doesn't pose any legal problems.

If there were any problems, it wouldn't be for charging for the program, but that your program isn't GPLed.
Seymour Clufley
Thanks for the replies.

I can license my program under the GPL - hopefully that'll straighten out the issues.

As for decoding, Mencoder seems to be the best, simplest option. I've downloaded a compiled version of it but I'm struggling to understand the documentation.

Can anybody give me an example command line argument for getting it to convert a wav to an ogg file, each in a unique location on the computer?
Seymour Clufley
mencoder.exe is in a folder, next to a subfolder called "codecs" which contains all the codecs it could need.

This is the command line argument I've been using:

mencoder [full path to input file] -o [full path to output ogg file] -oac lavc acodec=vorbis -of lavf

And basically, it does nothing.

I've tried moving mencoder.exe into the "codecs" folder so that the codecs are right next to it, but that doesn't help.

Does it need to be configured?

Any help appreciated,
SC.
gameplaya15143
QUOTE(Seymour Clufley @ Jun 19 2007, 16:48) *

mencoder [full path to input file] -o [full path to output ogg file] -oac lavc acodec=vorbis -of lavf

Put quotes around the input/output files. Then the path can have spaces in it.
Seymour Clufley
I can't believe I overlooked that.

But I'm afraid it's still not working. The argument is now:

mencoder "[full path to input file]" -o "[full path to output ogg file]" -oac lavc acodec=vorbis -of lavf

Mencoder starts, stays open for less than half a second, and then closes without making any file.

Is there a particular folder structure I should be using? As I said, Mencoder is in a folder with a sub-folder called "codecs". I got the codecs from the MPlayer website - the standard "Windows x86 20061022" package.

I should mention that the input files I've tried are of miscellaneous formats. There's nothing in the command line argument to tell Mencoder what decoder to use. Should there be?

Thanks in advance,
SC.
joey_m
Are you running mencoder from the Start menu or at a command prompt? Maybe you can see the error if you execute a command shell ("cmd") and run mencoder from there.

I get an error complaining about lack of a video stream when using your command line, but its the first time I've used mencoder, so I'm afraid I can't help much beyond this...


Cheers,
Joey.
Seymour Clufley
I'm running Mencoder from a program made with Multimedia Builder. Basically you can start another executable and specify a command line argument to start it with.

I don't know about executing a command shell. Do you do that by typing cmd into Start > Run and then typing the command line argument for Mencoder into that? I'll try it.

Thanks in advance for any more help - I need it!
Seymour Clufley
Okay, I ran it from Start>Run and I've discovered the problem. It says:

Video stream is mandatory

There's not much mention of this on the internet, but I did find this piece of advice:

Use "-vo null -vc null" in your command line. You have to *specify* a video stream, but the above says to not actually do anything with the video.

So I tried it... And -vo isn't recognised as a command! I've played around with it - swapped "-vo" for "-ovc" and so forth - but no joy yet.

It seems that Mencoder isn't really optimised for audio-only transcoding. FFMpeg is, but then I believe I'd lose some input formats.
Seymour Clufley
Does anyone have any ideas?
vlada
I'm sorry, I use Mencoder only occasionally so I can't help you. But I would suggest you to ask at Doom9 forums. You might get a good help there.
SamHain86
Why not convert anything that is not a standard input for oggenc2 to a temporary WAV first, then encode that with your program?

Also, have you seen FooBar2000? Completely free swiss-army-knife of media players. It can be setup to encode anything into anything else, with the abilty to setup custom encoders. If the encoder does not support pipelines, you set up your command lines with a temp file.
senab
I would personally use ffmpeg instead of mencoder for this:

Something like:

CODE
ffmpeg -i file.flac -vn -acodec pcm_s16le -f s16le - | oggenc2 -q 3 --raw - --output=file.ogg


Works like a charm wink.gif
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.