Skip to content

Instantly share code, notes, and snippets.

@DiogenesAnalytics
Created February 22, 2024 16:05
Show Gist options
  • Save DiogenesAnalytics/3b4b22e313d9b16039fa4e40c1059432 to your computer and use it in GitHub Desktop.
Save DiogenesAnalytics/3b4b22e313d9b16039fa4e40c1059432 to your computer and use it in GitHub Desktop.
Cut a video in half using ffmpeg.
duration=$(ffprobe -i $1 -show_entries format=duration -v quiet -of csv="p=0")
half_duration=$(echo "$duration / 2" | bc)
ffmpeg -i $1 -map 0 -c copy -f segment -segment_time $half_duration -reset_timestamps 1 output_half%d.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment