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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-14-2014, 08:28 AM
|
#1
|
Member
Registered: Apr 2005
Distribution: Debian Testing + KDE
Posts: 53
Rep:
|
How to convert Ogg Vorbis .WAV file to normal .WAV file?
I have many sound samples in Ogg Vorbis .WAV format. My problem is, most programs can't open them. I would like to batch convert them to normal 16-bit .WAV files. Writing a script to do this is not a problem for me, my problem is that I haven't found yet a software capable of performing such a conversion.
sox gives me the following error:
Code:
sox FAIL formats: can't open input file `sample.wav': Unknown WAV file encoding (type 674f)
ffmpeg and avconv print similar error:
Code:
[wav @ 0x2400ee0] Could not find codec parameters for stream 0 (Audio: none (Og[0][0] / 0x674F), 44100 Hz, 1 channels, 112 kb/s): unknown codec
Ironically even oggenc can't understand its own format in .WAV container.
I also tried Audacity, it can open Ogg Vorbis .WAV files, but it lacks batch conversion option (its Apply Chain... feature only works on files in one folder). It's important to preserve original sub-directory structure and I unfortunately have too many folders and subfolders to go through them manually.
Is there any (preferably command-line) tool I could use to convert Ogg Vorbis .WAV files to common format?
Last edited by *Dark Dragon*; 11-14-2014 at 08:37 AM.
|
|
|
11-14-2014, 08:37 AM
|
#2
|
Member
Registered: Jul 2004
Location: Chennai, India
Posts: 952
|
Ogg vorbis files usually have extension .ogg. In your case, the fact that the file has extension .wav seems to confuse the program - leading to messages like Unknown WAV file encoding (type 674f) So the idea is to have the file name back as sample.ogg. Try a straight rename on 1 file first mv sample.wav sample.ogg. I think that will solve your problem.
Also avconv may have options to assume .ogg format without the need to rename the files.
OK
Last edited by AnanthaP; 11-14-2014 at 08:42 AM.
|
|
|
11-14-2014, 09:05 AM
|
#3
|
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326
|
never even heard of an ogg wav file ? i wonder what the file command says the files actually are:
|
|
|
11-14-2014, 09:13 AM
|
#4
|
Member
Registered: Apr 2005
Distribution: Debian Testing + KDE
Posts: 53
Original Poster
Rep:
|
Thanks for trying to help. Yes, usually Ogg Vorbis audio is inside .OGG container. Unfortunately my files have correct extension. I tried your suggestion anyway, but as expected changing file name extension did not change container inside the file:
Code:
% file sample.wav
sample.wav: RIFF (little-endian) data, WAVE audio, mono 44100 Hz
% mv sample.wav sample.ogg
% file sample.ogg
sample.ogg: RIFF (little-endian) data, WAVE audio, mono 44100 Hz
% ffmpeg -i sample.ogg sample.wav
...
[wav @ 0x717f60] Could not find codec parameters for stream 0 (Audio: none (Og[0][0] / 0x674F), 44100 Hz, 1 channels, 96 kb/s): unknown codec
By the way, issue with Ogg/Vorbis in WAV is mentioned in this ffmpeg bug report: https://trac.ffmpeg.org/ticket/1690, so I'm not the first who encountered this problem.
I appreciate any suggestions at this point. Perhaps somebody knows a way to unpack Ogg Vorbis audio from .WAV container?
Last edited by *Dark Dragon*; 11-14-2014 at 09:17 AM.
|
|
|
11-14-2014, 09:17 AM
|
#5
|
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326
|
i wonder if play or aplay will play them... any luck with mencoder ?
Code:
mencoder -oac pcm sample.ogg -o sample.wav
edit: i think mencoder requires there to be a video channel.
Last edited by schneidz; 11-14-2014 at 09:30 AM.
|
|
|
11-14-2014, 09:38 AM
|
#6
|
Member
Registered: Apr 2005
Distribution: Debian Testing + KDE
Posts: 53
Original Poster
Rep:
|
Code:
% aplay sample.wav
aplay: test_wavefile:948: can't play WAVE-file format 0x674f which is not PCM or FLOAT encoded
% play sample.wav
play FAIL formats: can't open input file `sample.wav': Unknown WAV file encoding (type 674f)
% mplayer sample.wav
...
Cannot find codec for audio format 0x674F.
Still no luck... By the way, extension does not matter, I tried to rename to .ogg again and got exactly the same errors as above.
Last edited by *Dark Dragon*; 11-14-2014 at 09:42 AM.
|
|
|
11-15-2014, 11:38 PM
|
#7
|
Member
Registered: Apr 2005
Distribution: Debian Testing + KDE
Posts: 53
Original Poster
Rep:
|
I tried to write a script to copy all Ogg Vorbis .WAV files to one directory remembering original paths so I could apply chain in Audacity to convert them and then move them back to where they belong. But when I actually tried to use my script, I discovered that Audacity can only open Ogg Vorbis .WAV with 674F codec ID but not 6771, and I have too many of those, so unfortunately Audacity is not going to help me to convert them.
Anyone who wants to try to open Ogg Vorbis .WAV with codec ID 6771 can download sample file from here: http://samples.ffmpeg.org/A-codecs/v...ogg-vorbis.wav (this is example .WAV file from ffmpeg bug report #1690). Here is what mediainfo says about it:
Code:
% mediainfo /tmp/ogg-vorbis.wav
General
Complete name : /tmp/ogg-vorbis.wav
Format : Wave
File size : 5.67 MiB
Duration : 3mn 5s
Overall bit rate mode : Variable
Overall bit rate : 256 Kbps
Audio
Format : Vorbis
Format version : Mode 3+
Format settings, Floor : 1
Codec ID : 6771
Duration : 3mn 5s
Bit rate mode : Variable
Bit rate : 256 Kbps
Channel count : 2 channels
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 5.67 MiB (100%)
Writing library : libVorbis 1.0 RC3 (UTC 2001-12-31)
Writing application : vorbis.acm
Never thought I get stuck because I can't find free tool to open files encoded with free codec, but here I am.
I would appreciate if somebody could suggest command-line application capable of opening .WAV files like this (preferably capable of converting them, but at this point any command-line tool capable of at least playing them would be useful).
Of course, if somebody knows GUI application which can convert multiple files (even if it limited to files in single directory like Audacity) that would be helpful too.
Last edited by *Dark Dragon*; 11-15-2014 at 11:46 PM.
|
|
|
11-16-2014, 07:36 AM
|
#8
|
LQ Newbie
Registered: Aug 2014
Posts: 15
Rep: 
|
Here's what ogginfo says about the file. Don't know if this helps but it's a little bit.
ogginfo ogg-vorbis.wav
Processing file "ogg-vorbis.wav"...
WARNING: Hole in data (66 bytes) found at approximate offset 4500 bytes. Corrupted Ogg.
Note: Stream 1 has serial number 0, which is legal but may cause problems with some tools.
New logical stream (#1, serial: 00000000): type vorbis
Vorbis headers parsed for stream 1, information follows...
Version: 0
Vendor: Xiphophorus libVorbis I 20011231 (1.0 rc3)
Channels: 2
Rate: 44100
Nominal bitrate: 256.064000 kb/s
Upper bitrate: 4294967.295000 kb/s
Lower bitrate: 4294967.295000 kb/s
User comments section follows...
ENCODER=vorbis.acm
Note: Stream 2 has serial number -1, which is legal but may cause problems with some tools.
WARNING: illegally placed page(s) for logical stream 2
This indicates a corrupt Ogg file: Ogg muxing constraints violated, new stream before EOS of all previous streams.
New logical stream (#2, serial: ffffffff): type unknown
Vorbis stream 1:
Total data length: 4841233 bytes
Playback length: 3m:05.546s
Average bitrate: 208.733817 kb/s
Logical stream 1 ended
WARNING: EOS not set on stream 2
This might be implying that if the file was not corrupted then the program ogg123 would play same.
Last edited by BowCatShot; 11-16-2014 at 07:44 AM.
Reason: More info
|
|
|
11-16-2014, 12:45 PM
|
#9
|
Member
Registered: Apr 2005
Distribution: Debian Testing + KDE
Posts: 53
Original Poster
Rep:
|
Quote:
Originally Posted by BowCatShot
Here's what ogginfo says about the file. Don't know if this helps but it's a little bit.
|
Actually it did help. This got me thinking "what if I remove first hole?". I tried removing everything before first "OggS" and this allowed me to extract Ogg streams with moggsplit. Not sure what's the point of secondary useless (unplayable) Ogg stream(s) in some WAV files.
In general case extracting Ogg from WAV is not as simple as described above and can be more complicated in some cases. I wrote script ogg_wav, and with it I successfully converted different kinds of Ogg Vorbis WAV I had on my computer.
The script have many options and error handling. It can convert Ogg Vorbis WAV to uncompressed WAV (-c option), or extract primary OGG stream (-e option, the default if no options provided), among other things. It skips files without Ogg streams. With -d option it will delete original .wav file.
For example, to convert two Ogg Vorbis WAV files to .ogg (and keep original .wav):
Code:
ogg_wav ogg-vorbis.wav ogg-vorbis2.wav
For large number of files it is better to use GNU parallel. This is the command to convert Ogg Vorbis WAV to uncomressed WAV recursively:
Code:
find DIRECTORY -type f -iname '*.wav' | parallel ogg_wav -cd '{}'
To install: download ogg_wav, make it executable (with chmod +x) and put it to /usr/local/bin/. Run "ogg_wav -h" to understand how to use it. It has many additional options not described in this post.
Quote:
Originally Posted by BowCatShot
This might be implying that if the file was not corrupted then the program ogg123 would play same.
|
ogginfo claims that all my Ogg Vorbis WAV files are "corrupted" but I know for a fact that they are not. It is just ogginfo does not know anything about WAV container. Compressed stream(s) are allowed in WAV container by the standard. Unfortunately most free tools are not aware of this.
Last edited by *Dark Dragon*; 11-17-2014 at 12:55 PM.
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 12:30 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|