Saturday, December 2, 2023

How to take a screenshot from a video at a random timestamp

Take a screenshot or frame capture of a video, at a random timestamp (within limits of the duration):

SEC=$(ffprobe -i video -show_format -v quiet | sed -n 's/duration=//p' | cut -d '.' -f 1)
START=$(shuf -i 0-$SEC -n 1)
ffmpeg -y -ss $START -i video -frames:v 1 -q:v 25 screencap.jpg -loglevel panic

Links

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.