• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Get length of audio/video files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get length of audio/video files


  • Subject: Re: Get length of audio/video files
  • From: Christopher Stone <email@hidden>
  • Date: Wed, 26 Oct 2011 09:21:57 -0500

On Oct 24, 2011, at 17:07, Shane Stanley wrote:
ExifTool is an excellent solution, but it's probably worth mentioning the QuickTime File Suite of System Events. It will give you duration, and a bunch of other possibly relevant properties.
______________________________________________________________________

Hey Shane,

Worth mentioning absolutely, but the available info is annoyingly brief.  You also have to perform some magic to get a usable number out of the duration.

try
   tell application "Finder"
      set sel to selection as alias list
      if sel ≠ {} then
         set fSel to first item of sel
         set theMovie to fSel as string
      end if
   end tell

   

   tell application "System Events"
      set theMovie to movie file theMovie
      set theDuration to (duration of theMovie) / (time scale of theMovie)
   end tell

   

on error errMsg number errNum
   set {cr, sep} to {return, "------------------------------------------"}
   set e to sep & cr & "Error: " & errMsg & cr & sep & cr & "Error Number: " & errNum & cr & sep
   beep
   display dialog e
end try

You can't even yank the whole QuickTime Data record out at once; you have to pull the individual properties out piecemeal.

I wouldn't use it if I had a good alternative.

--
Best Regards,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Get length of audio/video files
      • From: Shane Stanley <email@hidden>
References: 
 >RE: Re: (no subject)That (From: email@hidden)
 >Re: (no subject)Thatinteract with alerts (From: Dana Hill <email@hidden>)
 >Re: (no subject)Thatinteract with alerts (From: Shane Stanley <email@hidden>)
 >Re: (no subject)Thatinteract with alerts (From: Alex Zavatone <email@hidden>)
 >Re: (no subject)Thatinteract with alerts (From: Shane Stanley <email@hidden>)
 >Re: (no subject)Thatinteract with alerts (From: Alex Zavatone <email@hidden>)
 >Re: (no subject)Thatinteract with alerts (From: Shane Stanley <email@hidden>)
 >Re: (no subject)Thatinteract with alerts (From: Alex Zavatone <email@hidden>)
 >Re: (no subject)Thatinteract with alerts (From: Shane Stanley <email@hidden>)
 >Re: (no subject)Thatinteract with alerts (From: email@hidden)
 >Get length of audio/video files (From: Bob Majors <email@hidden>)
 >Re: Get length of audio/video files (From: Christopher Stone <email@hidden>)
 >Re: Get length of audio/video files (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Get length of audio/video files
  • Next by Date: Re: Get length of audio/video files
  • Previous by thread: Re: Get length of audio/video files
  • Next by thread: Re: Get length of audio/video files
  • Index(es):
    • Date
    • Thread