View Full Version : Simple Audio Problem
tacman1123
28th September 2008, 13:51
I have an avi file that I created from a miniDV camcorder tape. When I play it in WMP, the audio is fine, but when I run it through AviSynth, I don't hear the audio.
DirectShowSource("c:\avi\tapes\ab.avi")
I've tried adding video=false (and explicitly setting audio=true) to the params, to see if I'd get an error message, but nothing.
Again, the avi file plays, with audio, in WMP and in other video players (e.g. GOM).
Other avi files play through AviSynth fine, although those were captured "live" from the video camera, rather than through the tape. However, I can't see how that would make a difference to AviSynth.
I've tried loading with AviSource and AviFileSource as well, no changes.
There's no audio codec associated with the video file (video is DV Video Decoder).
Thanks for any suggestions on where to look.
Tac
Atak_Snajpera
28th September 2008, 15:13
Extract audio from avi (use ffmpeg)
then use this script
video=DirectShowSource("...\*.avi',audio=false)
audio=DirectShowSource("...\*.wav,video=false)
AudioDub(video,audio)
tacman1123
28th September 2008, 16:08
Thx, how do I go from avi to wav? I have a windows version ffmpeg, but can't find the command to do that.
I've tried other problems (like avi2wav and SoundOut), and am not getting anything in the wav file, which is sorta what I'd expect. But I can't figure out why it would play at all in GOM and WMP and not in AviSynth. I assume it uses the same Graph Filters, but I suspect that I'm wrong about that, and that there's some filter that's messing things up.
I've confirmed that it only happens when I'm downloading video from a DV Tape, not video from the DV Camera (live). I've written to the author of the software I'm using (Vidgrab, a powerful video library for programmers), but since I hear the audio in the avi file, I'm hoping I can fix it in AviSynth.
I also need the wav file (in fact, I wish I could record audio and video to separate files, but that's a different issue).
Syntax for using ffmpeg to extract the wav would be great, I've googled for it, and am not finding anything.
Thx,
Tac
Gavino
28th September 2008, 16:14
Perhaps it's the 'wrong' sort of DV avi file - type 1 when it needs to be type 2, or vice versa. Although DirectShowSource should be able to handle both.
Do you have the option to recapture in the 'other' format?
Or run a converter program (google dv converter).
45tripp
28th September 2008, 16:15
ffmpeg -i ab.avi -vn -acodec copy out.wav
tacman1123
28th September 2008, 17:06
@gavino: They appear to be Type 1. I've tried re-capturing with Vidgrab using every combination I can think of (checking "Audio Out of Video Capture Device", selecting "Audio Device Rendering", etc., but no difference. When I turn off "Capture in Native Format", it creates a Type 2 file, but then I lose the all-important DV Timestamp for each frame, which is critical to my project.
@45tripp: Thanks! This worked on a tiny file that exhibited the problem, but then ffmpeg crashed on still-small but larger (about 300 meg) file. I then upgraded to the lastest version of ffmpeg, and it still's failing.
While I suspect the problem is with Datastead's vidgrab, it's hard to prove that the problem is theirs when the avi file plays in WMP and GOM. The only other clue that I have is that when I run programs like avi2wav and aviinfo and dvdate, they all say that the file has no audio. So somehow WMP and GOM are getting around this and playing the audio (maybe it kicks in later somehow?).
I've even tried GetChannel in Avisynth, no change. And I upgraded to 2.5.8RC4, fresh install (no plugins), no change.
The reason I'd like to continue to use vidgrab is that I wanted maximum control over capturing the tape (in particular, so I could programmatically skip to certain parts of the tape, and there are very few COM/ActiveX libraries that allow this that I could find. Anyone else know of any? That might be one solution, though I'm hoping that vidgrab will fix the problem is/when it's identified, the author is pretty responsive to bugs, once they can be demonstrated as such.
Tac
45tripp
28th September 2008, 17:27
@45tripp: Thanks! This worked on a tiny file that exhibited the problem, but then ffmpeg crashed on still-small but larger (about 300 meg) file. I then upgraded to the lastest version of ffmpeg, and it still's failing.
well crashes are unwanted and should be reported.
if you care to upload a crashing file, i'll also look at it,
and post a bug report if needed.
tripp
tacman1123
28th September 2008, 17:37
Sure, that'd be great! Is there a place I can FTP it to? As I said, it's 300 Meg, though I'll try to re-create the problem with a smaller file.
45tripp
28th September 2008, 17:47
no ftp, the space i have online is borrowed
a smaller sample is welcome
Gavino
28th September 2008, 17:57
tac,
Just another hunch, but could it be a problem with changing from 12-bit 4-channel 32KHz audio to 16-bit 2-channel 48Khz? I know this has given me grief in the past on DV captures.
A symptom of the problem was that WMP would appear to play the audio OK, but seeking to a new position caused it to go wrong.
I have found the only reliable way to capture 16-bit audio was to start the tape rolling over a 16-bit section before starting to capture. Starting on a blank section of tape (eg at start) caused the capture to start in 12-bit mode and write a bad avi.
tacman1123
28th September 2008, 17:57
A smaller capture (100M) works ok, and a larger capture (1G+) also fails, so I think it is size related. I'll post it somewhere and send you a PM with the URL, will you be able to download it via http?
tacman1123
28th September 2008, 19:38
tac,
Just another hunch, but could it be a problem with changing from 12-bit 4-channel 32KHz audio to 16-bit 2-channel 48Khz? I know this has given me grief in the past on DV captures.
I have found the only reliable way to capture 16-bit audio was to start the tape rolling over a 16-bit section before starting to capture.
That seems like a suspicious area, especially since one of the tools seems to show no audio for the first several frames, but then it saw some. But capturing after I was a few seconds in didn't (yet) change anything, but thanks for the tip, I'll continue to push that avenue.
45tripp
29th September 2008, 02:17
will you be able to download it via http?
probably.
i just have to click right? ;)
45tripp
29th September 2008, 14:58
yes it crashes on ffmpeg.
def a problem in the creation of the avi.
dvdate can actually extract audio from it.
funnily it comes out as
16-bit 2-channel 32KHz audio
perhaps Gavino is close to the problem
doesn't matter though cause you can work around it.
vdub can extract the audio.
throws an error. but it works.
better yet just remux it in vdub and then it'll work everywhere.
i'll try and create a bug report on the crash at sometime,
for the sake of a more robust ffmpeg.
tripp
IanB
29th September 2008, 16:14
VirtualDub 1.8.6 seems to correctly handle type 1 DV avi files with mixed 48KHz and 32KHz audio segments.
Open the file and select the "Ask for extended options ...", Under Decode Options select "Use internal decodes for ... DV".
Select Direct Stream Copy for both Video and Audio.
File > "Save as Avi"
You now have a proper type 2 DV avi file complete with 48KHz 16bit stereo PCM audio track.
Note: only channels 1 and 2 are converted from the 32KHz 12 bit streams, channels 3 and 4 are discarded.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.