Push-Nachrichten von MacTechNews.de
Würden Sie gerne aktuelle Nachrichten aus der Apple-Welt direkt über Push-Nachrichten erhalten?
Forum>Software>[Video] Seitenverhältnis erkennen und dementsprechend Dateinamen einfärben

[Video] Seitenverhältnis erkennen und dementsprechend Dateinamen einfärben

Bozol
Bozol21.01.1222:31
Hi,

ich habe viele Filme aus dem TV aufgenommen und mittlerweile festgestellt das die aktuellen Wiederholungen in besserer Auflösung gesendet werden. Daher suche ich nach einer Möglichkeit das Seitenverhältnis der Filme, also i.d.R 4:3 oder 16:9, zu erkennen und die Dateinamen farblich hervorzuheben um erkennen zu können ob sich eine erneute Aufzeichnung rentiert.

Kennt jemand ein Tool welches dafür geeignet wäre bzw. könnte man das vielleicht mit Automator/Applescript erledigen?

Danke für jeden Tip,

Fred


0

Kommentare

_mäuschen
_mäuschen22.01.1200:34

Ungefähr so

tell application "Finder" to set source_folder to choose folder with prompt "Wähle Ordner"

tell application "System Events" to set item_list to get every item of source_folder

tell application "QuickTime Player"
    repeat with the_file in item_list
        set the_info to info for the_file
        if kind of the_info contains "movie" or kind of the_info contains "video" then
            open the_file
            repeat until exists document 1
            end repeat
            set d to the natural dimensions of document 1
            if (item 1 of d) / (item 2 of d) is greater than 1.334 then
                --display dialog "16:9"
                tell application "Finder" to set label index of (the_file as alias) to 6
            else
                --    display dialog "4:3"
                tell application "Finder" to set label index of (the_file as alias) to 2
            end if
            close document 1
        end if
    end repeat
end tell


0
Bozol
Bozol22.01.1200:45
Danke schön. Ich werds morgen testen.
0
Bozol
Bozol22.01.1201:00
Ah, anscheinend ein kleines Missverständnis.

Ich habe vergessen zu sagen das ich die Videos meist als .mkv abspeichere, manchmal auch als mp4/m4v (HD der öffentl. Rechtlichen) vielleicht wird auch deswegen anstatt Quicktime mein mit dem Filetype(n) verbundener Player gestartet?

Ich möchte die Videos nicht abspielen sondern nur prüfen welches Seitenverhältnis diese haben und dementsprechend die Dateinamen einfärben. Oder liegt das ungewollte Abspielen nur am falschen Playeraufruf?
0
_mäuschen
_mäuschen22.01.1202:22

Da wird nichts abgespielt. Hat ja kein PLAY Befehl

Und für wegen Matroska



tell application "Finder" to set source_folder to choose folder with prompt "Wähle Ordner"
tell application "System Events" to set item_list to get every item of source_folder
tell application "QuickTime Player"
repeat with the_file in item_list
set the_info to info for the_file
if kind of the_info contains "movie" or kind of the_info contains "video" then
open the_file
repeat until exists document 1
delay 3
end repeat
if kind of the_info contains "Matroska" then delay ((size of the_info) / 35000000)
set d to the natural dimensions of document 1
if (item 1 of d) / (item 2 of d) is greater than 1.334 then
tell application "Finder" to set label index of (the_file as alias) to 6
else
tell application "Finder" to set label index of (the_file as alias) to 2
end if
close document 1
end if
end repeat
end tell

0
_mäuschen
_mäuschen22.01.1212:18


Ha.

Viel schneller geht's mit MKVtools 2 http://www.emmgunn.com/oldsoftware.html

set the_command to quoted form of "/Users/Admin/Desktop/mkvtools 2.4.7/MKVtools.app/Contents/Resources/mediainfo"

tell application "Finder" to set source_folder to choose folder with prompt "Wähle Ordner"
tell application "System Events"
set item_list to get every item of source_folder
repeat with the_file in item_list
set the_info to info for the_file
if kind of the_info contains "movie" or kind of the_info contains "video" then
set posix_path to POSIX path of the_file
set the_width to do shell script the_command & space & posix_path & " | grep Width | sed 's/[^0-9]//g'"
set the_height to do shell script the_command & space & posix_path & " | grep Height | sed 's/[^0-9]//g'"
if (the_width as real) / (the_height as real) is greater than 1.334 then
--display dialog "16:9"
tell application "Finder" to set label index of (the_file as alias) to 6
else
--display dialog "4:3"
tell application "Finder" to set label index of (the_file as alias) to 2
end if
end if
end repeat
end tell

0
Luivision22.01.1212:44
oder http://mediainspector.massanti.com/


In der Regel wird auch die Auflösung angezeigt wen man cmd+i drückt wen der film im player ausgewählt ist.

0
_mäuschen
_mäuschen22.01.1213:05

Ich dumm

ratio kann man ja gleich direkt auslesen

set the_ratio to (do shell script the_command & space & posix_path & " | grep \"Display aspect ratio\" | sed 's/[^0-9]//g'")
if the_ratio is greater than 34 then

0
Bozol
Bozol22.01.1213:58
Hm, ersetzen diese beiden Zeilen jene hier:
set the_width to do shell script the_command & space & posix_path & " | grep Width | sed 's/[^0-9]//g'"
set the_height to do shell script the_command & space & posix_path & " | grep Height | sed 's/[^0-9]//g'"
if (the_width as real) / (the_height as real) is greater than 1.334 then
0
_mäuschen
_mäuschen22.01.1214:04

Genau

0
Bozol
Bozol22.01.1215:48
Leider hakts doch noch irgendwo:
error "„System Events“ hat einen Fehler erhalten: sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `'/Applications/MKVtools.app/Contents/Resources/mediainfo' /Volumes/Work/Scratch/Neuer Ordner/The Blues Brothers 2000 HD (1998).mkv | grep \"Display aspect ratio\" | sed 's/[^0-9]//g''" number 2

Ich bin ja hierbei nur Noob, aber könnte man die Ratio nicht auch per Terminal mittels mdls ermitteln? Somit wäre man nicht auf Drittsoftware angewiesen.

0
_mäuschen
_mäuschen22.01.1216:18


mdls ergibt kein Resultat für ratio :'(

Aber

versuchs nochmal mit

set the_command to quoted form of "/Users/Admin/Desktop/mkvtools 2.4.7/MKVtools.app/Contents/Resources/mediainfo"

tell application "Finder" to set source_folder to choose folder with prompt "Wähle Ordner"
tell application "System Events"
    set item_list to get every item of source_folder
    repeat with the_file in item_list
        set the_info to info for the_file
        if kind of the_info contains "movie" or kind of the_info contains "video" then
            set posix_path to POSIX path of the_file
            set the_ratio to do shell script the_command & space & quoted form of posix_path & " | grep \"Display aspect ratio\" | sed 's/[^0-9]//g'"
            log the_ratio
            if the_ratio as real is greater than 43 then
                --display dialog "16:9"
                tell application "Finder" to set label index of (the_file as alias) to 6
            else
                --display dialog "4:3"
                tell application "Finder" to set label index of (the_file as alias) to 2
            end if
        end if
    end repeat
end tell

0
mactelge
mactelge22.01.1217:13
...ich würde das alles gern verstehen wollen!
„Dreh´dich um – bleib´wie du bist – dann hast du Rückenwind im Gesicht!“
0
Bozol
Bozol22.01.1217:34
Hallo _mäuschen,
er erkennt nur das .mkv-File, die anderen 16:9 oder 4:3 als .mp4/.m4v/.mpeg werden nicht erkannt.

EDIT: noch schnell das 4:3 in .mkv konvertiert. Nun wird es auch korrekt erkannt.

tell application "Finder"
    choose folder with prompt "Wähle Ordner"
        --> alias "Work:Scratch:Neuer Ordner:"
end tell
tell application "System Events"
    get every item of alias "Work:Scratch:Neuer Ordner:"
        --> {file "Work:Scratch:Neuer Ordner:.DS_Store", file "Work:Scratch:Neuer Ordner:Bob's Big Break.mpeg", file "Work:Scratch:Neuer Ordner:Dirty Harry (1971).m4v", file "Work:Scratch:Neuer Ordner:Dragonball Z S01E021 - Kurz vor Zwölf.m4v", file "Work:Scratch:Neuer Ordner:Ein Goldfisch an der Leine HD (1964).mp4", file "Work:Scratch:Neuer Ordner:Mothra II - Das versunkene Koenigreich.mp4", file "Work:Scratch:Neuer Ordner:The Blues Brothers 2000 HD (1998).mkv"}
    info for file "Work:Scratch:Neuer Ordner:.DS_Store"
        --> error number -10004
end tell
tell current application
    info for file "Work:Scratch:Neuer Ordner:.DS_Store"
        --> {name:".DS_Store", creation date:date "Sonntag, 22. Januar 2012 12:20:01", modification date:date "Sonntag, 22. Januar 2012 17:26:09", size:6148, folder:false, alias:false, package folder:false, visible:false, extension hidden:false, name extension:missing value, displayed name:".DS_Store", kind:"Dokument", file type:"    ", file creator:"    ", type identifier:"dyn.agk8wakbaea", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "System Events"
    info for file "Work:Scratch:Neuer Ordner:Bob's Big Break.mpeg"
        --> error number -10004
end tell
tell current application
    info for file "Work:Scratch:Neuer Ordner:Bob's Big Break.mpeg"
        --> {name:"Bob's Big Break.mpeg", creation date:date "Samstag, 10. Oktober 2009 23:01:05", modification date:date "Samstag, 10. Oktober 2009 23:01:05", size:231044772, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"mpeg", displayed name:"Bob's Big Break.mpeg", default application:alias "System:Applications:QuickTime Player.app:", kind:"MPEG-Film", file type:"MPEG", file creator:"TVOD", type identifier:"public.mpeg", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "System Events"
    info for file "Work:Scratch:Neuer Ordner:Dirty Harry (1971).m4v"
        --> error number -10004
end tell
tell current application
    info for file "Work:Scratch:Neuer Ordner:Dirty Harry (1971).m4v"
        --> {name:"Dirty Harry (1971).m4v", creation date:date "Sonntag, 26. Juni 2011 12:12:24", modification date:date "Sonntag, 26. Juni 2011 12:49:25", size:1.885209437E+9, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"m4v", displayed name:"Dirty Harry (1971).m4v", default application:alias "System:Applications:MPlayer OSX Extended.app:", kind:"MPEG-4 File", file type:"BINA", file creator:"UNIX", type identifier:"com.apple.m4v-video", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "System Events"
    info for file "Work:Scratch:Neuer Ordner:Dragonball Z S01E021 - Kurz vor Zwölf.m4v"
        --> error number -10004
end tell
tell current application
    info for file "Work:Scratch:Neuer Ordner:Dragonball Z S01E021 - Kurz vor Zwölf.m4v"
        --> {name:"Dragonball Z S01E021 - Kurz vor Zwölf.m4v", creation date:date "Sonntag, 11. Dezember 2011 13:32:28", modification date:date "Sonntag, 11. Dezember 2011 13:40:43", size:171106456, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"m4v", displayed name:"Dragonball Z S01E021 - Kurz vor Zwölf.m4v", default application:alias "System:Applications:MPlayer OSX Extended.app:", kind:"MPEG-4 File", file type:"BINA", file creator:"UNIX", type identifier:"com.apple.m4v-video", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "System Events"
    info for file "Work:Scratch:Neuer Ordner:Ein Goldfisch an der Leine HD (1964).mp4"
        --> error number -10004
end tell
tell current application
    info for file "Work:Scratch:Neuer Ordner:Ein Goldfisch an der Leine HD (1964).mp4"
        --> {name:"Ein Goldfisch an der Leine HD (1964).mp4", creation date:date "Dienstag, 31. Mai 2011 17:50:26", modification date:date "Dienstag, 31. Mai 2011 17:50:26", size:8.200180346E+9, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"mp4", displayed name:"Ein Goldfisch an der Leine HD (1964).mp4", default application:alias "System:Applications:MPlayer OSX Extended.app:", kind:"MPEG-4 File", file type:"mpg4", file creator:"TVOD", type identifier:"public.mpeg-4", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "System Events"
    info for file "Work:Scratch:Neuer Ordner:Mothra II - Das versunkene Koenigreich.mp4"
        --> error number -10004
end tell
tell current application
    info for file "Work:Scratch:Neuer Ordner:Mothra II - Das versunkene Koenigreich.mp4"
        --> {name:"Mothra II - Das versunkene Koenigreich.mp4", creation date:date "Freitag, 1. Januar 2010 19:40:15", modification date:date "Freitag, 1. Januar 2010 19:40:15", size:1.48832965E+9, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"mp4", displayed name:"Mothra II - Das versunkene Koenigreich.mp4", default application:alias "System:Applications:MPlayer OSX Extended.app:", kind:"MPEG-4 File", file type:"BINA", file creator:"UNIX", type identifier:"public.mpeg-4", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "System Events"
    info for file "Work:Scratch:Neuer Ordner:The Blues Brothers 2000 HD (1998).mkv"
        --> error number -10004
end tell
tell current application
    info for file "Work:Scratch:Neuer Ordner:The Blues Brothers 2000 HD (1998).mkv"
        --> {name:"The Blues Brothers 2000 HD (1998).mkv", creation date:date "Freitag, 6. Januar 2012 15:23:47", modification date:date "Freitag, 6. Januar 2012 17:26:44", size:6.910994658E+9, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"mkv", displayed name:"The Blues Brothers 2000 HD (1998).mkv", default application:alias "System:Applications:MPlayer OSX Extended.app:", kind:"Matroska Video File", file type:"BINA", file creator:"UNIX", type identifier:"dyn.agk8yewnske", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "System Events"
    get POSIX path of file "Work:Scratch:Neuer Ordner:The Blues Brothers 2000 HD (1998).mkv"
        --> "/Volumes/Work/Scratch/Neuer Ordner/The Blues Brothers 2000 HD (1998).mkv"
    do shell script "'/Applications/MKVtools.app/Contents/Resources/mediainfo' '/Volumes/Work/Scratch/Neuer Ordner/The Blues Brothers 2000 HD (1998).mkv' | grep \"Display aspect ratio\" | sed 's/[^0-9]//g'"
        --> error number -10004
end tell
tell current application
    do shell script "'/Applications/MKVtools.app/Contents/Resources/mediainfo' '/Volumes/Work/Scratch/Neuer Ordner/The Blues Brothers 2000 HD (1998).mkv' | grep \"Display aspect ratio\" | sed 's/[^0-9]//g'"
        --> "169"
end tell
tell application "System Events"
    (*169*)
    get file "Work:Scratch:Neuer Ordner:The Blues Brothers 2000 HD (1998).mkv"
        --> file "Work:Scratch:Neuer Ordner:The Blues Brothers 2000 HD (1998).mkv"
end tell
tell application "Finder"
    set label index of alias "Work:Scratch:Neuer Ordner:The Blues Brothers 2000 HD (1998).mkv" to 6
        --> 6
end tell
Ergebnis:
6
0
_mäuschen
_mäuschen22.01.1217:52


Setze ein zuoberst

set the_kinds to {"QuickTime-Film", "MPEG-4-Film", "MPEG-Film", "MPEG-4 File", "AVI-Film", "Matroska video", "Matroska Video File"}


Ersetze

--if kind of the_info contains "movie" or kind of the_info contains "video" then

mit

if (kind of the_info) is in the_kinds then


0
Bozol
Bozol22.01.1218:05
Es klappt.
Geil, einfach geil.

Vielen, vielen Dank _mäuschen.
0

Kommentieren

Diese Diskussion ist bereits mehr als 3 Monate alt und kann daher nicht mehr kommentiert werden.