Skip to content

Instantly share code, notes, and snippets.

@ymauray
ymauray / extract_video.sh
Created July 15, 2016 19:34
How to cut a video file on black keyframes
# Re-encode source video with one keyframe every 5 frames
ffmpeg -i source.mkv -g 5 tmp.mkv
# Search black frames
ffmpeg -i tmp.mkv -vf blackframe -f null -
# Use output to locate black frames right on keyframes
# Then cut video at those keyframes
ffmpeg -i tmp.mkv -ss 6.089 -to 180.263 -c copy tmp2.mkv