unix4artists/ffmpeg/basic/trim.sh

24 lines
737 B
Bash

#!/bin/bash -e
#####################################################
#
# This script will trim your video to a 5 second length
# starting 2 seconds into it and write the output as a
# ProRes video file.
#
# Usage: bash ffmpeg/basic/trim.sh <input video> <output video>
#
#####################################################
INPUT="${1}"
OUTPUT="${2}"
# Check if output file extension is .mov
if [[ "${OUTPUT}" != *".mov" ]]; then
echo "Please use an .mov extension on your output file argument"
exit 2
fi
# Trim the video using the "-t" argument with the value 5 (seconds)
# and starting at 00:00:02 (h:m:s) using the "-ss" seeking argument
ffmpeg -ss 00:00:02 -i "${INPUT}" -t 5 -c:v prores_ks -profile:v 3 -c:a copy "${OUTPUT}"