Das geht mit der Hilfe von AppleScript
das script erzeugt eine Datei Movie Data.txt auf dem Schreibtisch.
Die Zeilen sind Tab-getrennt und enthalten Name, Grösse und Dauer der Filme in ~/Pictures
Für einen beliebigen Ordner ersetze
durch
Edit:
Hier noch eine wesentlich schnellere Version mit AppleScriptObjC und dem AVFoundation framework
Die Zeilen sind Tab-getrennt und enthalten Name, Grösse und Dauer der Filme in ~/Pictures
Show Plain Text
- set moviesFolder to path to movies folder
- set movieList to {}
- tell application "System Events"
- set allFiles to files of moviesFolder whose kind contains "movie" or kind is "MPEG-4 File"
- repeat with aFile in allFiles
- set {natural dimensions:dim, duration:dur, time scale:timeScale} to contents of movie file (path of aFile)
- set hms to my secsToHMS(dur / timeScale)
- set end of movieList to {name of aFile & tab & ((item 3 of dim as text) & "x" & item 4 of dim as text) & tab & hms}
- end repeat
- end tell
- set {TID, text item delimiters} to {text item delimiters, linefeed}
- set movieList to movieList as text
- set text item delimiters to TID
- set filePath to POSIX path of (path to desktop as text) & "Movie Data.txt"
- try
- set fileDescriptor to open for access filePath with write permission
- write movieList to fileDescriptor
- close access fileDescriptor
- on error
- try
- close access filePath
- end try
- end try
- on secsToHMS(secs)
- tell secs to return (it div hours as text) & ":" & my padZero(it mod hours div minutes) & ":" & my padZero(it mod hours mod minutes div 1)
- end secsToHMS
- on padZero(v)
- return text -2 thru -1 of ("0" & v)
- end padZero
Für einen beliebigen Ordner ersetze
Show Plain Text
- set moviesFolder to path to movies folder
durch
Show Plain Text
- set moviesFolder to (choose folder)
Edit:
Hier noch eine wesentlich schnellere Version mit AppleScriptObjC und dem AVFoundation framework
Show Plain Text
- use AppleScript version "2.4" -- Yosemite (10.10) or later
- use framework "Foundation"
- use framework "AVFoundation"
- use scripting additions
- property |⌘| : a reference to current application
- set moviesFolder to path to movies folder
- set movieList to {}
- tell application "Finder" to set allURLs to URL of files of moviesFolder
- set dateFormatter to |⌘|'s NSDateComponentsFormatter's alloc()'s init()
- repeat with anURL in allURLs
- set foundationURL to (|⌘|'s NSURL's URLWithString:anURL)
- set fileName to foundationURL's lastPathComponent() as text
- set asset to (|⌘|'s AVAsset's assetWithURL:foundationURL)
- if asset's isReadable() as boolean then
- set tracks to (asset's tracksWithMediaType:(|⌘|'s AVMediaTypeVideo))
- set firstTrack to (tracks's objectAtIndex:0)
- set {width, height} to firstTrack's naturalSize() as list
- set trackTiming to firstTrack's timeRange() as list
- set {tSeconds, tScale, a, b} to item 2 of trackTiming
- set hms to (dateFormatter's stringFromTimeInterval:(tSeconds / tScale))
- set end of movieList to {fileName & tab & (width as integer as text) & "x" & (height as integer as text) & tab & hms}
- end if
- end repeat
- set {TID, text item delimiters} to {text item delimiters, linefeed}
- set movieList to movieList as text
- set text item delimiters to TID
- set filePath to POSIX path of (path to desktop as text) & "Movie Data.txt"
- try
- set fileDescriptor to open for access filePath with write permission
- write movieList to fileDescriptor
- close access fileDescriptor
- on error
- try
- close access filePath
- end try
- end try