OS2World OLD-STATIC-BACKUP Forum

OS/2 - Technical => Multimedia => Topic started by: Ben on 2009.05.01, 02:12:07

Title: FLACs, OGGS and WAVs
Post by: Ben on 2009.05.01, 02:12:07
I'm wondering if anyone knows a way to convert FLACs and OGGs to WAV files.

I know MP3s can be done with several tools, but I haven't found any for the above.

Does anyone have any suggestions?

Thank-you.
Title: Re: FLACs, OGGS and WAVs
Post by: David McKenna on 2009.05.01, 03:14:11
  Navigate to the file you want to convert (using a WPS drives object), right click on it, then choose 'Convert', then choose the format you want. This requires the Flac and Ogg CoDecs are already installed (which they are if using eCS).

Dave McKenna
Title: Re: FLACs, OGGS and WAVs
Post by: The Blue Warper on 2009.05.01, 04:06:56
Hi, Ben!

FLACs:
Use flac-1.2.1 (which you can find on hobbes: http://hobbes2.nmsu.edu/download/pub/os2/dev/mm/flac-1.2.1.zip ).  In your case, you'd just need to run the following from the command line:
flac -d yourfile.flac
where -d means "decode" (You can also use --decode).  Default output is WAV, because FLAC is (basically) a lossless compressed Wave format.
The --ogg option specifies encoding or decoding of Ogg FLAC files (From the docs: «Ogg FLAC streams are FLAC streams wrapped in an Ogg transport layer»).

If you only needs to play FLAC files, then you can use this PM123 plugin:
http://hobbes2.nmsu.edu/download/pub/os2/apps/mmedia/sound/players/flacplay-1_2_1-10.zip




OGGs:
Ogg FLAC files: see above.

OGG files:
LAME.  Run:
lame --decode yourfile.ogg [--> output will default (at least as per documentation) to WAV].
Get LAME 3.98.2 from hobbes: http://hobbes2.nmsu.edu/download/pub/os2/dev/mm/lame-3.98.2.zip

Ogg Vorbis.
Use oggdec.exe from:
http://hobbes2.nmsu.edu/download/pub/os2/apps/mmedia/sound/convert/oggvorbis-1.0.1-os2.zip

SoX:
http://hobbes2.nmsu.edu/download/pub/os2/apps/mmedia/sound/convert/sox-12.18.2.zip

WAWE Editor ( http://hobbes.nmsu.edu/download/pub/os2/apps/mmedia/wawe_078.zip ):
Import your OGG file and export it to WAV (using WAWE's XWAV plugin).




You can also try MMAudio Pak and CW-Multimedia classes.  They install some Audio IO Procedures in MMOS2 (MP3, OGG Vorbis, FLAC) and you should be able to convert them to another OS/2 supported format.  From http://r6.ca/MMAudioPak/ :

Files can be converted to any audio format that OS/2 can write, by using "Convert to" in the context menu. CW-Multimedia classes enhance this feature.



Hopefully you'll find at least one utility suitable for your purposes...

Regards
Title: Re: FLACs, OGGS and WAVs
Post by: Ben on 2009.05.01, 06:19:05
Good lord.

I amazes me sometimes and despite constant years of use, that some aspects of OS/2 remain hidden in plain sight, their function never before needed and thus, obscured from view.

While these are add ons and not basic to the OS, they have been around a long time.

Thanks for wiping the speck off my glasses.

:D

Title: Re: FLACs, OGGS and WAVs
Post by: Ben on 2009.05.12, 07:20:36
Quote from: The Blue Warper on 2009.05.01, 04:06:56
Hi, Ben!

FLACs:
Use flac-1.2.1 (which you can find on hobbes: http://hobbes2.nmsu.edu/download/pub/os2/dev/mm/flac-1.2.1.zip ).  In your case, you'd just need to run the following from the command line:
flac -d yourfile.flac
where -d means "decode" (You can also use --decode).  Default output is WAV, because FLAC is (basically) a lossless compressed Wave format.
The --ogg option specifies encoding or decoding of Ogg FLAC files (From the docs: «Ogg FLAC streams are FLAC streams wrapped in an Ogg transport layer»).

If you only needs to play FLAC files, then you can use this PM123 plugin:
http://hobbes2.nmsu.edu/download/pub/os2/apps/mmedia/sound/players/flacplay-1_2_1-10.zip

Greetings, The Blue Warper

Thank you for the extensive reply.

However, the FLAC program wouldn't work for me, (I only tried it for decoding);

                  "SYS0002: The system cannot find the file specified. "FLAC""

Regardless of what parameter I added, it would always yield the same result.
It seems like there is a missing *.dll, but I can find no references to additional requirements in the docs, readme or FAQ.

Perhaps I over looked it...

Some may be interested to know that the right click "Convert" does not work for all FLACs.

Title: Re: FLACs, OGGS and WAVs
Post by: cyber on 2009.05.13, 13:51:22
Hi Ben,

In  http://hobbes2.nmsu.edu/download/pub/os2/dev/mm/flac-1.2.1.zip You have in directory LIB files flac.dll and flac++.dll. Place `em where flac.exe reside, or somewhere in path.

Then should work.

From readme:
------------>8--------------------->8--------------------->8------------
FLAC is comprised of
  * `libFLAC', a library which implements reference encoders and
    decoders for native FLAC and Ogg FLAC, and a metadata interface
  * `libFLAC++', a C++ object wrapper library around libFLAC
  * `flac', a command-line program for encoding and decoding files
  * `metaflac', a command-line program for viewing and editing FLAC
    metadata
  * player plugins for XMMS and Winamp
  * user and API documentation
------------>8--------------------->8--------------------->8------------
Title: Re: FLACs, OGGS and WAVs
Post by: David McKenna on 2009.05.13, 14:23:43
Ben,

  >"Some may be interested to know that the right click "Convert" does not work for all FLACs."

  You should report that on the eCS bug tracker (give an example file).... maybe the flac decoder needs to be updated....

Dave McKenna
Title: Re: FLACs, OGGS and WAVs
Post by: Ben on 2009.05.13, 17:03:19
Quote from: cyber on 2009.05.13, 13:51:22
Hi Ben,

In  http://hobbes2.nmsu.edu/download/pub/os2/dev/mm/flac-1.2.1.zip You have in directory LIB files flac.dll and flac++.dll. Place `em where flac.exe reside, or somewhere in path.

Then should work.

From readme:
------------>8--------------------->8--------------------->8------------
FLAC is comprised of
  * `libFLAC', a library which implements reference encoders and
    decoders for native FLAC and Ogg FLAC, and a metadata interface
  * `libFLAC++', a C++ object wrapper library around libFLAC
  * `flac', a command-line program for encoding and decoding files
  * `metaflac', a command-line program for viewing and editing FLAC
    metadata
  * player plugins for XMMS and Winamp
  * user and API documentation
------------>8--------------------->8--------------------->8------------

Moving the *.dlls is far from clear in the readme...

I thank-you for clarifying it.
Title: Re: FLACs, OGGS and WAVs
Post by: Ben on 2009.05.13, 17:05:24
Quote from: David McKenna on 2009.05.13, 14:23:43
  You should report that on the eCS bug tracker (give an example file).... maybe the flac decoder needs to be updated....

Dave McKenna

I will if I can get the time, but since I'm in the middle of a major move, and life upheaval, that's unlikely.

But thanks for the suggestion.

Title: Re: FLACs, OGGS and WAVs
Post by: Ben on 2009.05.14, 01:23:41
Actually, the solution was a simple one...

The act of copying the new FLAC*.dlls into the path allowed for additional FLAC conversions.

No need of a bug report to Mensys... though I"ll send an E-mail if I can get the time.
Title: Re: FLACs, OGGS and WAVs
Post by: cyber on 2009.05.14, 09:11:07
Quote from: Ben on 2009.05.13, 17:03:19
Moving the *.dlls is far from clear in the readme...

Yes. You know, readme's should not be written by programers.

Quote from: Ben
I thank-you for clarifying it.

Cyber, superhero/2, always here to help.   8)
Title: Re: FLACs, OGGS and WAVs
Post by: CDRWSel on 2009.05.18, 20:15:38
You can use FFMPEG  (very easy)
It is ok for AC3, OGG, MP3 and wave   
Title: Re: FLACs, OGGS and WAVs
Post by: RobertM on 2009.05.18, 20:43:03
Indeed, as CDRWSel says, FFMPEG and mENCODER are both very easy to use... do not let the plethora of options discourage their use. Google'ing examples will lead to a bunch of easy to use examples for transcoding virtually anything to virtually anything.
Title: Re: FLACs, OGGS and WAVs
Post by: Ben on 2009.05.18, 21:37:57
Yes.

If I can ever get the time to do it, I will research this and whip up a bunch of *.cmd files for my more commonly used functions...

... however, due to time restrictions, I cannot see this happening soon... but it is on the list.
Title: Re: FLACs, OGGS and WAVs
Post by: CDRWSel on 2009.05.19, 14:26:23
A few commans:
ffmpeg -i f:\ogg_tracks\track01.ogg -acodec libmp3lame -ac 2 -ar 22500 -ab 128k -vol 256 g:\var\temp\track01.mp3
-i is followed by the input file which can be ogg, mp3, wav...
in my sample g:\......track01.wav is the output audio track (ffmpeg uses correct coded according output track extension. Here it is MP3 but it could be OGG, WAV...
(as long it is a supported coded included during ffmpeg compilation) 
.
Now, a few optionnal parameters:
-ac 2 is for 2 channel audio (set to 1 for mono)
-ar resample to e.g. 44100 (44.1khz) which is CD-AUDIO required
-ab bitrate (higher is better quality by generaly, 192k for MP3 (is high quality and 128k is standard quality) while OGG can use less value for the same quality result. e.g. -ab 128k for OGG is near -ab 192k for MP3. This impacts final audio quality and of course track size.
-vol you can reduce or increase output volume level. e.g. -vol 200 ( note: 256 is 100% and don't use it if you don't know what to specify )
.
More samples:
ffmpeg -i f:\tracks\track01.ogg g:\var\temp\track01.wav
ffmpeg -i f:\tracks\track01.mp3 g:\var\temp\track01.wav
Better with respect of 44100 CD-Audio sampling:
ffmpeg -i f:\tracks\track01.ogg -ac 2 -ar 44100 -vol 256 g:\var\temp\track01.wav
and also other format like (just tested):
ffmpeg -i f:\tracks\track01.mp3 -acodec vorbis -ac 2 -ar 22500 -ab 128k g:\var\temp\track01.ogg
ffmpeg -i f:\tracks\track01.wav -acodec ac3 -ac 2 -ar 48000 -ab 192k g:\var\temp\track01.ac3
ffmpeg -i f:\tracks\track01.ogg -acodec libmp3lame -ac 2 -ar 44100 -ab 160k g:\var\temp\track01.mp3
ffmpeg -i f:\tracks\track01.ogg -acodec flac -ac 2 -ar 44100 -ab 256 g:\var\temp\track01.flac
ffmpeg -i f:\tracks\track01.flac -acodec libmp3lame -ac 2 -ar 44100 -ab 160k g:\var\temp\track01.mp3
ffmpeg -i f:\tracks\track01.wma -acodec libmp3lame -ac 2 -ar 44100 -ab 160k g:\var\temp\track01.mp3
ffmpeg -i f:\tracks\track01.ogg -acodec wmav2 -ac 2 -ar 44100 -ad 128k g:\var\temp\track01.wma
...
e.g. with free WMA:
  Duration: 00:04:18.11, start: 1.579000, bitrate: 126 kb/s
    Stream #0.0: Audio: wmav2, 44100 Hz, stereo, 128 kb/s
Output #0, mp3, to 'F:\TRACKS\TRACK99.MP3':
    Stream #0.0: Audio: libmp3lame, 44100 Hz, stereo, 160 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
...
Cheers/2
RD
Title: Re: FLACs, OGGS and WAVs
Post by: The Blue Warper on 2009.05.21, 13:36:56
Hi, Ben!

I sincerely apologize for not replying to your post dated 2009.05.12, 07:20:36.  I wasn't at home and I came back today.  I'm very glad, though, that you eventually got your troubles solved, thanks to OS2 World's community!
Title: Re: FLACs, OGGS and WAVs
Post by: RobertM on 2009.05.21, 21:04:33
Quote from: CDRWSel on 2009.05.19, 14:26:23
A few commans:
ffmpeg -i f:\ogg_tracks\track01.ogg -acodec libmp3lame -ac 2 -ar 22500 -ab 128k -vol 256 g:\var\temp\track01.mp3


And that my friends, can easily be turned into a REXX script. See CDRWs notes below for the important parameters and descriptions...

Then it's simply a REXX script, create an icon and name something like "OGG to MP3" and you are up and running.

You can use things like the substr(), lastpos(), mkdir() and directory() statements to read and change the in/out directories, and so on. You can also have the script pop up a window asking for the sample rate and bitrate before the encoding happens. You can even stick that "asking" in a timed loop that defaults to a certain value. Then, the "execution" string simply becomes something like:

'ffmpeg -i 'OGGFILENAME' -acodec libmp3lame -ac 2 -ar 'SAMPLERATE' -ab 'strip(BITRATE)'k -vol 256 'MP3FILENAME

Then simply open the OGG template (create one in the templates folder if you dont have one), and assign the "OGG to MP3" icon to it's pop-up menu.

The whole script can be as simple as:



/* OGG to MP3 */
Parse Arg OggFileName

SAMPLERATE=22500    /* CHANGE AS NEEDED */
BITRATE=128    /* CHANGE AS NEEDED */

/* CREATE CODE TO REQUEST SAMPLE RATE AND CHECK FOR KEYBOARD INPUT ON TIMED LOOP - USE DEFAULTS IF NOTHING TYPED BY END OF LOOP */

/* CREATE CODE TO REQUEST BIT RATE AND CHECK FOR KEYBOARD INPUT ON TIMED LOOP - USE DEFAULTS IF NOTHING TYPED BY END OF LOOP */

/* Create MP3 file name by simply changing the extension - this will leave the file name and path identical to original */
/* Note: this won't work if source file is on a DVD or CD. A simple test to determine local disks, match drive letter of source file and change */
/* from CD/DVD to HDD (dont forget to create directories) is really easy to add to this */

MP3FileName=SubStr(OggFileName,1,LastPos(translate(OggFileName),".OGG"))||"mp3"


/* Ensure that ffmpeg's directory is in the PATH statement someplace */

/* Use commands such as Directory and/or MkDir() (<--- important one) to enhance this script for such things as */
/* Creating different output directories such as "\OriginalPath\MP3_File\" or writing to a "Music" folder or whatever */

/* Otherwise, as coded below, MP3 file will be created in same directory */
'ffmpeg -i 'OGGFILENAME' -acodec libmp3lame -ac 2 -ar 'SAMPLERATE' -ab 'strip(BITRATE)'k -vol 256 'MP3FILENAME


The code to change the sample rate is very simple... display choices (ie: (1) 22500, (2) 44100, (3) 48000), create a loop, iterate it x number of times, check for input each time (and IF input detected, assign to a varand leave loop), sleep a second, after loop exit (whether because it has finished iterating or it has reached the "leave" statement) check the var... if it is 1-3, change sample rate accordingly - otherwise, leave sample rate the same (as defined above).

Repeat for bitrate.




Alternatively, one can specify options instead (such as SR44100BR128) in the parameters section for the icon, and have the script parse those as well to set those values.

Or, one can have a bunch of special purpose variants of the script or icons set up such as "OGG to MP3 at 44100/128" and "OGG to MP3 at 22500/128" etc. Then add them all to the OGG template's pop-up menu.





I regularly convert FLV to MPG, and VOB to FLV using the method above

And yes, thusly, this works with any formats that ffMPEG - or mEncoder for that matter, understand - which is mostly any format there is.




Title: Re: FLACs, OGGS and WAVs
Post by: Ben on 2009.05.22, 05:07:50
The Blue Warper; Hey, not a problem... lots of interested parties here with good tips; thanks all.

--

Anyone here having a problem loading the first page of this thread? Or is my machine becoming cantankerous?
Title: Re: FLACs, OGGS and WAVs
Post by: cyber on 2009.05.22, 09:24:01
Here both pages load nice, anyway, You people give great ideas, wma is also on supported formats, i Wonder will AMR (SonyErricson recording format) is possible to convert.
Title: Re: FLACs, OGGS and WAVs
Post by: The Blue Warper on 2009.05.22, 18:50:30
Another choice would be jRipper:
http://dronten.googlepages.com/jripper

From the presentation page:



jRipper is an cd ripper and audio converter made in java (1.5).
jRipper can encode and decode Wav, Flac, MP3, Ogg, AAC(M4A) formats. It can also do transcoding between various formats.
Beware though that every transcoding deteriorate the quality of the audio file.

jRipper works as an frontend to cdda2wav, lame, oggenc/oggdec, flac and faac/faad programs, which does the actually reading/encoding/decoding work. jRipper can load track names for an CD from freedb.org.



Ronald Brill made an OS/2 installable package:
http://www.rbri.org/jripper/jripper.html
Title: Re: FLACs, OGGS and WAVs
Post by: Ben on 2009.05.22, 19:28:28
Personally speaking, I do not understand with today's high speed Internet and huge disk capacities, why anyone bothers with Audio compression techniques... I mean, how large can an WAV file get?

Not very big.

Huge video files measuring in the gigabytes are transferred as the norm, any non-compressed audio file cannot reach anything, but a fraction of that size, so why bother compressing them? Just use the original WAV format and quality reduction be damned.
Title: Re: FLACs, OGGS and WAVs
Post by: cyber on 2009.05.22, 20:48:48
There is also  sox - Sound eXchange : universal sound sample translator !
latest release: http://hobbes.nmsu.edu/download/pub/os2/apps/mmedia/sound/convert/sox-12.17.1.zip

And to Ben: they can be veeery big, mostly when used on system/devices without unlimited storage abbilities, like mp3 devices, smartphones, laptops, netbooks, and for example on sites on internet wich is free of charge.
Title: Re: FLACs, OGGS and WAVs
Post by: cyber on 2009.06.12, 13:00:50
You can find convertor to mp3 as CDRWsel and RoberM describe here:
http://www.os2world.com/component/option,com_smf/Itemid,63/topic,1655.msg11385/topicseen,1/#new
Title: Re: FLACs, OGGS and WAVs
Post by: Pete on 2009.06.12, 16:22:55
Hi All


Must admit that I am in total agreement with Ben - but, there again, I am someone who thinks mp3, and other compressed audio formats, are a total waste of time and certainly not capable of producing any form of acceptable audio.

Guess that is the result of being a bit spoilt, I like Linn turntables and Meridian CD players to produce my audio  :-)

Regards

Pete
Title: Re: FLACs, OGGS and WAVs
Post by: cyber on 2009.06.12, 16:57:08
I'm the first to disagree with You both.  ;D While other people mostly has sound equipment wich is totaly out of question (active plastic speakers:)) to notice anything, I'm quite well equipped with oldy-goldy Marantz receiver, Visaton 2system transmision speakers, SB AWE32 and real power supply. With such system I really cann't determine what is mp3, and what is real CD audio.  This is for mp3 I produce, created with bladeenc, without using filters and more than 128 kbps and 44.1 KHz.
There is also one side of listening music when I'm not in my room, in public transport system, when I wait for something... I've carry around devices with headphones for, well... 30 years ! :) mp3 rules!  ;D
Title: Re: FLACs, OGGS and WAVs
Post by: Andi on 2009.06.12, 20:59:41
With proper equipment and right sound, it's quite easy to distinguish original CD (PCM 44.1kHz 2x16bit)  from 128kBit .mp3 (blind test of course and even with original Fraunhofer codec). The difference is quite big for me so I didn't test further. Maybe it's time for retest with 256kBit. But hee, 128kBit is good enough for portable players and for playing in the car radio. But nothing I want to hear on my home equipment.
Title: Re: FLACs, OGGS and WAVs
Post by: cyber on 2009.06.16, 10:50:13
196 is minimum if You want good sound on speakers. Also my personal oppinion is that original Fraunhofer isn't good at all, I now mostly use Lame (with using switch for output quality, vbr, jstereo), and Blade.
Title: Re: FLACs, OGGS and WAVs
Post by: rudi on 2009.06.16, 11:11:14
Quote from: cyber on 2009.06.16, 10:50:13
196 is minimum if You want good sound on speakers.

Yep, that is the lowest rate (192k to be correct) I've found acceptable as well.

Quote from: cyber on 2009.06.16, 10:50:13
Also my personal oppinion is that original Fraunhofer isn't good at all, I now mostly
use Lame (with using switch for output quality, vbr, jstereo), and Blade.

The Fraunhofer encoder and Blade are very similar. That why Fraunhofer/Thomson
sued the author and forced him to shut down the web site. AFAIK, Lame uses it's own
psycho-acoustic model and has some bug fixes over the reference implementation.
Thus it produces better results, especially on lower rates and/or vbr.