#!/bin/bash # Check if all required arguments are provided if [ $# -lt 4 ]; then echo "Usage: $0 " echo "" echo "Arguments:" echo " Path to the input video file." echo " Path to the output video file." echo " Start time in format HH:MM:SS or seconds." echo " Duration of the segment in format HH:MM:SS or seconds." echo "" echo "Example:" echo " $0 input.mp4 output.mp4 00:01:00 30" echo "" exit 1 fi # Assign input arguments to variables input_file=$1 output_file=$2 start_time=$3 duration=$4 # Run ffmpeg command ffmpeg -i "$input_file" -ss "$start_time" -t "$duration" -vcodec copy -acodec copy "$output_file"