Log in

View Full Version : No sound from AVS script


TrueIndigo
14th November 2007, 20:17
Absolute newbie, been reading as much as I can about Avisynth for last couple of weeks, but still having problems with my first scripts. I import my HDV material through HDVSplit, and use Dgmpegdec to make separate d2v and mpa files from the original m2t files. I wrote a simple test avs script which had video playing through VirtualDubMod, but I can hear no sound (however the mpa file on its own can be heard in Windows Media Player ). Then I found someone mention a similar problem on a forum (I think it was neuron2’s forum) requiring a plugin called NicAudio. With this installed in the Avisynth plugins folder I wrote a simple script shown below which is intended to simply play a single video clip with sound, and reduce the picture size by half:


LoadPlugin("c:\Program Files\Avisynth 2.5\Plugins\DGDecode.dll")
LoadPlugin("c:\Program Files\Avisynth 2.5\Plugins\NicAudio.dll")
#
a = Mpeg2Source("d:\Video tests\Avisynth -- 1\Test--2\v1h2-1-1.d2v", upconv=1).ReduceBy2
b = NicMpaSource("d:\Video tests\Avisynth -- 1\Test--2\v1h2-1-1 MPA PID 814 DELAY oms.mpa", 2)
AudioDub = (a,b)

This script reports the following VirtualDub error:
Avisynth open error:
Script error: expected ‘)’
(D:\Video tests\Avisynth – 1Test—2\Reel—1.avs, line 6, column 14)

Can someone tell me what’s wrong with this script?

Other queries I have:

I have the plugins dll files in the Avisynth folder, yet I still have to write the full pathway to get them to work, why is this?

Loading the d2t file requires that it be changed to 4:2:2 ("upconv=1"), if I take this out of the script or use "upconv=0" the file will not load. Also, does this conversion from 4:2:0 to 4:2:2 degrade the picture at all? HDV is originally 4:2:0 so I thought it would be best to keep it like that.

Many thanks.

tsp
14th November 2007, 20:41
try this:

LoadPlugin("c:\Program Files\Avisynth 2.5\Plugins\DGDecode.dll")
LoadPlugin("c:\Program Files\Avisynth 2.5\Plugins\NicAudio.dll")

a = Mpeg2Source("d:\Video tests\Avisynth -- 1\Test--2\v1h2-1-1.d2v", upconv=1).ReduceBy2()
b = NicMpaSource("d:\Video tests\Avisynth -- 1\Test--2\v1h2-1-1 MPA PID 814 DELAY oms.mpa", 2)
AudioDub(a,b)

TrueIndigo
15th November 2007, 17:01
Thanks tsp for answering this. I’ve got my simple scripts working again, but only if I don’t include a sound track! I double checked that the NicAudio.dll is in the Avisynth plugins folder (it is). For some reason, I have not been able to get sound yet with any script I’ve written. Any ideas? Here’s an example of my simple script (single video clip which has the file name showing bottom-left in the frame):

LoadPlugin("c:\Program Files\Avisynth 2.5\Plugins\DGDecode.dll")
LoadPlugin("c:\Program Files\Avisynth 2.5\Plugins\NicAudio.dll")
#
a = MPeg2Source("d:\Video tests\Avisynth -- 2\v1h2-1-1.d2v", upconv=1).Subtitle("v1h2-1-1.d2v", font="Arial", size=24, text_color=$FFFFFF, halo_color=$000000, align=1).ReduceBy2()
b = NicMpaSource("d:\Video tests\Avisynth -- 2\v1h2-1-1 MPA PID 814 DELAY oms.mpa",2)
AudioDub(a,b)

This script produces the following VirtualDub error:

Avisynth open failure:
M2Audio MPASource: unable to open file: "d:\Video tests\Avisynth – 2\v2h1-1 MPA PID 814 DELAY oms.mpa"

Thanks.

St Devious
15th November 2007, 17:53
u need to write audio=true , i guess , coz thats wat's done in megui's avisnth script creator .

Didée
15th November 2007, 17:59
...DELAY oms.mpa"
And if you replace the "o" (letter) with "0" (number)? Cause I'd expect a number in that place, not a letter ...

TrueIndigo
17th November 2007, 13:35
Didee -- very eagle-eyed: the zero was a small o. I had been cut/pasting bits of my test scripts and that typo followed me around all through. I poured over that simple script and could see nothing wrong. Many thanks.

Woolf2009 -- thanks for the tip, but since fixing my typo solved the sound problem I didn’t try "audio=true", and now I will be using avi’s not mpg’s (see below). Thanks for your input.

I now have sound, but it proved what I suspected, that my computer is not up to processing HDV, even with reduced resolution frame sizes (I’ve got a P4 3.0 Ghz, SATA 1 drive, 2 GB RAM). When I play my scripts out through VirtualDubMod it only takes a few seconds before the sound starts stuttering. I can pause and then play again, and for a few seconds I have sync and then it starts to get left behind again. This is no good even for simple editing, so I will need to use proxies after all. I made a reduced size avi and that plays fine, just as I am used to seeing with standard definition footage. For some reason AviSource didn’t work but DirectShowSource did. The coding problems are giving me grey hairs but I really like the core level control that this frame server concept brings to video work. I’m looking forward to learning more about writing avs files for my simple needs: thanks everyone for helping me out. I thought the solution to this problem might help out other newbies, but since it was just a typo I guess not many people will be as stupid as me!

Many thanks,
TrueIndigo.

IanB
17th November 2007, 21:11
DirectShowSource() uses DirectShow codecs.

AviSource() uses VFW codecs. (It is actually the code from VirtualDub circa 1.4.???) So as a test try opening your .AVI directly in VirtualDub. (VDub 1.7 now also has provision for source pluggins)

TrueIndigo
18th November 2007, 19:57
Thanks IanB. I don't understand about video codecs.

I opened the avs script (below) in VirtualDubMod:

LoadPlugin("c:\Program Files\Avisynth 2.5\Plugins\DGDecode.dll")
LoadPlugin("c:\Program Files\Avisynth 2.5\Plugins\NicAudio.dll")
a = MPeg2Source("d:\Video tests\Avisynth -- 3\v1h2-1-1.d2v", upconv=1).ReduceBy2()
b = NicMpaSource("d:\Video tests\Avisynth -- 2\v1h2-1-1 MPA PID 814 DELAY 0ms.mpa",2)
AudioDub(a,b)

From this I saved an avi file using the Indeo video 5.10 codec. It played directly in VirtualDubMod without a problem. I then made an avs file (below) to reference this avi.

aviSource("d:\Video tests\Avisynth -- 3\v1h2-1-1.avi")

This single line of code provokes the following warning in VirtualDubMod:

Some warnings were issued during the previous operation: Couldn't locate decompressor for format "YV12" (unknown). VirtualDub requires a Video for Windows (VFW) compatible codec to decompress video. DirectShow codecs, such as those used by Windows Media Player, are not suitable. Only Direct stream copy is available for this video.

However, this code works fine:

DirectShowSource("d:\Video tests\Avisynth -- 3\v1h2-1-1.avi")

I tried a different codec called Morgan mjpeg2000, and using the same AviSource code it opened without a problem. How is it possible to know if a codec is VFW or DirectShow? And are their any advantages of one over another as far as Avisynth is concerned?
Thanks.

Adub
18th November 2007, 21:15
You need a decompressor for YV12. A basic xvid install will work fine, or enabling xvid support in ffdshow under the vfw settings should work as well.

TrueIndigo
19th November 2007, 20:20
Thanks Merlin7777, this has been the missing link. I’ve been trying to read up about YV12, to understand this better. Since my computer is not up to handling HDV material, I’d like to open an Avisynth script in VirtualDubMod (referencing the d2t and mpa files and reduce the frame size) in order to save an avi copy which my computer can handle for an offline edit. I don’t have a YV12 decompressor yet. Is their any difference between DivX5 or XviD with regard to Avisynth?
Thanks.

Adub
20th November 2007, 00:52
Just go with Xvid, as everyone on this forum uses it, it's free, open source, and makes you feel warm inside.

TrueIndigo
20th November 2007, 11:15
Thanks!