Log in

View Full Version : AviSynth mistakes AC3 for PCM??


asarian
28th January 2009, 20:08
Please, consider the following simple avs script:


video=DirectShowSource("M:\burn\killbill1.m2ts",audio=false).ConvertToYV12()

video=Crop(video, 0, 140, 0, -140)

Loadplugin("C:\Program Files\AviSynth 2.5\plugins\VSFilter\VSFilter.dll")
video=TextSub(video,"C:\video\killbill1.ass",-1,23.976)

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\NicAudio\NicAudio.dll")
audio=NicAC3Source("C:\video\killbill1.ac3")
AudioDub(video,audio)

ConvertToRGB


This method has always worked flawlessly. But now I'm getting a silly audio error (ACM wrapper::Output):

"Media Player Classic could not render some of the pins in the graph."


Stream 2
ACM Wrapper

--------------------
MEDIA TYPE 0:
--------------------
[AM_MEDIA_TYPE]
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: MEDIASUBTYPE_PCM {00000001-0000-0010-8000-00AA00389B71}
formattype: FORMAT_WaveFormatEx {05589F81-C356-11CE-BF01-00AA0055595A}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 12
cbFormat: 18

[WAVEFORMATEX]
wFormatTag: 0x0001
nChannels: 6
nSamplesPerSec: 48000
nAvgBytesPerSec: 576000
nBlockAlign: 12
wBitsPerSample: 16



And then keeps blabbing it can't find a codec to play my PCM audio? Excuse me?! It's AC3 audio, not PCM! (I double-checked). I used AviSynth 2.5.7, 2.5.8 too, the latest Haali media splitter + ffdshow, but nothing makes a difference. Any way I can fix this? (whatever is causing it). Or does anyone know how to troubleshoot this further?

IanB
28th January 2009, 21:56
No, excuse me it is PCM, Avisynth source filters always decode everything to either raw PCM audio or raw uncompressed video....
audio=NicAC3Source("C:\video\killbill1.ac3")
...If you do not want it decoded then you will have to feed the .ac3 file directly into the player along with a video only avisynth script.

And something must be borked in your setup, PCM is raw, uncompressed audio and should not need any codec and should play just fine.



Hint :- Do not blindly .ConvertToYV12() when you are later going to ConvertToRGB unless you are using filters that explicitly only work with YV12. Just accept the format the source filter provides and work from there.

In this case it will probably be YV12 anyway, but could just as easily be YUY2 (or an outside chance it's RGB already). The format conversions are not lossless and do take some cycles to compute.

asarian
28th January 2009, 22:16
No, excuse me it is PCM, Avisynth source filters always decode everything to either raw PCM audio or raw uncompressed video....
audio=NicAC3Source("C:\video\killbill1.ac3")
...If you do not want it decoded then you will have to feed the .ac3 file directly into the player along with a video only avisynth script.

And something must be borked in your setup, PCM is raw, uncompressed audio and should not need any codec and should play just fine.

Hint :- Do not blindly .ConvertToYV12() when you are later going to ConvertToRGB unless you are using filters that explicitly only work with YV12. Just accept the format the source filter provides and work from there.

In this case it will probably be YV12 anyway, but could just as easily be YUY2 (or an outside chance it's RGB already). The format conversions are not lossless and do take some cycles to compute.

Thanks! Didn't know AviSynth always converts to PCM. That explains a lot. :)

Actually, this is just a test script I use to preview and sync subtitles (for which I need audio too). So I generally just convert to AC3 to get at least some audio for the preview.

The ConvertToYV12() comes from RipBot264 that uses it. I will go ask in that forum whether I can just remove it (no need, indeed, to waste cycles and quality).

P.S. As we speak, I solved it! :) While ffdshow had lpcm enabled, somehow 'ucompressed' (very last codec entry) had become disabled. Sigh.