Skip to content

Instantly share code, notes, and snippets.

@golopot
Last active June 7, 2019 10:22
Show Gist options
  • Save golopot/7a64f1066897caadb7f7ee940775b42a to your computer and use it in GitHub Desktop.
Save golopot/7a64f1066897caadb7f7ee940775b42a to your computer and use it in GitHub Desktop.
Cut a video by ffmpeg
#!/bin/bash
inPath=$1
start=$2
end=$3
outPath=@$1
fileDate=$(date -Rr ${inPath})
if [ -z ${end} ]
then
>&2 echo "Usage: ffcut <filename> <start> <end>"
exit
fi
ffmpeg \
-hide_banner \
-y \
-ss ${start} \
-to ${end} \
-i ${inPath} \
-c copy \
${outPath}
touch -d "${fileDate}" ${outPath}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment