PDA

View Full Version : SoundOut failing for simple wav file


tacman1123
7th October 2008, 16:53
I downloaded http://simplythebest.net/sounds/WAV/sound_effects_WAV/sound_effect_WAV_files/fanfare.wav and want export it to ac3 using Soundout (actually, I'm doing a lot more, but this is the simplified case that hopefully will make debugging easier.)

Here's my code:

WavSource("downloads\fanfare.wav")
ac3_file="fanfare.ac3"
SoundOut(output = "ac3", filename=ac3_file, autoclose = true, wait=0,overwritefile="yes", showprogress=true, cbrrate = 384)


The error I'm getting is


Could not initialize encoder. Probably invalid input


I've also tried to open the wav file with DirectShowSource.

This seems to happen with all the wav files on this site. Are they really invalid? They seem to play okay in some players, in fact, this script will play the sound, but it won't export to ac3.

I'm trying to automate this process, so I'm hoping to use SoundOut rather than something with a GUI.

Thanks.

Tac

Keiyakusha
7th October 2008, 17:32
tacman1123
Its not valid wav file I think. Maybe just renamed mp3, mp3 with wav header or something...

General
Complete name : D:\Downloads\simplythebest.net\fanfare.wav
Format : Wave
File size : 33.6 KiB
Duration : 13s 773ms
Overall bit rate : 20.0 Kbps

Audio
Format : MPEG Audio
Format version : Version 2.5
Format profile : Layer 3
Codec ID : 55
Codec ID/Hint : MP3
Bit rate mode : Variable
Bit rate : 20.0 Kbps
Channel(s) : 1 channel
Sampling rate : 11.025 KHz
Resolution : 16 bits
Alignment : Split accross interleaves

45tripp
7th October 2008, 18:11
it's perfectly valid.


I'm trying to automate this process,

use ffmpeg

ffmpeg -i fanfare.wav -ar 48000 fanfare.ac3

tebasuna51
7th October 2008, 18:13
Your fanfare.wav contain a mp3 mono 11025 Hz

Before convert to ac3 you need change at least the SampleRate to 32000/44100/48000 Hz, for instance using before SoundOut:

ssrc(44100)

and to encode a mono file you need only cbrrate = 112

BTW, seems SoundOut don't finish well the encode, but the avs without SoundOut work with BeHappy.

tacman1123
7th October 2008, 21:19
Thanks, appreciate the comments and approaches. I had worked on an images project once where we were constantly dealing with people naming files incorrectly, so you couldn't really trust that a jpg wasn't really a gif or png, it would sometimes work and sometimes not. I think this might also be the case here, glad to know there are ways to deal with it.

Gavino
8th October 2008, 00:10
I had worked on an images project once where we were constantly dealing with people naming files incorrectly, so you couldn't really trust that a jpg wasn't really a gif or png, it would sometimes work and sometimes not. I think this might also be the case here
Although the majority of .wav files contain PCM audio, wav (http://en.wikipedia.org/wiki/WAV) is just a container format, so a wav file containing mp3 data is perfectly valid, just less common.