#!/bin/bash # Check if all required arguments are provided if [ $# -lt 3 ]; 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 "" echo "Example:" echo " $0 input.mp4 output.mp4 00:01:00" echo "" echo "Note: The output file will start from and will include all remaining content of the input file." exit 1 fi # Assign input arguments to variables input_file=$1 output_file=$2 start_time=$3 # Check if the input file exists if [ ! -f "$input_file" ]; then echo "Error: The input file '$input_file' does not exist." exit 1 fi # Run the ffmpeg command ffmpeg -i "$input_file" -ss "$start_time" -vcodec copy -acodec copy "$output_file" # Check if the ffmpeg command succeeded if [ $? -eq 0 ]; then echo "Video extraction completed successfully. Output saved to '$output_file'." else echo "Error: ffmpeg failed to extract the video." exit 1 fi