Use "hh:mm:ss.mss" as the format for the timestamps if you don't want to enable fix_keyframes so that the trim will be instant. For example:
fftrim video.mp4 "01:00:03.000" "03:00:00.000"
Use "hh:mm:ss.mss" as the format for the timestamps if you don't want to enable fix_keyframes so that the trim will be instant. For example:
fftrim video.mp4 "01:00:03.000" "03:00:00.000"
#!/bin/bash | |
if [ $# -lt 3 ]; then | |
echo "Usage: fftrim <file path> <start timestamp> <end timestamp> [fix_keyframes: true|false] [output_extension=default]" | |
exit 1 | |
fi | |
if [ "$4" = "true" ]; then | |
keyframe_arg="-async 1" | |
else | |
keyframe_arg="-c copy" | |
fi | |
epoch_secs=$(date +%s) | |
filepath="$1" | |
ext=${filepath: -3} | |
filename=${filepath::-4} | |
if [ -n "$5" ]; then | |
ext="$5" | |
fi | |
ffmpeg -i "$filepath" -ss "$2" -to "$3" $keyframe_arg "$filename.trimmed_$epoch_secs.$ext" |