Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th April 2007, 16:35   #1  |  Link
Sagittaire
Testeur de codecs
 
Sagittaire's Avatar
 
Join Date: May 2003
Location: France
Posts: 2,484
AVS to WAV

How to convert avs audio files to wav ... ???

I try BePipe but there are win32 error ...
__________________
Le Sagittaire ... ;-)

1- Ateme AVC or x264
2- VP7 or RV10 only for anime
3- XviD, DivX or WMV9
Sagittaire is offline   Reply With Quote
Old 8th April 2007, 16:51   #2  |  Link
buzzqw
HDConvertToX author
 
Join Date: Nov 2003
Location: Cesena,Italy
Posts: 6,552
SoundOut

http://forum.doom9.org/showthread.php?t=120025

like this

Code:
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
__________________
HDConvertToX: your tool for BD backup
MultiX264: The quick gui for x264
AutoMen: The Mencoder GUI
AutoWebM: supporting WebM/VP8
buzzqw is offline   Reply With Quote
Old 8th April 2007, 21:05   #3  |  Link
smok3
brontosaurusrex
 
smok3's Avatar
 
Join Date: Oct 2001
Posts: 2,392
or
virtualdub, save wav? (you could script that via vdub.exe) or
mplayer maybe? ( mplayer -ao pcm -vo null file.avi )
smok3 is offline   Reply With Quote
Old 10th April 2007, 23:56   #4  |  Link
ADLANCAS
Registered User
 
ADLANCAS's Avatar
 
Join Date: Apr 2003
Location: Brazil
Posts: 247
or a command line avs2wav
http://home.pages.at/kassandro/avs2wav.rar
ADLANCAS is offline   Reply With Quote
Old 16th April 2007, 11:20   #5  |  Link
bh0k441
Registered User
 
Join Date: Apr 2007
Posts: 9
you can also try mplayer with the following commandline

mplayer -vc null -vo null -ao pcm:fast:waveheader:file=audio.wav -hardframedrop file.avs
__________________
http://bh0k441.googlepages.com/
Home to XYNcoder and FastCrypt
bh0k441 is offline   Reply With Quote
Old 16th April 2007, 16:40   #6  |  Link
Pookie
Registered User
 
Join Date: Apr 2005
Posts: 1,339
Hey, that worked! Needs the Sherpya Mplayer build.

http://oss.netfarm.it/mplayer-win32.php
Pookie is offline   Reply With Quote
Old 23rd June 2007, 11:59   #7  |  Link
alvarez
Registered User
 
Join Date: Jun 2007
Location: Budapest
Posts: 44
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:
alvarez is offline   Reply With Quote
Old 24th June 2007, 01:38   #8  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Quote:
Originally Posted by alvarez View Post
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):
Code:
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.

Last edited by tebasuna51; 24th June 2007 at 12:17.
tebasuna51 is offline   Reply With Quote
Old 24th June 2007, 14:29   #9  |  Link
alvarez
Registered User
 
Join Date: Jun 2007
Location: Budapest
Posts: 44
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...

Quote:
Originally Posted by tebasuna51 View Post
Looks like Bepipe but, maybe without .NET Framework dependence?
Indeed. I might be old-fashioned, but I prefer to avoid .NET whenever possible

Quote:
Originally Posted by tebasuna51 View Post
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.

Quote:
Originally Posted by tebasuna51 View Post
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):

Code:
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:
alvarez is offline   Reply With Quote
Old 24th June 2007, 15:54   #10  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Quote:
Originally Posted by alvarez View Post
...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.

Quote:
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 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 is offline   Reply With Quote
Old 24th June 2007, 21:48   #11  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
@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:
Code:
//  if (waveFormat.wFormatTag == WAVE_FORMAT_PCM ) {
    if (waveFormat.wFormatTag == WAVE_FORMAT_PCM || waveFormat.wFormatTag == WAVE_FORMAT_IEEE_FLOAT ) {

Last edited by tebasuna51; 24th June 2007 at 22:08.
tebasuna51 is offline   Reply With Quote
Old 26th June 2007, 12:54   #12  |  Link
alvarez
Registered User
 
Join Date: Jun 2007
Location: Budapest
Posts: 44
I've put support fot floating-point WAVs in.

Available here:
http://sourceforge.net/projects/wavi-avi2wav

Any other ideas?

:alvarez:
alvarez is offline   Reply With Quote
Old 3rd July 2007, 03:49   #13  |  Link
Alicedoom9
Registered User
 
Join Date: Mar 2007
Posts: 2
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_...udio_tools.htm
Alicedoom9 is offline   Reply With Quote
Old 11th August 2007, 00:55   #14  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Quote:
Originally Posted by alvarez View Post
I've put support fot floating-point WAVs in.

Available here:
http://sourceforge.net/projects/wavi-avi2wav

Any other ideas?
Yeah, a new idea

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.

Code:
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 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.
tebasuna51 is offline   Reply With Quote
Old 11th August 2007, 12:11   #15  |  Link
ACrowley
Registered User
 
Join Date: Apr 2006
Posts: 1,008
Steinberg Nuendo/Cubase can open and decompress wma/asf to wave too
ACrowley is offline   Reply With Quote
Old 12th August 2007, 21:32   #16  |  Link
alvarez
Registered User
 
Join Date: Jun 2007
Location: Budapest
Posts: 44
Hello,

Quote:
Originally Posted by tebasuna51 View Post
Here is 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:
alvarez is offline   Reply With Quote
Old 13th August 2007, 01:26   #17  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Quote:
Originally Posted by alvarez View Post
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
tebasuna51 is offline   Reply With Quote
Old 16th August 2007, 13:30   #18  |  Link
alvarez
Registered User
 
Join Date: Jun 2007
Location: Budapest
Posts: 44
@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,
__________________
:alvarez:
DVDforger - OGMcleaver - WAVI

Last edited by alvarez; 16th August 2007 at 20:36. Reason: deleted the link, see 2 posts below for the new version
alvarez is offline   Reply With Quote
Old 16th August 2007, 18:49   #19  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Quote:
Originally Posted by alvarez View Post
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:
Code:
  ...
//  *(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:

Code:
 if (wavexOutput && (channelMask == 0xFFFFFFFF)) {
      if (waveFormat.nChannels < DEFAULT_MASK_COUNT) {
              channelMask = DEFAULT_MASK[waveFormat.nChannels];
      } else {
//              channelMask = 0;
              channelMask = (2^waveFormat.nChannels) - 1;
      }
 }
tebasuna51 is offline   Reply With Quote
Old 16th August 2007, 20:34   #20  |  Link
alvarez
Registered User
 
Join Date: Jun 2007
Location: Budapest
Posts: 44
Quote:
Originally Posted by tebasuna51 View Post
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!
__________________
:alvarez:
DVDforger - OGMcleaver - WAVI
alvarez is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:29.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.