Mac - Applescript: Unterschied zwischen den Versionen
Steff (Diskussion | Beiträge) |
|||
| (8 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt) | |||
| Zeile 6: | Zeile 6: | ||
Automator vereinfacht das Scripting und ist im Prinzip ein Tool um Skripte aus vorgefertigten Bausteinen zusammenzuklicken | 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 | https://mac.appstorm.net/how-to/productivity-how-to/automator-the-ultimate-automation-assistant/#more-4345 | ||
| + | |||
| + | === 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. | ||
| + | |||
| + | Schnellaktionen landen später in der '''User library unter services''' | ||
| + | |||
| + | ==== .mov -> .mp4 mit Handbreak CLI (Schnellaktion)==== | ||
| + | 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: | ||
| + | <syntaxhighlight lang="shell"> | ||
| + | for if in "$@" | ||
| + | do | ||
| + | /Applications/HandBrakeCLI -i "$if" -o "$if".mp4 --preset="Normal" | ||
| + | done | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === 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. | ||
| + | |||
| + | 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 | ||
| + | |||
| + | [[File:mov_to_giv_automator-2048x1581.png|400px]] | ||
| + | |||
| + | <syntaxhighlight lang="shell"> | ||
| + | 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 | ||
| + | </syntaxhighlight> | ||
| + | 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 ?===== | ||
| + | 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
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.