Here is a bash script for convenience (adding to above answer):
#!/bin/bash
# Arguments
FILE_RAW=$1
TRIM_EOF_DURATION=${2:-1.0} # Default is 1.0 second trimmed from EOF
# Prepare variables
BASE_PATH=$(dirname $(readlink -f $FILE_RAW))
FILENAME_EXT="$(basename "${FILE_RAW}")"
FILENAME_ONLY="${FILENAME_EXT%.*}"
EXT_ONLY="${FILENAME_EXT#*.}" # Or hardcode it like "mp4"
FILENAME_ONLY_PATH="${BASE_PATH}/${FILENAME_ONLY}"
# Trim EOF duration
INPUT_DURATION=$(ffprobe -v error -select_streams v:0 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 "${FILENAME_ONLY_PATH}.${EXT_ONLY}")
OUTPUT_DURATION=$(bc <<< "$INPUT_DURATION"-"$TRIM_EOF_DURATION")
ffmpeg -i "${FILENAME_ONLY_PATH}.${EXT_ONLY}" -map 0 -c copy -t "$OUTPUT_DURATION" "${FILENAME_ONLY_PATH}_Trim_${TRIM_EOF_DURATION}.${EXT_ONLY}"
Note: Make script executable: chmod +x trim_video.sh
Usage (Output File: <PATH_TO_INPUT_VIDEO>_Trim_<TRIM_EOF_DURATION>.mp4
)
. <PATH_TO_THIS_SCRIPT>/trim_video.sh <PATH_TO_INPUT_VIDEO> <OPTIONAL_TRIM_EOF_DURATION>
Example: Trim 3.0 seconds from EOF (Output: ~/Videos/input_video_Trim_3.0.mp4
)
. ~/trim_video.sh ~/Videos/input_video.mp4 3.0