LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-01-2007, 07:29 AM   #1
Marel
Member
 
Registered: May 2005
Location: Serbia
Distribution: Debian, Ubuntu, Red Hat, Gentoo
Posts: 64

Rep: Reputation: 15
Convert AC3 to WAV


Hi, I want to convert 6-channel audio file in AC3 compression to ogg. Since oggenc doesn't support AC3 input, I am trying first decompress it to PCM (wav).

Is there some program for Linux that can do this? It should also downsample it to 2 channels.
 
Old 05-01-2007, 08:38 AM   #2
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 6,311

Rep: Reputation: Disabled
You want ac3dec.
 
Old 05-01-2007, 08:58 AM   #3
Marel
Member
 
Registered: May 2005
Location: Serbia
Distribution: Debian, Ubuntu, Red Hat, Gentoo
Posts: 64

Original Poster
Rep: Reputation: 15
I'm not sure about it. I tried it, but it only plays the sound, didn't find a way to save it into file. Furthermore, in its man page, it says only supports 4 or 6 channels, and I need two. Third, even if I find a way it saves it into file, will it be wav, or raw pcm stream? It looks to me it would be the second.
 
Old 05-01-2007, 09:22 AM   #4
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 6,311

Rep: Reputation: Disabled
Oggenc takes raw stream as input, you can just pipe the output of ac3dec to oggenc.
MPlayer is another option, it can certainly handle AC3.
Also, Avidemux2 (it's an excellent multimedia tool BTW) can do it for you.
 
Old 05-01-2007, 09:52 AM   #5
Marel
Member
 
Registered: May 2005
Location: Serbia
Distribution: Debian, Ubuntu, Red Hat, Gentoo
Posts: 64

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Emerson
Oggenc takes raw stream as input, you can just pipe the output of ac3dec to oggenc.
I tried

ac3dec stream.ac3 | oggenc -R 48000 -o newstream.ogg -

but ac3dec starts playing the sound trough sound card and resulting ogg file is empty.

Then I tried


Code:
mr@main:~/video$ ac3dec -D newstream.raw stream.ac3
5.1 Mode 48.0 KHz 448 kbps Complete Main Audio Service
Using PCM device 'newstream.raw'
ALSA lib pcm.c:2143:(snd_pcm_open_noupdate) Unknown PCM newstream.raw
snd_pcm_open: No such file or directory
Output open failed
and as You can see it doesn't work.

Quote:
MPlayer is another option, it can certainly handle AC3.
It can play it, but not what I need. If You have concrete command line options for this, I would be gratefull to see them.

Quote:
Also, Avidemux2 (it's an excellent multimedia tool BTW) can do it for you.
I didn't try to much Avidemux, so I'll try what can be done.

Last edited by Marel; 05-01-2007 at 09:55 AM.
 
Old 05-01-2007, 10:39 AM   #6
Marel
Member
 
Registered: May 2005
Location: Serbia
Distribution: Debian, Ubuntu, Red Hat, Gentoo
Posts: 64

Original Poster
Rep: Reputation: 15
I managed to get wav file with avidemux by selecting "Wav PCM" Audio and chosing Audio/Save from menu.

However, it doesn't output ogg-vorbis correctly. It looks like there is really much problems with embeding vorbis at the moment. In addition to what I already said, Avidemux crashed while I tried to make it output vorbis sound with video in avi file, both with stream copy and libavcodec recompression.

Last edited by Marel; 05-01-2007 at 10:40 AM.
 
Old 05-01-2007, 01:22 PM   #7
sfaz32
LQ Newbie
 
Registered: Sep 2005
Posts: 16

Rep: Reputation: 0
To Marel,

You can use mplayer and pipe its output to oggenc using the following script :

Code:
#!/bin/bash
INPUT="inputfile.ac3"
OUTPUT="outputfile.ogg"
mkfifo audiodump.wav
mplayer "$INPUT" -vc dummy -vo null -ao pcm:file="audiodump.wav" -channels 2 \
  & oggenc -q 9 "audiodump.wav" -o "$OUTPUT"
rm audiodump.wav
Replace inputfile.ac3 with your source. You can also use any file that mplayer can play.

Then replace "outputfile.ogg" to whatever you want.
 
Old 05-01-2007, 03:54 PM   #8
Marel
Member
 
Registered: May 2005
Location: Serbia
Distribution: Debian, Ubuntu, Red Hat, Gentoo
Posts: 64

Original Poster
Rep: Reputation: 15
Thank You. This way to use named pipes will be very usefull, I hope.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert mp3 to wav trey85stang Linux - Software 5 08-23-2006 09:57 PM
How Do I Convert Multichannel Wav To AC3 AlexCPU Linux - Software 0 05-28-2006 04:32 AM
convert mp3 to wav LadyArtemis Linux - Software 3 05-05-2006 12:43 PM
mp3 to wav convert shibainucan SUSE / openSUSE 1 10-22-2004 10:46 AM
convert ogg to wav degraffenried13 Linux - General 5 07-20-2004 06:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration