View Full Version : AVS to WAV
Sagittaire
8th April 2007, 17:35
How to convert avs audio files to wav ... ???
I try BePipe but there are win32 error ...
buzzqw
8th April 2007, 17:51
SoundOut
http://forum.doom9.org/showthread.php?t=120025
like this
LoadPlugin("NicAudio.dll")
LoadPlugin("SoundOut.dll")
NicAC3Source("fixed1.ac3")
#Applying STEREO downmixing routines
function stereo(clip a)
{
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3)
lfe = GetChannel(a, 4)
lfc = MixAudio(fcc, lfe, 0.2071, 0.2071)
mix = MergeChannels(lfc, lfc)
lrc = MixAudio(flr, mix, 0.2929, 1.0)
blr = GetChannel(a, 5, 6)
Return MixAudio(lrc, blr, 1.0, 0.2929)
}
#
6==Audiochannels() ? stereo() : last
Normalize()
Soundout(output="wav",type=0,autoclose=true,filename="audio.wav",showoutput=false)
BHH
smok3
8th April 2007, 22:05
or
virtualdub, save wav? (you could script that via vdub.exe) or
mplayer maybe? ( mplayer -ao pcm -vo null file.avi )
ADLANCAS
11th April 2007, 00:56
or a command line avs2wav
http://home.pages.at/kassandro/avs2wav.rar
bh0k441
16th April 2007, 12:20
you can also try mplayer with the following commandline
mplayer -vc null -vo null -ao pcm:fast:waveheader:file=audio.wav -hardframedrop file.avs
Pookie
16th April 2007, 17:40
Hey, that worked! Needs the Sherpya Mplayer build.
http://oss.netfarm.it/mplayer-win32.php
alvarez
23rd June 2007, 12:59
Hello,
I also wrote a small command line utility for that purpose a while ago (just to try out how such stuff works), now I uploaded it to SF so you can get it from there:
http://sourceforge.net/projects/wavi-avi2wav
:alvarez:
tebasuna51
24th June 2007, 02:38
I also wrote a small command line utility for that purpose a while ago (just to try out how such stuff works), ...
Looks like Bepipe but, maybe without .NET Framework dependence?
Don't work with SoundOut (like Bepipe) but the STDOUT can be piped to encoders and obtain the finals ac3, aac, ... without intermediate wav files.
I'm very interested in Wavi but, like bepipe, have two problems with easy solution:
1) The wav header have a little bug, in wavi.c line 162:
*(LPDWORD)(wavHeader + headerPos) = (DWORD) fileSize + 8;
must be:
*(LPDWORD)(wavHeader + headerPos) = (DWORD) fileSize;
2) There are extra bytes written at end of file, then the RiffLength (well calculated) seems erroneous and some software can reject the wav files.
Maybe we can test something like (in wavi.c, line 200):
while (nextSample < streamInfo.dwLength) {
if (userBreak) CleanupAndExit(1);
bytesToWrite = 0;
if (AVIStreamRead(aviStream, nextSample, samplesInBuffer, buffer, bufferSize, & bytesToWrite, & samplesRead) || (! bytesToWrite)) {
fprintf(stderr, "Error: Could not read audio data from \"%s\".\n", inputFile);
if (! toStdOut) CloseHandle(outputHandle);
CleanupAndExit(1);
}
nextSample += samplesRead; // moved
// New line:
if (nextSample > streamInfo.dwLength) bytesToWrite = bytesToWrite - sampleSize * (nextSample - streamInfo.dwLength);
if (! WriteFile(outputHandle, buffer, bytesToWrite, & bytesWritten, NULL) || (bytesWritten != bytesToWrite)) {
if (toStdOut) {
fprintf(stderr, "Error: Could not write to the standard output.\n");
} else {
fprintf(stderr, "Error: Could not write file \"%s\".\n", outputFile);
CloseHandle(outputHandle);
}
CleanupAndExit(1);
}
// nextSample += samplesRead;
}
Thanks.
EDIT: Seems work fine with these corrections.
alvarez
24th June 2007, 15:29
Hello,
Thanks for testing WAVI out! It seems that instead of only trying it with Winamp and Aften I sould've taken a deeper look...
Looks like Bepipe but, maybe without .NET Framework dependence?
Indeed. I might be old-fashioned, but I prefer to avoid .NET whenever possible :)
1) The wav header have a little bug, in wavi.c line 162:
*(LPDWORD)(wavHeader + headerPos) = (DWORD) fileSize + 8;
must be:
*(LPDWORD)(wavHeader + headerPos) = (DWORD) fileSize;
You're absolutely right: it seems I've misinterpreted the .WAV specification a bit.
2) There are extra bytes written at end of file, then the RiffLength (well calculated) seems erroneous and some software can reject the wav files.
You're right again; I expected that AVIStreamRead would stop at the end of the stream, but apparently it doesn't :( However, I used a different fix, which handles the case when streamInfo.dwLength + nextSample is greater than 4G (although this is quite unlikely to happen in real life):
while (nextSample < streamInfo.dwLength) {
if (userBreak) CleanupAndExit(1);
if (streamInfo.dwLength - nextSample < samplesInBuffer) {
bufferSize = (streamInfo.dwLength - nextSample) * sampleSize;
}
The fixed version is available here:
http://sourceforge.net/projects/wavi-avi2wav
Thanks again!
:alvarez:
tebasuna51
24th June 2007, 16:54
...I expected that AVIStreamRead would stop at the end of the stream, but apparently it doesn't.
Yes, I report the same problem to Dimzon with BeHappy and Bepipe, solved for BeHappy but never for Bepipe.
However, I used a different fix, which handles the case when streamInfo.dwLength + nextSample is greater than 4G (although this is quite unlikely to happen in real life)
Ok, seems work fine.
@Sagittaire and everybody, please check Wavi to replace Bepipe usage (avs2wav never work for me) because can be:
- More compatible (without .NET Framework dependence)
- Free of bug in wav header and extra bytes at end.
BTW, to use Avisynth SoundOut plugin, I recommend use:
avs2avi (http://www.avs2avi.org/) test.avs -c null -q -e
With these parameters only the SoundOut GUI (if required) is open and we avoid problems or close other interfaces like VirtualDub, mplayer, ....
tebasuna51
24th June 2007, 22:48
@alvarez
One more thing.
With AviSynth v2.5.7 if you use in avs's:
global OPT_AllowFloatAudio=True
the output can be with 32 bits float samples, Wavi can support without problems these wav files with:
#define WAVE_FORMAT_IEEE_FLOAT 3
and changing line 100 from wavi.c:
// if (waveFormat.wFormatTag == WAVE_FORMAT_PCM ) {
if (waveFormat.wFormatTag == WAVE_FORMAT_PCM || waveFormat.wFormatTag == WAVE_FORMAT_IEEE_FLOAT ) {
alvarez
26th June 2007, 13:54
I've put support fot floating-point WAVs in.
Available here:
http://sourceforge.net/projects/wavi-avi2wav
Any other ideas? :)
:alvarez:
Alicedoom9
3rd July 2007, 04:49
Exactly A few days ago I had just met this problem, I search a lot of software Audio Converters final trial found that the software required to complete the function. Want to help you.
AVS Audio Tools 5.4
Record audio, burn, rip and exact-copy audio and mp3 CDs, mix your own music, create and upload your own ringbones, record iRadio, convert audio.http://www.qweas.com/download/audio_mp3/audio_cd_burners/avs_audio_tools.htm
tebasuna51
11th August 2007, 01:55
I've put support fot floating-point WAVs in.
Available here:
http://sourceforge.net/projects/wavi-avi2wav
Any other ideas? :)
Yeah, a new idea :rolleyes:
Trying use wavi with new versions of Flac encoder I get this error message:
ERROR: WAVE has >2 channels but is not WAVE_FORMAT_EXTENSIBLE; cannot assign channels
Then I made a mod to wavi to output WAVE_FORMAT_EXTENSIBLE, but still don't work with flac.
Now is a flac problem, works fine with WAVE_FORMAT_EXTENSIBLE files but don't read the header through STDIN:
WARNING: skipping unknown sub-chunk ' '
...
The last option is send the data in RAW format, without headers, like the BeHappy method.
With raw data work fine and I want offer you these options.
Usage: WAVI <avi|avs-file> [ <wav-file> [ -r | -m [ <mask-chan> ] ] ]
Where:
<wav-file> Or '-' for STDOUT
-r raw output (without header)
-m WAVE_FORMAT_EXTENSIBLE header with default ChannelMask:
Mask Chan. MS channels Description
---- ----- ------------------------- ----------------
4 1 FC Mono
3 2 FL FR Stereo
259 3 FL FR BC First Surround
51 4 FL FR BL BR Quadro
55 5 FL FR FC BL BR like Dpl II (without LFE)
63 6 FL FR FC LF BL BR Standard Surround
319 7 FL FR FC LF BL BR BC With back center
255 8 FL FR FC LF BL BR FLC FRC With front center left/right
Others values:
7 3 FL FR FC
263 4 FL FR FC BC like Dpl I
271 5 FL FR FC BC LF
59 5 FL FR BL BR LF
Examples:
wavi 4-chan-input.avs - -m 263 | aften - output.ac3
wavi surround.avs - -r | flac --force-raw-format --endian=little --sign=signed --channels=6 --bps=16 --sample-rate=48000 - output.flac
Here is (http://www.mybigdir.com/5996)a first wavi.exe to test and the source modified, if you want accept the mod maybe you can write a new help and argument capture.
Thanks.
ACrowley
11th August 2007, 13:11
Steinberg Nuendo/Cubase can open and decompress wma/asf to wave too
alvarez
12th August 2007, 22:32
Hello,
Here is (http://www.mybigdir.com/5996)a first wavi.exe to test and the source modified, if you want accept the mod maybe you can write a new help and argument capture.
OK, I'll merge it into the latest version (which I forgot to post here) when I have some time. Some time this week... probably :) Would you mind if I asked you to test it a bit when I'm ready?
Thanks for your neverending support!
Have a nice day,
:alvarez:
tebasuna51
13th August 2007, 02:26
OK, I'll merge it into the latest version (which I forgot to post here) when I have some time. Some time this week... probably :) Would you mind if I asked you to test it a bit when I'm ready?
Thanks for your job and congratulations for the last speed improvement.
With a simple test, copy a wav file through AviSynth, I get this times:
Bepipe 1:37.73
wavi104 2:22.05
wavi105 1:34.65
alvarez
16th August 2007, 14:30
@tebasuna51:
Here is the merged version of wavi, which contains WAVE_FORMAT_EXTENDED support: deleted the link, see 2 posts below for the new version Could you please do a little test to see whether it works well with your Flac stuff before I publish it?
Thanks,
tebasuna51
16th August 2007, 19:49
Here is the merged version of wavi, which contains WAVE_FORMAT_EXTENDED support: http://rapidshare.com/files/49333643/wavi_test.zip.html Could you please do a little test to see whether it works well with your Flac stuff before I publish it?
Thanks for your job, but there are a important bug and never output WAVE_FORMAT_EXTENSIBLE, because:
...
// *(LPWORD)(wavHeader + headerPos) = waveFormat.wFormatTag; // must be (1)
*(LPWORD)(wavHeader + headerPos) = (wavexOutput ? 0xFFFE : waveFormat.wFormatTag);
...
if (wavexOutput) {
*(LPWORD)(wavHeader + headerPos) = 22;
headerPos += 2;
*(LPWORD)(wavHeader + headerPos) = waveFormat.wBitsPerSample; // (2)
headerPos += 2;
*(LPDWORD)(wavHeader + headerPos) = channelMask;
headerPos += 4;
*(LPWORD)(wavHeader + headerPos) = waveFormat.wFormatTag; // (3)
...
(1) the standard value of AudioFormat for WAVE_FORMAT_EXTENSIBLE is always 0xFFFE, for any kind of real audio format, the real audio format is write after (3).
The values written after (3) are only valid for PCM int/float, the only possible AviSynth output.
(2) Really this field is ValidBitsPerSample, but for all possible AviSynth output can be replaced safely by BitsPerSample
- Not important, but maybe if you want a generic default for channelMask, instead a invalid value:
if (wavexOutput && (channelMask == 0xFFFFFFFF)) {
if (waveFormat.nChannels < DEFAULT_MASK_COUNT) {
channelMask = DEFAULT_MASK[waveFormat.nChannels];
} else {
// channelMask = 0;
channelMask = (2^waveFormat.nChannels) - 1;
}
}
alvarez
16th August 2007, 21:34
Thanks for your job, but there are a important bug and never output WAVE_FORMAT_EXTENSIBLE
Hush... No wonder all the wavs I made played well :)
I've included your fixes, and the new version is available at:
http://sourceforge.net/projects/wavi-avi2wav/
Thanks for testing & fixing!
tebasuna51
16th August 2007, 22:40
Hush... No wonder all the wavs I made played well :)
Of course, is the patch to make a WAVE_FORMAT_EXTENSIBLE accepted for old software (I write a WavNotEx.exe patch exactly for this).
With AudioFormat at this place the wav is accepted by Sonic Foundry SoftEncode, BeSweet, AviSynth, and most players.
But it's not compliant with specs and we can't ensure the soft go to read MaskChannel at their position.
Flac send the message:
ERROR: WAVE has >2 channels but is not WAVE_FORMAT_EXTENSIBLE; cannot assign channels
I've included your fixes, and the new version is available at:
http://sourceforge.net/projects/wavi-avi2wav/
Thanks alvarez (a common spanish surname) :)
alvarez
16th August 2007, 23:41
Flac send the message:
ERROR: WAVE has >2 channels but is not WAVE_FORMAT_EXTENSIBLE; cannot assign channels
Hm... Please help me correctly interpret your post: does this only occur with the test version, or is it still the case with the one finally posted on SF? (in the latter I set the format tag in the base header to 0xFFFE).
Thanks alvarez (a common spanish surname) :)
Ironically, I got this nickname because I'm quite a nordic type and I can't really stand the sun on hot days, and once when I was on holiday in Greece I wore a sombrero-like straw hat large enough to block sunlight effectively :)
tebasuna51
17th August 2007, 01:54
Hm... Please help me correctly interpret your post: does this only occur with the test version, or is it still the case with the one finally posted on SF? (in the latter I set the format tag in the base header to 0xFFFE).
In test version, now wavi is perfect.
Flac don't accept WAVE_FORMAT_EXTENSIBLE input by STDIN but is a flac problem. Works fine with raw format.
We have a little, but powerful, tool to utilize all AviSynth audio features with free audio encoders with STDIN capabilities.
alvarez
17th August 2007, 10:13
In test version, now wavi is perfect.
Thanks! Maybe I'm a little paranoid (*), but (at least for me) it wasn't clear.
(*) Actually, I work as a programmer at one of the few software companies which give warranty for their products. Such a job normally makes you paranoid :)
DeathTheSheep
2nd September 2011, 11:20
New issue, many years later (this just shows how resilient and useful wavi proved to be):
"wavi.exe stopped working" is showing up more and more these days. On a fresh install of Win 7 with CCCP and AVISynth MT 2.6 (MediaFoundation disabled), a simple script served an avs to wavi and at the very end of the conversion, this message appears.
This message is also appearing a lot with BD-Rebuilder (quick Google search turns that info up).
Any ideas? Or if this program is 'dead', any alternatives? Any links to old bepipe?
tebasuna51
2nd September 2011, 13:27
Try with standard AviSynth 2.58, MT is in alpha stage and there are problems.
b66pak
2nd September 2011, 18:42
Chikuzen (http://forum.doom9.org/member.php?u=166972) has released a crash fix for wavi here (http://forum.doom9.org/showthread.php?t=161639)...try it and report back!
_
DeathTheSheep
3rd September 2011, 00:39
Chikuzen (http://forum.doom9.org/member.php?u=166972) has released a crash fix for wavi here (http://forum.doom9.org/showthread.php?t=161639)...try it and report back!
_
Perfect. It works flawlessly. I reckon the changes should be committed.
The bug also used to happen with the mpc-hc flv splitter and BD-rebuilder (regardless of ffdshow MT status), but happens no longer with this fix.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.