# Create a shortcut key for mpv that will mark the time stamps # and display a message on the screen to indicate the time has been marked. # in this particular case we're going to use the 'b' key # Add to ~/.config/mpv/input.conf b run /bin/sh -c "echo ${=time-pos} >> mpv_timestamps.log";show-text "Timestamp saved: ${time-pos}" # The following script will take the time stamp log # and split the given video at those time stamps. #!/bin/bash [[ $1 ]] && INPUT="$1" || exit [[ -f "$INPUT" ]] || { echo "Error: "$INPUT" not found!"; exit 1; } LOG="mpv_timestamps.log" [[ -f "$LOG" ]] || { echo "Error: "$LOG" not found!"; exit 1; } START=0 COUNT=1 while read -r TIMESTAMP; do OUTPUT="clip_${COUNT}.mp4" ffmpeg -ss "$START" -to "$TIMESTAMP" -i "$INPUT" -c copy -map 0 "$OUTPUT" -y START="$TIMESTAMP" COUNT=$((COUNT + 1)) done <"$LOG" # Optional: Capture the final segment from the last timestamp to the end ffmpeg -ss "$START" -i "$INPUT" -c copy -map 0 "clip_final.mp4" -y