Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Muxed saving via QT/Applescript



On 16/11/05 at 20:05, George Bray <email@hidden> wrote:

> Yep, Apple's MPEG-2 Component does not understand muxed files. If you  
> attempt anything via quicktime in any program, it will only yield the  
> video track.

Hmm, I think the original poster wanted to mux, not to demux, in which
case, he might take a look at a set of command-line utilities called
QTCoffee:

<http://www.3am.pair.com/QTCoffee.html>

The interesting one for your purposes is called 'muxmovie'.

A typical call to muxmovie might be something like:

muxmovie -self-contained '/Users/brennan/Movies/vid.mpg'
'/Users/brennan/Movies/aud.mp2' -o '/Users/brennan/Movies/muxed.mpg'

(should be all on a single line, of course).

Command line programs are designed to be part of an automated process. You
can either use shell scripting, or AppleScript via the 'do shell script'
command, or various other tools which can call the shell.

If you use 'do shell script' you can use command line tools (i.e. UNIX
programs) from the Finder with drag and drop, just by calling 'do shell
script' via an 'open' handler. Some string manipulation required, but
nothing too hairy. Very nice.

*** advanced ***

So far I've had great success with embedding command line unix programs in
AppleScript bundles/packages (so that I don't have to care whether the
program is installed in the system elsewhere, or what version it is). 

The best thing about this approach is that you can pass the droplet around
without worrying about whether the appropriate UNIX tool is installed.
Very cool.

The tricky part is specifying the path to the UNIX exectutable, because
'path to me' differs when the script is run from script editor than when
the script runs as a droplet. ('path to me' refers to the application
running the script, which may be the script itself, or it may be a script
editing application). 

This handler will do that job:

on getEXEpath()
 
 set AppleScript's text item delimiters to ""
 set myPath to (path to me)
 set inf to info for (path to me)
 
 if file creator of inf is in {"ToyS"} then
  -- running from script editor
  tell (current application)
   set myPath to (path of document 1)
   -- i.e. we assume we are RUNning frontmost script in the editor
  end tell
  
 else -- assume it's a script app or droplet
  set myPath to myPath's POSIX path
 end if
 
 set exeName to "muxmovie" -- the UNIX program in the bundle
 
 set exePath to myPath & "/Contents/MacOS/" & exeName
 set exePathHFS to (exePath as POSIX file) as string
 
 try
  set exeAlias to (alias exePathHFS)
 on error msg number n
  display dialog msg
  error n
 end try
 
 return quoted form of (POSIX path of exeAlias)
 
end getEXEpath

Note that this doesn't take into account the possibility that the script
is running from 'scriptmenu' or some other such script launcher utility.

***

I have some scripts which do this with certain other UNIX tools, which
ought to be easy to adapt. 

For example, I have an AppleScript which uses a UNIX tool to pull the
audio out of the frontmost MPEG muxed movie open in QuickTime Player.

(We all want that feature to be built in, and when it can be scripted, one
begins to wonder why we don't yet have it...)

Good luck!

-- 
Brennan Young

"But by maintaining soldiers there instead of colonies, one spends much
more, being obliged to consume all the revenues of the state in guarding
its borders, so that profit becomes a loss... everybody resents this
inconvenience and everyone becomes an enemy; and these are enemies that
can be harmful, since they remain, although conquered, in their own home."

-Niccolai Machiavelli
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-users/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.