Created
October 4, 2020 20:57
-
-
Save m1k1o/4432413f6f9a13f5e80bd39926e7b5ae to your computer and use it in GitHub Desktop.
Create youtube storyboards from VOD videos using FFMPEG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Storyboard frequency: | |
# | |
# 0 - 2 min, every 1 sec. | |
# 2 min - 5 min, every 2 sec. | |
# 5 min - 15 min, every 5 sec. | |
# 15 min + every 10 sec. | |
# | |
# Storyboard size: | |
# | |
# 1: 5x5 @ 160x90 => 800x450px | |
# 2: 10x10 @ 80x45 => 800x450px | |
INPUT="$1" | |
DURATION="$(ffprobe -i "$INPUT" -show_entries format=duration -v quiet -of csv="p=0")" | |
if (( $(echo "$DURATION < 2*60" | bc -l) )); then | |
FPS=1 | |
elif (( $(echo "$DURATION < 5*60" | bc -l) )); then | |
FPS=1/2 | |
elif (( $(echo "$DURATION < 15*60" | bc -l) )); then | |
FPS=1/5 | |
else | |
FPS=1/10 | |
fi | |
echo "Duration is $DURATION" | |
echo "FPS is $FPS" | |
ffmpeg -i "$INPUT" \ | |
-vf "fps=$FPS,scale=80:45,tile=10x10" -an -vsync 0 -start_number 0 "storyboard_L1_M%d.png" \ | |
-vf "fps=$FPS,scale=160:90,tile=5x5" -an -vsync 0 -start_number 0 "storyboard_L2_M%d.png"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment