The command will output where keyframes exist within the input video. Useful to know when trying to segment for HLS etc, or troubleshoot playback issues
# Print Timestamps
ffprobe -show_frames -select_streams v:0 -print_format csv $VIDEO_FILE 2> /dev/null | awk -F ',' '{ if ($4 > 0) print $6; }'
# Calculate the durations between keyframes and their distribution
ffprobe -show_frames -select_streams v:0 -print_format csv $VIDEO_FILE 2> /dev/null \
| awk -F ',' '{ if ($4 > 0) print $6; }' \
| awk 'NR>1{print $1-p} {p=$1}'\
| sort | uniq -c
# Getting Keyframe positions by frame number
ffprobe -show_frames -select_streams v:0 -print_format csv $VIDEO_FILE 2> /dev/null | awk -F ',' '{ if ($4 > 0) print NR; }'
# Calculating the Keyframe interval by framecount
ffprobe -show_frames -select_streams v:0 -print_format csv $VIDEO_FILE 2> /dev/null \
| awk -F ',' '{ if ($4 > 0) print NR; }' \
| awk 'NR>1{print $1-p} {p=$1}'\
| sort | uniq -c
# Getting the average framerate
ffprobe -v 0 -of compact=p=0 -select_streams 0 -show_entries stream=r_frame_rate $VIDEO_FILE | grep -o -P "[0-9,/]+" | bc