WAV-->AAC with Quicktime (WIN), convert 500 files with quicktime |
![]() ![]() |
WAV-->AAC with Quicktime (WIN), convert 500 files with quicktime |
Jul 5 2003, 12:56
Post
#26
|
|
![]() Group: Members Posts: 128 Joined: 14-June 03 Member No.: 7174 |
QUOTE (c123 @ Jul 5 2003, 03:00 AM) p.s. on my system, the .vbs will only work if I give a truncated path to QT (i.e. D:\Progra~1\QuickTime\QuickTimePlayer.exe works but not D:\Program Files\QuickTime\QuickTimePlayer.exe) That's logical because of the way VBScript handles filnames with spaces. I finaly got it right. In the original CallQuickTime function replace this : CODE WshShell.Run("C:\Progra~1\QuickTime\QuickTimePlayer.exe " & Path) WScript.Sleep 3000 mp4 = Left(Path, Len(Path)-3) & "mp4" With this : CODE Str = "" For c = 1 To Len(Path) 'Convert 1 \ in 2 \ If Mid(Path, c, 1) = "\" Then Str = Str & "\\" Else Str = Str & Mid(Path, c, 1) End If Next mp4 = Left(Path, Len(Path)-3) & "mp4" Path = Chr(34) & Str & Chr(34) QT = Chr(34) & "C:\\Program Files\\QuickTime\\QuickTimePlayer.exe " & Chr (34) WshShell.Run(QT & Path) WScript.Sleep 3000 Now it works with filnames with spaces in them. Wherever you ask EAC to save wavs. It's normal those strange named files, it's EAC that renames them temporarily until the encoding is finished. Delete them if it didn't work. Also if the script goes wrong, it continues and may feed EAC with commands, so you get that cancel request. A better way to stop script is to replace wscript.exe by cscript.exe in the EAC external compressor settings. Then you'll be able to close the Command window thus ending the script. If not you'll have to 'kill' wscript.exe in the task manager. Good luck (Twice) PS : Try to increase the time given before the script returns to EAC after closing QuickTime. That will help EAC renaming correctly a file that could be locked by QuickTime while not completely exited. This post has been edited by FrDakota: Jul 5 2003, 13:15 |
|
|
|
Jul 5 2003, 19:18
Post
#27
|
|
|
Group: Members Posts: 6 Joined: 4-July 03 Member No.: 7570 |
I doubled the times in the vbs file, and now I can encode four files without any errors
Only problem now - the files are not renamed at the end of the process, i.e. my four aac files are called "0tmp0(842.mp4", "0tmp(207!.mp4", "0tmp557)4.mp4", "0tmp)!3--.mp4". Any suggestions? (apart from listening to the files and manually naming them). |
|
|
|
Jul 5 2003, 21:18
Post
#28
|
|
![]() Group: Members Posts: 128 Joined: 14-June 03 Member No.: 7174 |
QUOTE (c123 @ Jul 5 2003, 10:18 AM) Only problem now - the files are not renamed at the end of the process, i.e. my four aac files are called "0tmp0(842.mp4", "0tmp(207!.mp4", "0tmp557)4.mp4", "0tmp)!3--.mp4". Any suggestions? (apart from listening to the files and manually naming them). That's what I explained above You must increase the delay at the end of the CallQuickTime function. There : CODE WScript.Sleep 1000 'A little wait to let QuickTime exit before returning to EAC ' If not EAC could well not be able to rename the wav file to original, then delete it. 'And EAC could not name the mp4 to what it should be End Function Because when QuickTime is not completely exited it locks the mp4 files and thus prevents EAC to name them properly. Good luck (Thrice) Besides that, I think the limit in filename for QuickTime is 64 like in MacOS. Even under Windows, since Apple ported parts of MacOS for the QuickTime APIs if I remember well. |
|
|
|
Jul 6 2003, 07:39
Post
#29
|
|
![]() Group: Members Posts: 128 Joined: 14-June 03 Member No.: 7174 |
To simplify things, here his the full corrected script for encoding thru EAC.
CODE Function CallQuickTime(Path) Dim fso, mp4, mp5, c, Car, QT, Str Set fso = CreateObject("Scripting.FileSystemObject") Set WshShell = WScript.CreateObject("WScript.Shell") Str = "" For c = 1 To Len(Path) 'Convert 1 \ in 2 \ If Mid(Path, c, 1) = "\" Then Str = Str & "\\" Else Str = Str & Mid(Path, c, 1) End If Next mp4 = Left(Path, Len(Path)-3) & "mp4" Path = Chr(34) & Str & Chr(34) QT = Chr(34) & "C:\\Program Files\\QuickTime\\QuickTimePlayer.exe " & Chr (34) WshShell.Run(QT & Path) WScript.Sleep 3000 Do 'Loop until the mp4 file really exists WScript.Sleep 1500 WshShell.SendKeys "%FE" 'File Export, could be "^E" WScript.Sleep 500 WshShell.SendKeys ("C:\Temp.mp4") 'Temporary mp4 filename WScript.Sleep 500 WshShell.SendKeys "{ENTER}" WScript.Sleep 8000 'Check to see if the temp file is still here While fso.FileExists ("C:\Temp.mp5") WScript.Sleep 1000 'With CScript.exe instead of WScript.exe I could put 500 'IMPORTANT : Increase the value under slower systems (.wav already exists bug) Wend 'The Enter was added in case QuickTime says .wav file already exists, to clear the error. 'I launches playing if all goes well. WScript.Sleep 500 WshShell.SendKeys "{ENTER}" WScript.Sleep 500 WshShell.SendKeys "{ESC}" WScript.Sleep 500 Loop Until fso.FileExists("C:\Temp.mp4") 'Close QuickTime WScript.Sleep 500 WshShell.SendKeys "{ESC}" WScript.Sleep 500 WshShell.SendKeys "%FX" 'Move the Temp.mp4 to the right place while renaming it fso.MoveFile "C:\Temp.mp4" , mp4 Set fso = Nothing WScript.Sleep 2000 'A little wait to let QuickTime exit before returning to EAC ' If not EAC could not be able to rename the wav file to original, then delete it. 'IMPORTANT : Increase the value under slower systems (files do not regain their original names bug) End Function 'Get the 2 first arguments and assumes they are %s & %d (source and destination in EAC) Dim wav Set objArgs = WScript.Arguments wav = objArgs(0) mp4 = objArgs(1) CallQuickTime(wav) Wscript.Quit I hope it helps |
|
|
|
Jul 6 2003, 16:16
Post
#30
|
|
|
Group: Members Posts: 1 Joined: 6-July 03 Member No.: 7601 |
Thanks for sharing the script. Works good.
There was one small glitch I encountered with WinAmp/IN_MP4 after following the setup instructions and using the script. WinAmp would not play the file and gave this error message: Gain control not yet implemented The solution: - Start EAC - Click EAC --> Compression Options - Click the External Compression tab - Uncheck "Add ID3 tag" The need to uncheck this is probably obvious to experienced users, but not to a newbie like me. |
|
|
|
Jul 8 2003, 03:26
Post
#31
|
|
|
Group: Members Posts: 19 Joined: 24-January 02 From: Orlando, Florida Member No.: 1139 |
Error: see below.
This post has been edited by SentientPC: Jul 8 2003, 03:34 |
|
|
|
Jul 8 2003, 03:33
Post
#32
|
|
|
Group: Members Posts: 19 Joined: 24-January 02 From: Orlando, Florida Member No.: 1139 |
QUOTE (FrDakota @ Jul 6 2003, 01:39 AM) To simplify things, here his the full corrected script for encoding thru EAC. I hope it helps For some reason, when EAC spawns Quicktime, Quicktime loses focus immediately. This causes me to get the "Do you really want to cancel extraction?" dialog in EAC, as it seems focus immediately is returning to EAC after spawning QT (and of course the script still is still running with EAC's dialog as its target). If I click "No" and click on QT to give it focus, it continues on when the loop wait time is over, I suspect. I have set all settings as stated by FrDakota previously in this thread. I have made sure "On extraction, start external compressors queued in the background" is unchecked. I have doubled all times to eliminate that potential reason. Not sure what it is... |
|
|
|
Jul 8 2003, 07:34
Post
#33
|
|
![]() Group: Members Posts: 128 Joined: 14-June 03 Member No.: 7174 |
QUOTE (SentientPC @ Jul 7 2003, 06:33 PM) I have set all settings as stated by FrDakota previously in this thread. I have made sure "On extraction, start external compressors queued in the background" is unchecked. I have doubled all times to eliminate that potential reason. Not sure what it is... This is strange, that's exactly what happened when I had the "On extraction, start external compressors queued in the background" checked. When quicktime is launched does the Status window of EAC stop at "Compress Track By External Program", or do you see it continue ripping? If it does there waybe something wrong with your EAC. If not, I don't have a clue to the problem. Maybe a solution would be to add a delay before QuickTime is launched. |
|
|
|
Jul 8 2003, 19:30
Post
#34
|
|
|
Group: Members Posts: 3 Joined: 5-May 03 Member No.: 6398 |
Im working on my own front end that uses winapi instead of send keys so losing focus shouldnt matter, that should solve your problem, should be done soon.
|
|
|
|
Jul 8 2003, 23:20
Post
#35
|
|
|
dBpowerAMP developer Group: Developer (Donating) Posts: 2653 Joined: 24-March 02 Member No.: 1615 |
SendMessages? I found the menu handling to be quite odd in QuickTime (I had to expand the menu first before sending a WM_COMMAND).
-------------------- Spoon http://www.dbpoweramp.com
|
|
|
|
Jul 9 2003, 01:03
Post
#36
|
|
|
Group: Members Posts: 3 Joined: 5-May 03 Member No.: 6398 |
I had to do that too, I wanted add bit rate ect to my front end, but I couldn't bring up the MPEG-4 Setting with freezing my program. I tried to set the bitrate using writeprocess memory but that led nowhere. Oh well. I might finish today it, but im pretty lazy.
|
|
|
|
Jul 9 2003, 15:28
Post
#37
|
|
|
Group: Members Posts: 17 Joined: 9-July 03 Member No.: 7673 |
this script version works for me with EAC
(if you don't touch the keyboard/mouse while ripping&encoding) CODE Function CallQuickTime(Path) Dim fso, mp4, mp5, c, Car, QT, Str, wav, wavx Set fso = CreateObject("Scripting.FileSystemObject") Set WshShell = WScript.CreateObject("WScript.Shell") Str = "" For c = 1 To Len(Path) If Mid(Path, c, 1) = "\" Then Str = Str & "\\" Else Str = Str & Mid(Path, c, 1) End If Next ' get filename.wav For c = 1 to Len(Path) If Mid(Path, c, 1) = "\" Then wavx=c Else End If Next wav=Right(Path,Len(Path)-wavx) wav=Left(wav,Len(Path)-3) mp4 = Left(Path, Len(Path)-3) & "mp4" Path = Chr(34) & Str & Chr(34) QT = Chr(34) & "C:\\Program Files\\QuickTime\\QuickTimePlayer.exe " & Chr (34) WshShell.Run(QT & Path) WScript.Sleep 3000 WshShell.AppActivate(wav) WScript.Sleep(100) WshShell.AppActivate(wav) WshShell.AppActivate(wav) WshShell.SendKeys "^E" WScript.Sleep 500 WshShell.SendKeys ("C:\Temp.mp4") WScript.Sleep 500 WshShell.SendKeys "{ENTER}" WScript.Sleep 9999 While fso.FileExists ("C:\Temp.mp5") WScript.Sleep 1000 Wend Do Loop Until fso.FileExists("C:\Temp.mp4") WScript.Sleep 2000 WshShell.SendKeys "^W" WScript.Sleep 500 fso.MoveFile "C:\Temp.mp4" , mp4 Set fso = Nothing WScript.Sleep 1000 End Function Dim wav Set objArgs = WScript.Arguments wav = objArgs(0) mp4 = objArgs(1) CallQuickTime(wav) WshShell.Run("taskkill /f /im CScript.exe") Wscript.Quit p.s. the only thing i need now is Case's tag with apple's MP4 tagging code from menno... |
|
|
|
Jul 10 2003, 23:36
Post
#38
|
|
|
Group: Super Moderator Posts: 332 Joined: 20-May 03 From: Pittsburgh, USA Member No.: 6718 |
I haven't tried using this script, but I've had lots of problems with windows losing focus in the past if X-Mouse is activated, especially if Autoraise when activating is enabled too.
This post has been edited by rpop: Jul 10 2003, 23:36 -------------------- [url=http://noveo.net/ph34r.htm]Happiness[/url] - The agreeable sensation of contemplating the misery of others.
|
|
|
|
Jul 11 2003, 00:05
Post
#39
|
|
|
Group: Developer Posts: 65 Joined: 23-September 01 Member No.: 11 |
As soon as QuickTime 6 came out, I grabbed the SDK and tried to write an executable to take a Wav and make an AAC file. But does it work? Does it hell.
When I try to get the codec handler it just returns an error. Works fine for all there other codecs but not AAC. I don't know if they've just disabled it for windows or what. Ill contact the QuickTime guys (I was at the WWDC thang in San Francisco and got to all the new stuff in QT 6.4 and its AAC improvements) and see if they can help me. (if anyone wants the source let me know...) -Nic |
|
|
|
Jul 11 2003, 06:33
Post
#40
|
|
|
Group: Members Posts: 3 Joined: 5-May 03 Member No.: 6398 |
A question for spoon or anyone else that knows. Whats the best way to open the export dialog for Quicktime? I currently use
CODE sendMessage(quicktime,WM_INITMENU,$f10c9,0); sendMessage(quicktime,WM_COMMAND,$E,0); but the wparams seem to change evertime I restart. |
|
|
|
Jul 13 2003, 11:08
Post
#41
|
|
|
Group: Members Posts: 17 Joined: 9-July 03 Member No.: 7673 |
It seems to get Quicktime api/sdk to work the APP must be registered (ie you should pay Apple for license) in Apple's exe database.
SonicFoundry Vegas 4.0 + Batch Converter 5.0 can export in all these QT formats EXCEPT new QuickTime AAC - i think they will add this support in next patch or 2... |
|
|
|
Jul 14 2003, 09:42
Post
#42
|
|
![]() Group: Members Posts: 128 Joined: 14-June 03 Member No.: 7174 |
QUOTE (zeer @ Jul 9 2003, 06:28 AM) CODE While fso.FileExists ("C:\Temp.mp5") WScript.Sleep 1000 Wend Do Loop Until fso.FileExists("C:\Temp.mp4") Zeer! I've just noticed that your modification of the script cannot work correctly, especially if an encoding fails. You wait until the mp5 dissapears. But if the encoding fails the mp4 will never be created. So your script will loop indefinitely on waiting mp4 to exist. That's why in my script, if the mp4 isn't created it loops to re-export it. Doh! |
|
|
|
Jul 14 2003, 09:47
Post
#43
|
|
|
Group: Developer Posts: 65 Joined: 23-September 01 Member No.: 11 |
@zeer:
Ahh, I guess that maybe the case. Its a shame because exactly the same code works fine on an Apple machine. -Nic |
|
|
|
Jul 14 2003, 11:11
Post
#44
|
|
|
dBpowerAMP developer Group: Developer (Donating) Posts: 2653 Joined: 24-March 02 Member No.: 1615 |
QUOTE (perplx @ Jul 11 2003, 05:33 AM) A question for spoon or anyone else that knows. Whats the best way to open the export dialog for Quicktime? I currently use CODE sendMessage(quicktime,WM_INITMENU,$f10c9,0); sendMessage(quicktime,WM_COMMAND,$E,0); but the wparams seem to change evertime I restart. That is as far as I got, they seem to not want other programs to interface with it... Is it possible to enum the menu items? -------------------- Spoon http://www.dbpoweramp.com
|
|
|
|
Jul 14 2003, 14:07
Post
#45
|
|
|
Group: Members Posts: 17 Joined: 9-July 03 Member No.: 7673 |
2 FrDakota:
Nobody is perfect. Actually, the problem of not creating temp.mp4 does not appear while i ripped (~40 CDs). It is assumed that temp.mp5 is enough ... and real test shows that it is. although if i invent something more robust, i will let you know... |
|
|
|
Jul 27 2003, 16:12
Post
#46
|
|
|
Group: Members Posts: 1 Joined: 21-June 02 Member No.: 2361 |
I've made a tiny Python script which "abuses" FrDakota's script for batch encoding outside of EAC. I'm a very inexperienced coder and the script could doubtlessly be much more elegant. Also, it doesn't provide any safety at all, it'll just fail without a useful error message if something is not right.
It expects eac.vbs in C:\, but that can easily be changed, as all the other absolute references. Thanks to FrDakota's script, encoding to AAC with QuickTime has become a real possibility and I hope my addition is of use for some... CODE # This should serve to use the eac.vbs script to batch encode files in a # given directory (and its subdirectories) using QuickTime AAC. # Many thanks to FrDakota for making this possible! # # Usage: python qtmp4.py c:\*.wav # -> This will encode all wave files on drive C: # -> The encoded files will be in the same directory as the source files, # and with the same name. import sys import os print "Compiling list of wave files..." os.system("dir " + sys.argv[1] + " /s /b > c:\\wavs.txt") f=open("c:\\wavs.txt", "r") name=f.readline() while name!="" : wav=name[:-5] + ".wav" mp4=name[:-5] + ".mp4" print "Encoding " + wav + "..." os.system("cscript //Nologo //H:CScript c:\\eac.vbs " + "\"" + wav + "\" " + "\"" + mp4 + "\"") # os.remove(wav) # un-comment if you want to have the wave file deleted after encoding name=f.readline() print "Done!" sys.exit() Cheers, Zaphod |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 19th June 2013 - 10:57 |