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: How can I use the AAC-VBR encoder of QT7? (Read 13120 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How can I use the AAC-VBR encoder of QT7?

Reply #25
Quote
I wrote an applescript to automate this and thought I was very clever.  Then I found that the files are not really VBR!  Manually encoded files are true VBR, but not the applescript ones.


I'd also love to see the script. Even if you just posted the code here, in a message.

How can I use the AAC-VBR encoder of QT7?

Reply #26
Here it is.  Maybe I screwed it up.  I have also tried "using most recent settings" with similar results.

Code: [Select]
-- the list of file types which will be processed
-- eg: {"PICT", "JPEG", "GIFf", "TIFF"}
property type_list : {"MooV"}
-- since file types are optional in Mac OS X,
-- check the name extension if there is no file type
-- NOTE: do not use periods (.) with the items in the name extensions list
-- eg: {"txt", "text", "jpg", "jpeg"}, NOT: {".txt", ".text", ".jpg", ".jpeg"}
property extension_list : {"wav"}

global target_folder, temp_folder

on run
    display dialog "Convert to QuickTime Movie" & return & return & ¬
 "This script will convert dragged-on movie files to QuickTime movies." buttons {"OK"} default button 1
    
    -- ENABLE THESE LINES FOR TESTING
    --set these_items to (choose file) as list
    --open these_items
end run

-- This droplet processes both files or folders of files dropped onto the applet
on open these_items
    -- this routine uses the gestaltVersion_info() sub-routine
    copy my gestaltVersion_info("qtim", 8) to {QT_version, QT_string}
    if the QT_version is less than "0502" then
 display dialog "This script requires QuickTime 5.0.2 or higher." & ¬
     return & return & "The currently installed version is: " & ¬
     QT_string buttons {"Cancel"} default button 1
    end if
    -- create a unique temp folder
    repeat
 set this_name to (random number from 100000 to 999999) as string
 tell application "Finder"
     if not (exists folder this_name of the desktop) then
   set the temp_folder to (make new folder at desktop with properties {name:this_name}) as alias
   exit repeat
     end if
 end tell
    end repeat
    --set the target_folder to choose folder with prompt "Destination folder for the converted files:"
    repeat with i from 1 to the count of these_items
 set this_item to (item i of these_items)
 set the item_info to info for this_item
 if folder of the item_info is true then
     process_folder(this_item)
 else if (alias of the item_info is false) and ¬
     ((the file type of the item_info is in the type_list) or ¬
   the name extension of the item_info is in the extension_list) then
     process_item(this_item)
 end if
    end repeat
    -- quit QuickTime
    tell application "QuickTime Player"
 quit
    end tell
    -- delete the temp folder
    -- tell application "Finder"
    --    delete temp_folder
    --    empty trash
    --end tell
    beep
end open

-- this sub-routine processes folders
on process_folder(this_folder)
    set these_items to list folder this_folder without invisibles
    repeat with i from 1 to the count of these_items
 set this_item to alias ((this_folder as text) & (item i of these_items))
 set the item_info to info for this_item
 if folder of the item_info is true then
     process_folder(this_item)
 else if (alias of the item_info is false) and ¬
     ((the file type of the item_info is in the type_list) or ¬
   the name extension of the item_info is in the extension_list) then
     process_item(this_item)
 end if
    end repeat
end process_folder

-- this sub-routine processes files
on process_item(this_item)
    -- NOTE that the variable this_item is a file reference in alias format
    -- FILE PROCESSING STATEMENTS GOES HERE
    with timeout of 3600 seconds -- one hour per movie time limit
 tell application "QuickTime Player"
     launch -- bypasses promo movie
     activate
     my toggle_suppress(true)
     try
   stop every movie
   close every movie saving no
   open this_item
   if saveable of movie 1 is false then
       error "This movie has previously been set so that it cannot be copied, edited, or saved."
   end if
   set the original_file to the original file of movie 1
   tell application "Finder"
       set the file_name to the name of the this_item
       set the target_folder to the container of the this_item
       if exists file file_name of the temp_folder then ¬
     delete file file_name of the temp_folder
       set the root_name to (text 1 thru (offset of "." in file_name) of file_name)
       set the temp_file to ((temp_folder as text) & root_name & "mov")
       set the new_file to ((temp_folder as text) & root_name & "m4a")
   end tell
   
   if (can export movie 1 as QuickTime movie) is true then
       -- export the movie as QuickTime Movie
       export movie 1 to file temp_file as QuickTime movie using settings alias "PowerBook:AAC_VBR_192.set"
       -- close the source movie
       close movie 1 saving no
       -- open Quicktime moive
       open temp_file
       -- export as mp4 file (change container format)
       export movie 1 to file new_file as MPEG4 using settings alias "PowerBook:MP4_passthrough.set"
       -- close the final product
       close movie 1 saving no
   else
       error "This movie cannot be exported as a QuickTime Movie."
   end if
   tell application "Finder"
       move file new_file to the target_folder with replacing
   end tell
   my toggle_suppress(false)
     on error error_msg
   my toggle_suppress(false)
   display dialog error_msg buttons {"Stop", "Continue"} default button 2
   set the button_pressed to the button returned of the result
   close movie 1 saving no
   if the button_pressed is "Stop" then error number -128
     end try
 end tell
    end timeout
end process_item

on toggle_suppress(status_flag)
    tell application "QuickTime Player"
 set ignore auto play to the status_flag
 set ignore auto present to the status_flag
    end tell
end toggle_suppress

on gestaltVersion_info(gestalt_code, string_length)
    try
 tell application "Finder" to ¬
     copy my NumToHex((system attribute gestalt_code), ¬
   string_length) to {a, b, c, d}
 set the numeric_version to {a, b, c, d} as string
 if a is "0" then set a to ""
 set the version_string to (a & b & "." & c & "." & d) as string
 return {numeric_version, version_string}
    on error
 return {"", "unknown"}
    end try
end gestaltVersion_info

on NumToHex(hexData, stringLength)
    set hexString to {}
    repeat with i from stringLength to 1 by -1
 set hexString to ((hexData mod 16) as string) & hexString
 set hexData to hexData div 16
    end repeat
    return (hexString as string)
end NumToHex

How can I use the AAC-VBR encoder of QT7?

Reply #27
P.S.  I should explain this is just a simple hack of one of the apple supplied scripts to export an mp4 file.  It is a dropplet.  So save it as an applescript by pasting into the script editor and saving.  Then drag you wav files or a directory containing the wave files over to the dropplet or an alias to the droplet.  The m4a files appear in the same folder as the wav files.

How can I use the AAC-VBR encoder of QT7?

Reply #28
The problem seems to be that it doesn't use passthrough when it converts to MPEG4. Instead it re-encodes the file to 128kbps. hmm....

How can I use the AAC-VBR encoder of QT7?

Reply #29
Quote
The problem seems to be that it doesn't use passthrough when it converts to MPEG4. Instead it re-encodes the file to 128kbps. hmm....
[a href="index.php?act=findpost&pid=301418"][{POST_SNAPBACK}][/a]


No.  I think the problem is when it generates the intermediate mov file.  I output those thinking the same thing, and they have very little bitrate variation.  They come out at 128.15 and similar numbers on my system.  Never exactly the same.

When you do this by hand they show a range of bitrates typical of VBR.

It's a puzzle.

How can I use the AAC-VBR encoder of QT7?

Reply #30
QT 7.0.1 is released, and the AAC encoder appears to have been updated (md5 checksums differ at least)

How can I use the AAC-VBR encoder of QT7?

Reply #31
Quote
QT 7.0.1 is released, and the AAC encoder appears to have been updated (md5 checksums differ at least)
[a href="index.php?act=findpost&pid=302269"][{POST_SNAPBACK}][/a]


I just tried that version and it behaves the same.  I may give apple support a try.