Skip to content

Instantly share code, notes, and snippets.

@lmlsna
Last active July 25, 2024 09:57
Show Gist options
  • Save lmlsna/0d27155b661a230293e9127f295640cf to your computer and use it in GitHub Desktop.
Save lmlsna/0d27155b661a230293e9127f295640cf to your computer and use it in GitHub Desktop.
Return the number of frames in a video file using ffprobe (ffmpeg)
#!/bin/bash
# Print the number of video frames in $1
ffprobe -count_frames -v error -select_streams v:0 -show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 ${1}
#!/bin/bash
# Extract a thumbnail image from video $1 every $3 seconds into directory $2
ffmpeg -vf fps=1/${2} -i "${1}" "${3}/%03d.jpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment