View Full Version : WAVSource error
TCmullet
12th June 2015, 15:35
This should be a very simple thing to do. But I cannot get WAVSource to open a simple everyday stereo .wav file. I'm not sure I ever have before.
This script works fine:
SetMemoryMax(2048)
SetMTMode(3,4)
video = LWLibavVideoSource("C:/Video-Work/TGF-Double-agent-nutrients/MyVideo.mp4")
audio = LWLibavAudioSource("C:/Video-Work/TGF-Double-agent-nutrients/MyVideo.mp4")
#video = LWLibavVideoSource("C:/Video-Work/TGF-Double-agent-nutrients/MyVideo.mp4")
#audio = WAVSource("C:/Video-Work/TGF-Double-agent-nutrients/MyAudio.wav")
AudioDub(video, audio)
But this code bombs:
SetMemoryMax(2048)
SetMTMode(3,4)
#video = LWLibavVideoSource("C:/Video-Work/TGF-Double-agent-nutrients/MyVideo.mp4")
#audio = LWLibavAudioSource("C:/Video-Work/TGF-Double-agent-nutrients/MyVideo.mp4")
video = LWLibavVideoSource("C:/Video-Work/TGF-Double-agent-nutrients/MyVideo.mp4")
audio = WAVSource("C:/Video-Work/TGF-Double-agent-nutrients/MyAudio.wav")
AudioDub(video, audio)
The MyAudio.wav file is a simple stereo 16-bit audio that I had created from "save wav" in Virtualdub and made some changes with my everyday audio editor, CoolEdit.
The 2nd script bombs with the message:
Avysynth open failure:
AVIFileSource: couldn't open file
'C:/Video-Work/TGF-Double-agent-nutrients/MyAudio.wav'
Then it gives the script line number 9.
What the heck is going on?
Wilbert
12th June 2015, 15:41
Could you upload such a wav file?
TCmullet
12th June 2015, 15:47
Could you upload such a wav file?The video and audio are an hour long, so the size is prohibitive.
I was hoping someone would see something obvious (or inferred) by what I have here, and show me how I'm doing things wrong. I've used alternate sound tracks in Virtualdub and other platforms many times. I guess this is the first time I'm trying to do so in Avisynth.
sneaker_ger
12th June 2015, 15:52
No one needs the video. Cut out the first 10 MB of the wav file using e.g. DGSplit (http://neuron2.net/dgsplit/) and upload them to a file hoster of your choice. (sendspace.com, mediafire.com, mega.co.nz etc.)
qyot27
12th June 2015, 15:58
That error message occurs when there's something in the path that can't be parsed:
D:\dap\vid\Incoming Files>echo WAVSource("Qyöt27 - ...Whatever... distro.wav")>test.avs
D:\dap\vid\Incoming Files>mpv test.avs
Playing: test.avs
[ffmpeg/demuxer] avisynth: AVIFileSource: couldn't open file 'Qyt27 - ...Whatever... distro.wav'
[ffmpeg/demuxer] (test.avs, line 1)
[lavf] avformat_open_input() failed
Failed to recognize file format.
Exiting... (Errors when loading file)
D:\dap\vid\Incoming Files>echo WAVSource("distro.wav")>test.avs
D:\dap\vid\Incoming Files>mpv test.avs
Playing: test.avs
[ffmpeg/demuxer] avisynth: No compatible ACM codec to decode 0x00FF audio stream to PCM.
[ffmpeg/demuxer] (test.avs, line 1)
[lavf] avformat_open_input() failed
Failed to recognize file format.
Exiting... (Errors when loading file)
D:\dap\vid\Incoming Files>
In the above example, it was the ö that caused the problem (and then that I was deliberately not giving it PCM, but that's not relevant here except for showing the error messages differ). More precisely, that echo wasn't able to transfer it into the script, so the filename had been mangled before AviSynth got to it. I'd imagine this can also happen if you're trying to use Unicode characters in filenames, because AviSynth doesn't support Unicode.
Remove the absolute paths and see if that fixes it. It's less error-prone to deal with relative paths, unless you're auto-generating them by using echo or a path copying function where you have no input into the matter at all.
TCmullet
12th June 2015, 16:55
But I don't have ANY strange characters like your sideways colon. And I was told long ago to always have absolute paths, even though it's a pain. Uh, I don't even remember "how" to do relative paths. What folder is the "current path" in this context??? I don't want to move any of my media files into something like the Avisynth program folder if that's where you're going. I have way too many projects to stuff them all in THERE.
Shall I proceed with providing a short .wav sample? I've just created a 30 sec sample, which also bombs in the wavsource script, and am working to upload it.
TCmullet
12th June 2015, 17:01
No one needs the video. Cut out the first 10 MB of the wav file using e.g. DGSplit (http://neuron2.net/dgsplit/) and upload them to a file hoster of your choice. (sendspace.com, mediafire.com, mega.co.nz etc.)
Here is the short sample, which also caused the failure when it's included in the script:
http://www.tomsgoodfiles.com/MyAudio.30sec.wav
(I'm hosting it on my own website's server.)
Groucho2004
12th June 2015, 17:04
Have a look at this thread (http://forum.videohelp.com/threads/295610-AviSynth-s-WavSource-won-t-load-WAVE-PCM-files).
TCmullet
12th June 2015, 18:07
Have a look at this thread (http://forum.videohelp.com/threads/295610-AviSynth-s-WavSource-won-t-load-WAVE-PCM-files).
If you're suggesting that some registry entries of mine are missing somehow, I checked my registry and it has all the items described in that 2008 Videohelp.com thread.
Groucho2004
12th June 2015, 18:11
If you're suggesting that some registry entries of mine are missing somehow, I checked my registry and it has all the items described in that 2008 Videohelp.com thread.
I had the same problem/error message with WAVSource, the registry entries fixed it.
TCmullet
12th June 2015, 18:27
I had the same problem/error message with WAVSource, the registry entries fixed it.
As I've stated, my registry entries were already there. I'm glad that in your case, they weren't and you were able to supply the missing stuff. But this raises a question. What entity is supposed to have created them and why would that process fail??
Groucho2004
12th June 2015, 18:39
Try again with a path+filename length < 48 characters.
Edit: Ignore this.
tebasuna51
12th June 2015, 19:11
Maybe the problem is because the wav file have a strange format:
File ........: D:\Internet\MyAudio.30sec.wav
Size ........: 5287984 bytes
---------------------------------------------- Header Info
ChunkID .....: RIFF
RiffLength ..: 5287976
Container ...: WAVE
SubchunkID ..: fmt (Length: 16)
AudioFormat .: 3 (Float)
NumChannels .: 2
SampleRate ..: 44100
ByteRate ....: 176400
BlockAlign ..: 4
BitsPerSample: 16
SubchunkID ..: data (Length: 5287940)
Offset data .: 44
Duration ....: 29.97698 sec., (0h. 0m. 29.97698s.)
------------------------------------------------- End Info
Try to save with CoolEdit in 16/24 bits int or 32 float.
16 bits float is not supported.
TCmullet
12th June 2015, 19:34
Maybe the problem is because the wav file have a strange format:
Try to save with CoolEdit in 16/24 bits int or 32 float.
16 bits float is not supported.
AHAAA! Thanks for spotting that! That's a problem that's happened before. But the only way it's hit me before is when I attempt to convert to .flac.
It's a bug in CoolEdit96 that under weird circumstances starts to set that flag to 3 instead of 1. This has only happened on my other machine where I sometimes open MagicJack voice messages with Cooledit. When I do, a 3 gets set into the cool.ini file at offset 14H (via "FileOptions=3" in cool.ini). (The MJ .wav files are encoded to non-PCM.) I don't know how to prevent that .ini file from getting changed to 3, but I have many times set it back to 1 and had to test repeatedly to ensure that it's gone back to saving .wav files correctly. To fix the bad .wav files, I have to use Virtualdub's hex file editor to change that one byte at offset 14H. It's weird as once the .ini gets "f_cked up", all file saves are bad EVEN IF the source file I load into Cooledit was good.
I just fixed my two .wav files for this project (the long one and the short one), and ALL IS WELL! THANKS to all who attempted help, and especially Tebasuna for having and using his riff header editor to show the bad '3' there.
I may have many dozens of .wav files to correct. This is the first .wav edited on this PC that is going into a video. The rest would never have been caught until I one day would attempt to .flac them and Flac would barf. There are a couple of other audio-related programs that barf, but many do not, including Cooledit.
qyot27
12th June 2015, 19:37
And I was told long ago to always have absolute paths, even though it's a pain.
Absolute paths are only necessary if you want to house your scripts somewhere separate from the files you're trying to open. That's where that advice came from, but it's not universally true of how people will be using AviSynth.
Even though it's common to see it, it's incredibly bad advice to give in beginner's guides, because most of the time when starting out, you do put the script and media file in the same folder, which means making the user type out the whole path is far easier to get wrong in addition to being annoying and unnecessary.
The annoyance can be lessened/eliminated if you have something to copy paths so you don't have to type it out. I'm pretty sure Vista and higher have this by default if you hold Shift while bringing up the right-click menu, or you could use a shell extension like Ninotech Path Copy. The advantage of using this method is that there's zero chance of misspelling the filename/path.
Uh, I don't even remember "how" to do relative paths. What folder is the "current path" in this context??? I don't want to move any of my media files into something like the Avisynth program folder if that's where you're going. I have way too many projects to stuff them all in THERE.
If the script is in the same folder as the media file, the relative path is just the name of file. Simple as that. Any amount of path relativity is judged from the location of the script you're writing.
TCmullet
12th June 2015, 19:43
If the script is in the same folder as the media file, the relative path is just the name of file. Simple as that. Any amount of path relativity is judged from the location of the script you're writing.
Great! Thanks! Somehow in my little bit of early dabbling w/Avisynth several years ago, I was led to the belief that to not have paths requires me to put all media files where the avisynth executable is. Freaked me out a bit. I hate specifying full paths. I always keep .avs in same folder with media file. Will check this out.
qyot27
12th June 2015, 19:46
And testing with the file provided, WAVSource actually does find and open it on here (with AviSynth+ r1825), although due to the format issue tebasuna51 mentioned, the sound is garbled.
TCmullet
12th June 2015, 20:13
And testing with the file provided, WAVSource actually does find and open it on here (with AviSynth+ r1825), although due to the format issue tebasuna51 mentioned, the sound is garbled.
Odd that it would work at all, unless the logic that processes WavSource() has changed. I am very UNclear as to the evolution of Avisynth versions and how that all works. My version is currently "2.60, build: Jan 25 2015 [17:03:53]", and I use it for InterFrame work. (InterFrame comes or comes out of the SVP Project. I believe they have special versions of Avisynth).
qyot27
12th June 2015, 23:21
Probably OS related instead: Win7 has a known issue with 32-bit Float that's not got a WAVEFORMATEXTENSIBLE header. I'm using XP on this machine.
http://avisynth.nl/index.php/AviSource#Windows7_users
Wilbert
13th June 2015, 14:22
His sample above is 16-bit float. Results in garbled audio on XP too. Guess we need to throw an error if wFormatTag=3 and wBitsPerSample<>32?
edit:
Is it possible that ffmpeg doesn't recognize this 16-bit float format? When doing ffprobe on that file, it says
Could not find codec parameters for stream 0 (...)
foxyshadis
15th June 2015, 19:20
It's not float16 at all, it's int16 that's mislabeled and sounds fine if you import raw (stereo int16le). Good ol' 20-year-old CoolEdit bug.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.