Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: WAV-->AAC with Quicktime (WIN) (Read 27515 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WAV-->AAC with Quicktime (WIN)

Reply #25
Quote
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: [Select]
  WshShell.Run("C:\Progra~1\QuickTime\QuickTimePlayer.exe " & Path)

 WScript.Sleep 3000

 mp4 = Left(Path, Len(Path)-3) & "mp4"


With this :
Code: [Select]
   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.  Be fast 

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.

WAV-->AAC with Quicktime (WIN)

Reply #26
I doubled the times in the vbs file, and now I can encode four files without any errors  I also get to listen to a few seconds of each track after it gets encoded as a bonus

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).

WAV-->AAC with Quicktime (WIN)

Reply #27
Quote
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  QuickTime must have enough time to quit completely before returning the hand to EAC.

You must increase the delay at the end of the CallQuickTime function.

There :
Code: [Select]
  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.

WAV-->AAC with Quicktime (WIN)

Reply #28
To simplify things, here his the full corrected script for encoding thru EAC.

Code: [Select]
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 

WAV-->AAC with Quicktime (WIN)

Reply #29
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.

WAV-->AAC with Quicktime (WIN)

Reply #30
Error: see below.

WAV-->AAC with Quicktime (WIN)

Reply #31
Quote
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...

WAV-->AAC with Quicktime (WIN)

Reply #32
Quote
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.

WAV-->AAC with Quicktime (WIN)

Reply #33
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.

WAV-->AAC with Quicktime (WIN)

Reply #34
SendMessages? I found the menu handling to be quite odd in QuickTime (I had to expand the menu first before sending a WM_COMMAND).

WAV-->AAC with Quicktime (WIN)

Reply #35
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.

WAV-->AAC with Quicktime (WIN)

Reply #36
this script version works for me with EAC
(if you don't touch the keyboard/mouse while ripping&encoding)

Code: [Select]
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...

WAV-->AAC with Quicktime (WIN)

Reply #37
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.
Happiness - The agreeable sensation of contemplating the misery of others.

WAV-->AAC with Quicktime (WIN)

Reply #38
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

WAV-->AAC with Quicktime (WIN)

Reply #39
A question for spoon or anyone else that knows. Whats the best way to open the export dialog for Quicktime? I currently use
Code: [Select]
  sendMessage(quicktime,WM_INITMENU,$f10c9,0);
 sendMessage(quicktime,WM_COMMAND,$E,0);

but the wparams seem to change evertime I restart.

WAV-->AAC with Quicktime (WIN)

Reply #40
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...

WAV-->AAC with Quicktime (WIN)

Reply #41
Quote
Code: [Select]
 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! 

WAV-->AAC with Quicktime (WIN)

Reply #42
@zeer:
Ahh, I guess that maybe the case. Its a shame because exactly the same code works fine on an Apple machine.

-Nic

WAV-->AAC with Quicktime (WIN)

Reply #43
Quote
A question for spoon or anyone else that knows. Whats the best way to open the export dialog for Quicktime? I currently use
Code: [Select]
  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?

WAV-->AAC with Quicktime (WIN)

Reply #44
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...

WAV-->AAC with Quicktime (WIN)

Reply #45
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: [Select]
# 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