Skip to content

Instantly share code, notes, and snippets.

@Birchwell
Created October 17, 2015 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Birchwell/dba79f7289c3154decef to your computer and use it in GitHub Desktop.
Save Birchwell/dba79f7289c3154decef to your computer and use it in GitHub Desktop.
This custom action will split video into clips according to a user defined number of seconds. Can be used with Thunar Custom Actions.
#! /bin/bash
eval RES=($(yad --form --quoted-output --separator=" " --field "Input file:FL" --field "Output dir:DIR" --field "Duration:NUM"))
[[ $? -ne 0 ]] && exit 1
ext=${RES[0]##*.}
out=$(basename ${RES[0]} .$ext)
$mkdir "${RES[2]}"
ffmpeg -i "${RES[0]}" -f segment -segment_time "${RES[2]}" -acodec copy -vcodec copy -reset_timestamps 1 -map 0 "${RES[1]}/$out-%d.$ext"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment