Converting DVD tracks to 41.1KHz & Normalizing

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Re: Converting DVD tracks to 41.1KHz & Normalizing

Post by Qyot27 » Wed Jan 28, 2009 12:09 pm

Sabihato wrote:The second method Qyot27 mentioned sounds promising, since I'm not able to find the older versions of dBpoweramp and SSRC appears to be for MAC OS only.
On that page, you'd go for the ICL10 build, I believe it's the one right above the OSX build.

Forewarning: this is more or less a crash course in using CLI apps - I also use Windows XP, so the methodology may differ a bit on Vista. It should still exist, though, so it may require a little Googling to find the exact way to do it on Vista (that is, if it doesn't work the way I describe).
I've downloaded wavi and extracted it. Unfortunately, it doesn't tell me where to place the contents and the applications flash momentarily before disappearing. I think I could use AviSynth to get this done, but the question is where should I include the script lines to convert the audio? In a blank, brand new .avs file or should I use one of my existing scripts I've used to modify the video portion of my DVD source (see example script below)?

Code: Select all

MPEG2Source("C:\Users\********\Desktop\*** ****** *******\DVD_01.d2v", cpu=4)
Deen("w3d,3,3,5")
vmToon(strength=24)
LanczosResize(848,480)
ConvertToRGB32()
Somewhere in there? And lastly, am I correct in assuming I'll be using VirtualDubMod to get the audio converted? Or the wavi application? Or are they both different methods in themselves? I appreciate just a little bit more instruction. Thanks, everyone.
wavi and VirtualDubMod are two separate methods - wavi's major benefit over VirtualDubMod is that it can handle files with no video stream, whereas VDubMod will reject video-less files. wavi also streamlines into batch scripts more easily than VDubMod can.

wavi is a command-line application, just as SSRC is (although on SSRC's benefit, it is able to link into GUI apps; there's a couple GUIs that can use wavi, but generally it's easier not to). That's why clicking on them makes them flash for a second and go away.

So, what you need to do is place wavi.exe into C:\WINDOWS or whatever that folder actually is on Vista (well, feasibly you could put it anywhere as long as you go into Windows' Environment Variables and add the directory to your PATH, but C:\WINDOWS is just easier most times). Now, you can either use Run to call up the command prompt and navigate into the directory your files are in to run the command (by typing in cmd and hitting Enter, then using cd to go up and down the directory tree to get to your files), or you can create a Windows batch script in that directory and avoid trying to wrangle with the Prompt at all. In which case, copy and paste this into a text file using Notepad (after saving, change the extension of the file from .txt to .bat):

Code: Select all

wavi "input.avs" "output.wav"
pause
Changing, of course, input and output to the correct names - if you have spaces in the filenames, those quotes are still necessary. You can leave the 'pause' line out if you would prefer the prompt window to close automatically. Pause will make it to where after the operation is finished, you have to press a button to make the window close (or continue on with the script, if there's something after that line).

Now, wavi uses the AviSynth script, so the frequency change has to be done in the script for wavi to recognize it. So, with your script as a reference, it would look like this with the frequency change inserted:
video = MPEG2Source("C:\Users\********\Desktop\*** ****** *******\DVD_01.d2v", cpu=4).Deen("w3d,3,3,5").vmToon(strength=24).LanczosResize(848,480).ConvertToRGB32()
audio = WAVSource("audio.wav")
AudioDub(video,audio).SSRC(44100,fast=false)
(new parts in bold; the change in formatting is to make it easier to acknowledge which parts are for the video stream and which parts aren't - AviSynth recognizes periods between functions the same way it recognizes the functions being on new lines)

HOWEVER, if you don't want to change your video's script so dramatically, then you could load just the WAV inside of its own script, like so:

Code: Select all

WAVSource("audio.wav")
SSRC(44100,fast=false)
And opening this script is why using wavi is a benefit, since VDubMod won't open it due to the lack of a video stream (sure, you could use BlankClip to make one, but that's almost as much work as the adjustments I illustrated on the .d2v-loading script above). As a point of reference, you could also use DirectShowSource or FFmpegSource or AVISource itself and simply negate the video by using video=false (for DSS or AVISource) or vtrack=-2 (for FFmpegSource).

If it wasn't for the fact you use a 64-bit version of Vista, I would suggest you look at the Microsoft 'Open Command Window Here' PowerToy for XP - I don't know if it would work with Vista at all, but if it does, then I would expect it only would be able to work with the 32-bit version, as it integrates into Explorer as a Shell Extension. It would remove the need to do the batch script stuff, as you could just right-click on the folder name and bring up the command prompt already in the directory you need to work in, without having to navigate with cd commands. I suppose for the 64-bit version you could just make a point of using a 32-bit Explorer clone, like ExplorerXP and see if the Powertoy works with it.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Re: Converting DVD tracks to 41.1KHz & Normalizing

Post by Qyot27 » Wed Jan 28, 2009 12:12 pm

Qyot27 wrote:If it wasn't for the fact you use a 64-bit version of Vista, I would suggest you look at the Microsoft 'Open Command Window Here' PowerToy for XP - I don't know if it would work with Vista at all, but if it does, then I would expect it only would be able to work with the 32-bit version, as it integrates into Explorer as a Shell Extension. It would remove the need to do the batch script stuff, as you could just right-click on the folder name and bring up the command prompt already in the directory you need to work in, without having to navigate with cd commands. I suppose for the 64-bit version you could just make a point of using a 32-bit Explorer clone, like ExplorerXP and see if the Powertoy works with it.
Never mind this paragraph, there is something for Vista that does this, and works with 64-bit:
http://www.ktechcomputing.com/cmdopen/

(But apparently Vista has a built-in Open Command Window Here option if you hold down SHIFT while right-clicking.)
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog

Sabihato
Joined: Tue Dec 23, 2008 11:59 pm
Org Profile

Re: Converting DVD tracks to 41.1KHz & Normalizing

Post by Sabihato » Thu Feb 05, 2009 2:13 am

Yeesh, sorry about my silence; I was working on some of my non-leisure projects for the past week and was too busy to check back on this. But after some thorough reading and trial-and-error, Qyot27, I can proudly say:

Victory!

I was able to successfully convert a sample audio track into 41.1KHz thanks to the wavi application you provided. Some steps I originally overlooked included saving the Notepad file into .bat and putting the wavi.exe application into C:\Windows. I had hoped there was another way to execute the wavi program; I'm not used to making any modifications inside the C:\Windows directory apart from installing new fonts. But I don't think leaving it there will cause any harm to my system.

It should be said that I tried making the modifications to my original script to no success. I added the following per your instructions:
- video = before MPEG2Source
- audio = WAVSource("C:\Users\********\Desktop\*** ****** *******\DVD_01 T01 48K 16bit 2ch.wav") after my video adjustment lines such as vmToon and Deen (the audio name is how it is by default after demuxing through DGIndex)
- AudioDub(video,audio) in the line below that
- SSRC(44100,fast=false) in the line below that

Code: Select all

video = MPEG2Source("C:\Users\********\Desktop\*** ****** *******\DVD_01.d2v", cpu=4)
Deen("w3d,3,3,5")
vmToon(strength=24)
LanczosResize(848,480)
ConvertToRGB32()
audio = WAVSource("C:\Users\********\Desktop\*** ****** *******\DVD_01 T01 48K 16bit 2ch.wav")
AudioDub(video,audio)
SSRC(44100,fast=false)
But I don't believe this modified .avs script is designed to be ran through wavi. And VirtualDubMod seems to have problems with the text. It seems to have trouble recognizing lines. The specific error message I get is "Script error: Invalid arguments to function "Deen"". I don't know if there are things I need to substitute in place of, add, or omit. I've even tried the period format as well and the same thing results.

Nevertheless, you have provided me with a working solution. And for that, you and Scintilla and mirkosp deserve cookies and milk. Come to San Jose. :) Now I can finally begin my AMV with all the other audio and file format tidbits resolved - no small potatoes.

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Re: Converting DVD tracks to 41.1KHz & Normalizing

Post by Scintilla » Thu Feb 05, 2009 6:42 am

Sabihato wrote:

Code: Select all

video = MPEG2Source("C:\Users\********\Desktop\*** ****** *******\DVD_01.d2v", cpu=4)
Deen("w3d,3,3,5")
vmToon(strength=24)
LanczosResize(848,480)
ConvertToRGB32()
audio = WAVSource("C:\Users\********\Desktop\*** ****** *******\DVD_01 T01 48K 16bit 2ch.wav")
AudioDub(video,audio)
SSRC(44100,fast=false)
But I don't believe this modified .avs script is designed to be ran through wavi. And VirtualDubMod seems to have problems with the text. It seems to have trouble recognizing lines. The specific error message I get is "Script error: Invalid arguments to function "Deen"".
You've put the closing quotation mark in the wrong place. It should be:
Deen("w3d",3,3,5)
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

Sabihato
Joined: Tue Dec 23, 2008 11:59 pm
Org Profile

Re: Converting DVD tracks to 41.1KHz & Normalizing

Post by Sabihato » Thu Feb 05, 2009 10:26 pm

Gave a try on that one, Scintilla, but it still presented the same error message, word for word.

Egads, this quotation mishap has been present through all of the clips I've extracted thus far. Does this mean the Deen effect didn't go through on any one of them? I thought the script was supposed to warn me on something like that. :!:

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Re: Converting DVD tracks to 41.1KHz & Normalizing

Post by Qyot27 » Fri Feb 06, 2009 12:11 am

If I'm defining 'video' and 'audio' as variables (the whole 'video =' thing), then I never put the other functions on separate lines, unless they come after AudioDub (and usually, not even then). Put the video operations that fall between the 'video =' and 'audio =' lines onto the 'video =' line and separate them with periods. I showed it marked up this way in the same post I explained wavi in.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Re: Converting DVD tracks to 41.1KHz & Normalizing

Post by Scintilla » Fri Feb 06, 2009 1:05 am

Holy crap, I can't believe I didn't notice that. Yes, the Deen and vmToon wouldn't take, the way you currently have the script set up, because you're passing the clip called video to AudioDub -- which you define on the first line as the MPEG-2 stream WITHOUT any of the filters applied to it.

Your first few lines should instead read:

Code: Select all

MPEG2Source("C:\Users\********\Desktop\*** ****** *******\DVD_01.d2v", cpu=4)
Deen("w3d",3,3,5)
vmToon(strength=24)
LanczosResize(848,480)
video = last.ConvertToRGB32()
Tell me if that fixes Deen; it may not have been properly taking the implicit last video clip because you were defining video on the line before it.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

Sabihato
Joined: Tue Dec 23, 2008 11:59 pm
Org Profile

Re: Converting DVD tracks to 41.1KHz & Normalizing

Post by Sabihato » Sat Feb 07, 2009 8:07 pm

Mmmmm, that did it. I tested it, it opened. I saved a sample clip from the DVD and the .avi came out with the proper sound from the .wav file. AND it was encoded correctly at 41.1KHz according to the file info in VirtualDubMod. This is everything I could hope for, and I dunno if a simple thanks is enough. You both have been very helpful.

------------------------------------------------------------

At this point, I have a difficult decision to make. The way I had originally coded deen was: Deen("w3d,3,3,5"). But since you, Scintilla, told me about the improper quotation mark placement (it should be Deen("w3d",3,3,5)), I have noticed a subtle but present change in the picture. I've compared two identical stills from a clip and the original without the deen effect. Here's what they looks like (files are .png):

No Deen: Original still without the deen effect
Deen("w3d",3,3,5): A slight variation in color. The hair, for example, goes from blue in the original to a slight purple tint. All the better, however, to reduce noise
Deen("w3d,3,3,5"): Virtually identical to the previous, even if the code was typed incorrectly. It's only if you compare pixels up close that you see a difference

Now, I've spent better part of a week extracting over a thousand clips from 8 DVDs using the incorrectly typed deen code. I don't know if I want to do it again, so I'd like to ask if it's worth it? On the one hand, I don't know if my code has properly corrected for noise, and now that I can save clips with sound, I should recreate those clips with the video and audio together. On the other hand, I don't plan on using a lot of audio from my source, Qyot27 has shown me a way to convert the DVD .wav tracks using wavi, and the typo hasn't really affected the picture quality, at least on the outside.

But the purist in me tells me to do everything correctly. So what should I do? What would you do? :shock:

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Re: Converting DVD tracks to 41.1KHz & Normalizing

Post by Scintilla » Sat Feb 07, 2009 9:15 pm

Again, it's 44.1 kHz. </nitpicking>

And what I'm going to assume happened is that Deen only took into account the first three characters in the "mode" string, which are the same in both your invocations. (Otherwise, it should have complained about an incorrect value for that parameter.)

In the incorrect version, you didn't supply the other three important parameters (radius, y thresh, and c thresh), so it just used the defaults. However, I have no clue what those default values are. It wouldn't surprise me if they were pretty close to what you used, as they seem pretty reasonable.

Anyway, if you've already spent all that time cutting clips, and the ones you have look fine to you, then I really don't think there is a point in redoing it all.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

Sabihato
Joined: Tue Dec 23, 2008 11:59 pm
Org Profile

Re: Converting DVD tracks to 41.1KHz & Normalizing

Post by Sabihato » Sat Feb 07, 2009 10:47 pm

You're right, it's 44.1. I dunno how I got that logged in my head in the first place. I, too, thought it was strange that the system didn't bug me for incorrect Deen values. But yeah, my clips all look good, so I'm going to proceed as planned.

Locked

Return to “Video & Audio Help”