Skip to content

Instantly share code, notes, and snippets.

@Sysetup
Last active July 24, 2018 23:25
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 Sysetup/4d6dfc71f2a54762cd034eec113684cd to your computer and use it in GitHub Desktop.
Save Sysetup/4d6dfc71f2a54762cd034eec113684cd to your computer and use it in GitHub Desktop.
Cut the last 10 seconds of several video files "Bash Script"
for file in `find . -name '*.mp4'`
do
echo "This is the file: " $file
DURATION=`ffprobe -i $file -show_format -v quiet | sed -n 's/duration=//p'`
echo "Duration: " $DURATION
FINAL=`echo "$DURATION - 10" | bc`
echo "Final Duration: " $FINAL
ffmpeg -i $file -t $FINAL -c copy $file.mp4
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment