Mac - Applescript: Unterschied zwischen den Versionen

Aus Wikizone
Wechseln zu: Navigation, Suche
 
(2 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 9: Zeile 9:
 
=== Mac Automator - Scripts ===
 
=== Mac Automator - Scripts ===
 
Gerade im Zusammenspiel mit brew, mit dem man sich praktische Kommandozeilen-Tools holen kann mega effektiv. Oft bietet es sich an einfach eine Schnellaktion zu erstellen.
 
Gerade im Zusammenspiel mit brew, mit dem man sich praktische Kommandozeilen-Tools holen kann mega effektiv. Oft bietet es sich an einfach eine Schnellaktion zu erstellen.
 +
 +
Schnellaktionen landen später in der '''User library unter services'''
 +
 
==== .mov -> .mp4 mit Handbreak CLI (Schnellaktion)====
 
==== .mov -> .mp4 mit Handbreak CLI (Schnellaktion)====
 
Benötigt handbreak
 
Benötigt handbreak
Zeile 23: Zeile 26:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== mov zu gif umwandeln mit ffmpeg ===
+
=== mov zu gif umwandeln mit ffmpeg (Schnellaktion)===
 
Nützlich um schnell mal ein Screenvideoschnipsel zu erstellen. Das kann man auch mal mit E-Mail versenden.
 
Nützlich um schnell mal ein Screenvideoschnipsel zu erstellen. Das kann man auch mal mit E-Mail versenden.
  
Zeile 51: Zeile 54:
 
  brew install ffmpeg
 
  brew install ffmpeg
 
  brew install gifsicle
 
  brew install gifsicle
 +
==== mov2mp4 ?=====
 +
Mit diesen Tipps dürfte sich das Skript oben anpassen lassen:
 +
https://stackoverflow.com/questions/49617878/converting-mov-to-mp4-with-ffmpeg-better-quality
 +
 +
'''Streamcopy'''
 +
if your input '''video and audio are compatible with MP4''' you can use stream copy mode:
 +
 +
ffmpeg -i input.mov -c copy output.mp4
 +
 +
'''Re-encode'''
 +
 +
If you '''need to encode''' to other formats compatible with MP4:
 +
 +
ffmpeg -i input.mov -crf 23 -preset medium -movflags +faststart -c:a aac output.mp4
 +
 +
    * Use the highest -crf value that provides an acceptable quality.
 +
    *    Use the slowest -preset that you have patience for.
 +
    *    If the input is AAC audio you can change -c:a aac to -c:a copy.
 +
 +
See FFmpeg Wiki: H.264 and FFmpeg Wiki: H.265.

Aktuelle Version vom 5. Januar 2022, 15:22 Uhr

Mit Applescript kann man viel auf dem Mac automatisieren.

Applescript - Browser Screenshots automatisieren

Automator[Bearbeiten]

Automator vereinfacht das Scripting und ist im Prinzip ein Tool um Skripte aus vorgefertigten Bausteinen zusammenzuklicken

https://mac.appstorm.net/how-to/productivity-how-to/automator-the-ultimate-automation-assistant/#more-4345

Mac Automator - Scripts[Bearbeiten]

Gerade im Zusammenspiel mit brew, mit dem man sich praktische Kommandozeilen-Tools holen kann mega effektiv. Oft bietet es sich an einfach eine Schnellaktion zu erstellen.

Schnellaktionen landen später in der User library unter services

.mov -> .mp4 mit Handbreak CLI (Schnellaktion)[Bearbeiten]

Benötigt handbreak

https://handbrake.fr/downloads.php
   * Select "movie files" in services receives selected and "Finder.app" in application.
   *     Drag the "Run Shell Script" action.
   *     Select "/bin/bash" in Shell and "as arguments" in Pass input.
   *     Paste the script:
for if in "$@"
do
  /Applications/HandBrakeCLI -i "$if" -o "$if".mp4 --preset="Normal"
done

mov zu gif umwandeln mit ffmpeg (Schnellaktion)[Bearbeiten]

Nützlich um schnell mal ein Screenvideoschnipsel zu erstellen. Das kann man auch mal mit E-Mail versenden.

You will then have a quick action after right clicking any .mov file and can simply convert it to a small and optimised .gif file.

   * fire up automator
   *     create a new quick action
   *     add a shell script to your workflow
   *     paste the following code and don’t forget to choose “as arguments” in the pass input dropdown
   *     save it
Fehler beim Erstellen des Vorschaubildes: Datei fehlt
for f
do
    if [[ $f == *.mov ]]; then
        /usr/local/bin/ffmpeg -i "$f" -pix_fmt rgb24 -r 10 -f gif - | /usr/local/bin/gifsicle --optimize=3 > "$f".gif
    fi
done

This is how everything should look after you are finished. mov_to_giv_automator

You need ffmpeg and gifsicle installed so if you haven’t install them via homebrew.

brew install ffmpeg
brew install gifsicle

mov2mp4 ?=[Bearbeiten]

Mit diesen Tipps dürfte sich das Skript oben anpassen lassen:

https://stackoverflow.com/questions/49617878/converting-mov-to-mp4-with-ffmpeg-better-quality

Streamcopy if your input video and audio are compatible with MP4 you can use stream copy mode:

ffmpeg -i input.mov -c copy output.mp4

Re-encode

If you need to encode to other formats compatible with MP4:

ffmpeg -i input.mov -crf 23 -preset medium -movflags +faststart -c:a aac output.mp4
   * Use the highest -crf value that provides an acceptable quality.
   *     Use the slowest -preset that you have patience for.
   *     If the input is AAC audio you can change -c:a aac to -c:a copy.

See FFmpeg Wiki: H.264 and FFmpeg Wiki: H.265.