Skip to content

Instantly share code, notes, and snippets.

@aboucaud
Created May 29, 2020 23:17
Show Gist options
  • Select an option

  • Save aboucaud/8374980ec2e644df1f58fa14422edd45 to your computer and use it in GitHub Desktop.

Select an option

Save aboucaud/8374980ec2e644df1f58fa14422edd45 to your computer and use it in GitHub Desktop.
[Extract short clip from video] #video #media
# from https://bernd.dev/2020/04/trim-videos-instantly/
INFILE="video.mp4"
OUTFILE="shortenedclip.mp4"
START="00:00:12.35" # Start Time in hh:mm:ss.msec format
DURATION="00:01:05.4" # Duration in hh:mm:ss.msec format
################## Alternative format ##################
# START="12.35" # Start time in s.msec format #
# DURATION="65.4" # Duration time in s.msec format #
########################################################
ffmpeg -ss $START -i $INFILE -c copy -map 0 -t $DURATION $OUTFILE
# If you prefer you can also specify an end time similar to the start time
END="00:01:12.75"
ffmpeg -ss $START -i $INFILE -c copy -map 0 -to $END $OUTFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment