Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- duration=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $1)
- echo "duration: $duration"
- fps=$( ffprobe -v 0 -of compact=p=0 -select_streams 0 -show_entries stream=r_frame_rate $1 | sed 's/r_frame_rate=//' | bc )
- echo "fps: $fps"
- TotalFrames=$( bc <<< "$duration*$fps" )
- echo "Total Frames: $TotalFrames"
- clipsCount=20
- clipsLength=40
- for i in $( seq 0 $( bc <<< "$clipsCount-1" ) ); do \
- skipFrames=$( bc <<< "$i*($TotalFrames/$clipsCount)" )
- skipTime=$( bc <<< "$skipFrames/$fps" )
- ffmpeg -ss $skipTime -i $1 -map 0:v:0 -map 0:a -vframes $clipsLength \
- -c:v vp9 -crf 30 -b:v 0k -pix_fmt yuv420p \
- -c:a libvorbis -q:a 5 \
- -y -cpu-used 8 -threads 8 -speed 5 $i-50frames.webm
- done
- rm ./scr_files.txt
- ls | grep webm | sort -h | while read a; do echo "file '$a'" >> ./scr_files.txt; done
- ffmpeg -f concat -i ./scr_files.txt -c copy result.webm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement