Last active
October 6, 2021 08:26
-
-
Save numpde/31e1726dcce83cf10b7d429051578b07 to your computer and use it in GitHub Desktop.
Nautilus script: compress mp4 file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function x { | |
mv "$1" "$1.original.mp4" | |
ffmpeg -i "$1.original.mp4" -vcodec libx264 -crf 40 "$1" -vf scale=640:-1 -preset veryslow \ | |
&& mv "$1.original.mp4" "$1.done.mp4" | |
notify-send "$1 compression done." | |
} | |
# https://stackoverflow.com/questions/11003418/calling-shell-functions-with-xargs | |
export -f x | |
echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | xargs -I {} bash -c 'x "$@"' _ {} | |
# Put in ~/.local/share/nautilus/scripts/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment