Log in

View Full Version : no audio using directshow


fenomeno83
6th July 2010, 20:14
Hello..
I'm using this 2d-3d filter


## 2D to 3D Realtime Video Conversion Avisynth script v0.3b MultiThreading
## Made by Anton Belev at 3D Vision Blog
## http://www.3dvision-blog.com
## Additionally extended by Martin Haverland at audiomh.de for quality resize
## and different output modes including interlaced format for use in non-3d specific players e.g. windows media player.


## For this to work you need to have AviSynth with MT mod 0.7 installed!!!
SetMTMode(2,0)


## Open the video file for conversion, change the video file name
video2d = DirectShowSource("C:\test.mp4")



## Increase video brightnes on dark videos, good for 3D Vision owners
# video2d = video2d.Tweak(Bright=10)

## Convert to RGB32 to avoid the width restrictions
video2d = ConvertToRGB32(video2d)


## Optional aspect ratio maintaining quality resize for 3d monitor target resolution.
## Very cpu intensive, may be for offline use only, e.g. in virtualdubmod.
## 2x 3.0ghz cpu may give you a framerate of 16fps while running the whole script in virtualdubmod including xvid compression in HDTV quality saving setting.
## Offers great quality in the result video for fullscreen playback in every .avs capable player later.
## Also reduces ghosting if the original file resolution is smaller than the target resolution.
# videoW = width(video2d)
# videoH = height(video2d)
## For 19" Zalman use 1280, for 22" Zalman Trimon it is 1680 etc.
# hzTargetSize = 1280
# video2d = Lanczos4Resize(video2d, hzTargetsize, hzTargetsize * videoH / videoW)
## Commenting out the above resizing maintains realtime capability!


## Get video width/height and set the frame stretch factor
## Lower the value 100 to increase frame stretch, may introduce ghosting
videoW = width(video2d)
videoH = height(video2d)
ResW = videoW + (videoW / 100)
CropW = (ResW - videoW) / 2


## Create variables for left and right frame with one frame difference
## This is the Plufrich-like simulation that creates illusion of depth from movement
f1 = video2d
f2 = DeleteFrame(video2d, 0)


## Stretch the right frame to further the depth effect
f1 = LanczosResize(f1, ResW, videoH)
f1 = Crop(f1, 0, 0, videoW, videoH)

## Stretch the left frame to further the depth effect
f2 = LanczosResize(f2, ResW, videoH)
f2 = Crop(f2, CropW, 0, videoW, videoH)


## Output the two video frames in a side-by-side / parallel format
## Use this as a default for playing back on 3D Vision (Side by Side L/R)
StackHorizontal(f2, f1)

## Output the two video frames in a Above/Below format (like Sony?)
# StackVertical(f2,f1)


## Output the two video frames in a page flipping format for shutter glasses etc.
## The Tweak as proposed by eslave is for brighter image, modify the value 30
# f1 = f1.ConvertToYV12.Tweak(Bright=30)
# f2 = f2.ConvertToYV12.Tweak(Bright=30)
# Interleave(f2,f1)


## Output the two video frames in anaglyph red-cyan as proposed by eslave
# MergeRGB(f2.ShowRed, f1.ShowGreen, f1.ShowBlue)

## For reversed anaglyph i.e. cyan-red
# MergeRGB(f1.ShowRed, f2.ShowGreen, f2.ShowBlue)


## Output the two video frames in anaglyph yellow-blue as proposed by eslave (untested)
# f1 = f1.ConvertToYV12(matrix="PC.601").tweak(bright=12.5, sat=1.25, coring=false)
# f1 = f1.ConvertToRGB32
# f1 = f1.Levels(0, 1.05, 255, 0, 255, coring=false)
# MergeRGB(f2.ShowRed, f1.ShowGreen, f1.ShowBlue)

## Output the two video frames in anaglyph blue-Yellow as proposed by eslave (untested)
# f2 = f2.ConvertToYV12(matrix="PC.601").tweak(bright=12.5, sat=1.25, coring=false)
# f2 = f2.ConvertToRGB32
# f2 = f2.Levels(0, 1.05, 255, 0, 255, coring=false)
# MergeRGB(f1.ShowRed, f2.ShowGreen, f2.ShowBlue)


## Output two video frames in Interlaced mode
## Ueed for Zalman Trimon, Acer Aspire 3D etc.
# f1 = SeparateFields(f1)
# f1 = SelectEven(f1)
# f2 = SeparateFields(f2)
# f2 = SelectOdd(f2)
# interleave(f2,f1)
# AssumeFieldBased()
# weave()


Problem is that with some movies audio doesn't work!
For example, a classical phone recorded movie in mpeg4 with aac audio, audio doesn't work!
I tried also ffmpeg2, but audio doesn't work.. How can I solve?
thanks

fenomeno83
7th July 2010, 09:31
help me please..why audio doesn't work using directshowsouce or ffmpeg2source for a mpe4g asp with aac audio? haali media splitter is automatic opened when a launch avisynth script with player

Gavino
7th July 2010, 10:15
What do you mean by "doesn't work"?
Any error message?
Is audio missing, silent or garbled?
Use Info() to see what audio Avisynth is receiving.

Does the audio play correctly in Windows Media Player?

fenomeno83
7th July 2010, 21:22
What do you mean by "doesn't work"?
Any error message?
Is audio missing, silent or garbled?
Use Info() to see what audio Avisynth is receiving.

Does the audio play correctly in Windows Media Player?
means that is silent..
or better, using direcshowsource audio is too much fast, while with ffmpegsource is silence..
with kmplayer, stereoscopic player etc..

I don't have problem with original movie, but I have audio problems with avs that process the movie

with directshowsource and info():
has audio: yes
audio channel: 6
samples type: float 32 bit
samples per second: 16000

orignal is aac 16khz but mono (not 6 channels :D)

with ffmpegsource 2 and info()
has audio: no

fenomeno83
8th July 2010, 20:04
?????

Gavino
8th July 2010, 20:36
What does MediaInfo say about the source file?

You say audio is too fast. Can you quantify that?
If it is 6x too fast, that would be consistent with Avisynth treating mono samples as 6-ch. (It doesn't explain why it should do that, of course.)

fenomeno83
9th July 2010, 00:04
Media info:

Generale
Nome completo : C:\Users\Alessandro\Desktop\Video032.mp4
Formato : MPEG-4
Profilo del formato : Base Media / Version 2
Codec ID : mp42
Dimensione : 16,2 Mb
Durata : 18s 688ms
BitRate totale : 7 283 Kbps
Data di codifica : UTC 2010-04-05 14:00:57
Data : UTC 2010-04-05 14:00:57

Video
ID : 1
Formato : MPEG-4 Visual
Profilo del formato : Simple@L6
Impostazioni del formato, BVOP : No
Impostazioni del formato, QPel : No
Impostazioni del formato, GMC : No warppoints
Impostazioni del formato, Matrix : Default (H.263)
Codec ID : 20
Durata : 18s 625ms
Modalità : Costante
BitRate : 7 256 Kbps
BitRate nominale : 9 227 Kbps
Larghezza : 1 280 pixel
Altezza : 720 pixel
AspectRatio : 16:9
Modalità FrameRate : Costante
FrameRate : 24,000 fps
ColorSpace : YUV
ChromaSubsampling : 4:2:0
BitDepth/String : 8 bits
Tipo di scansione : Progressivo
Bit/(Pixel*Frame) : 0.328
Dimensione della traccia : 16,1 Mb (99%)
Data di codifica : UTC 2010-04-05 14:00:57
Data : UTC 2010-04-05 14:00:57

Audio
ID : 2
Formato : AAC
Formato/Informazioni : Advanced Audio Codec
Versione del formato : Version 4
Profilo del formato : LC
Impostazioni del formato, SBR : No
Codec ID : 40
Durata : 18s 688ms
Modalità : Costante
BitRate : 48,0 Kbps
Canali : 1 canale
Posizione dei canali : Front: C
SamplingRate : 16,0 KHz
Dimensione della traccia : 110 KiB (1%)
Data di codifica : UTC 2010-04-05 14:00:57
Data : UTC 2010-04-05 14:00:57


you can try file with directshow or ffmpegsource2 or others?
http://www.zshare.net/download/781179010ab4a9c3/

tebasuna51
9th July 2010, 02:51
Your audio isn't mono, is:
Audio format : AAC-HE v2 (LC+SBR+PS)
Channels ....: 2
SampleRate ..: 32000 Hz.
Total Frames : 292
Total Samples: 299008
Data Length .: 112292 bytes
Duration trak: 18.688 sec., (0h. 0m. 18.688s.)
BitRate .....: 48 Kb/s

You can decode the audio with NeroAacDec:

NeroAacDec -if Video032.mp4 -of audio.wav

Or with Foobar2000.

fenomeno83
9th July 2010, 09:47
Your audio isn't mono, is:
Audio format : AAC-HE v2 (LC+SBR+PS)
Channels ....: 2
SampleRate ..: 32000 Hz.
Total Frames : 292
Total Samples: 299008
Data Length .: 112292 bytes
Duration trak: 18.688 sec., (0h. 0m. 18.688s.)
BitRate .....: 48 Kb/s

You can decode the audio with NeroAacDec:

NeroAacDec -if Video032.mp4 -of audio.wav

Or with Foobar2000.
my audio IS mono...many tools make this error to show double channels and double sampling rate..original is 16khz mono, not 32khz stereo..it's sure, is a phone with a mono recording..
so, I don't want encode, I want open video using avisynth and listen also audio, without encode audio before..I don't think that it isn't possibile

tebasuna51
9th July 2010, 12:19
Maybe your original audio was mono 16khz, but the audio stream in the Video032.mp4 is encoded like AAC-HE v2 (LC+SBR+PS) 32 KHz.

My tool analize the atoms in mp4 container and found this.
NeroAacDec (for me the reference decoder for m4a) found this.
Foobar2000 (always one of the best audio players) found this.
MPC-HC with ffdshow to play audio, the same.

There are tools than don't recognize the SBR (16KHz -> 32KHz) and PS (mono -> stereo) extensions in AAC audio and can show the stream like mono 16 KHz.

fenomeno83
9th July 2010, 14:38
Maybe your original audio was mono 16khz, but the audio stream in the Video032.mp4 is encoded like AAC-HE v2 (LC+SBR+PS) 32 KHz.

My tool analize the atoms in mp4 container and found this.
NeroAacDec (for me the reference decoder for m4a) found this.
Foobar2000 (always one of the best audio players) found this.
MPC-HC with ffdshow to play audio, the same.

There are tools than don't recognize the SBR (16KHz -> 32KHz) and PS (mono -> stereo) extensions in AAC audio and can show the stream like mono 16 KHz.

So do you say that my phone take audio with a (has 1 microphone) and encode it using 2 channel?
I don't understand this..it hasn't sense...
so is used not aac lc, but aac he v2??
I don't know how works aac he with parametric stereo (version 2), but has sense take mono audio and encode to stereo?
edit: I read about aac he v2, but it isn't used to recreate frequency that original audio doens't have and recreate a channel that original doesn't have

tebasuna51
9th July 2010, 19:14
Of course both decoded channels are identical and a spectral analysis don't show frequencies over 9 KHz.
Then maybe the SBR and PS parts are near empty, but a correct decoder must output stereo 32 KHz.
Maybe your phone encoder make this to be compliant with stereo headphones and hardware players without support for 16 KHz samplerate, I don't know.

I can't play correctly your file with (VirtualDub or MPC-HC):
DirectShowSource("D:\Internet\Video032.mp4")

But this .avs work fine for me:

video=DirectShowSource("D:\Internet\Video032.mp4", audio=false)
audio=BassAudioSource("D:\Internet\Video032.mp4")
AudioDub(video,audio)

BassAudio.dll plugin included in last BeHappy release.

fenomeno83
13th July 2010, 17:20
thanks, in this manner works..but i don't understand how apply in original script of first post

b66pak
13th July 2010, 18:21
replace:

video2d = DirectShowSource("C:\test.mp4")

with (edit path and names according to your needs!):

video=DirectShowSource("D:\Internet\Video032.mp4", audio=false)
audio=BassAudioSource("D:\Internet\Video032.mp4")
video2d = AudioDub(video,audio)

get BassAudio.dll, bass.dll and bass_aac.dll from BeHappy (http://www.codeplex.com/BeHappy) and copy them in avisynth's "plugins" folder...
_

fenomeno83
14th July 2010, 00:01
replace:



With (edit path and names according to your needs!):



Get bassaudio.dll, bass.dll and bass_aac.dll from behappy (http://www.codeplex.com/behappy) and copy them in avisynth's "plugins" folder...
_

thanks!!!