public:ffmpeg-based_interval_timer_for_sport_and_exercise
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
public:ffmpeg-based_interval_timer_for_sport_and_exercise [2018/02/07 02:11] – [FFmpeg-based Interval Timer for Sport and Exercise] fangfufu | public:ffmpeg-based_interval_timer_for_sport_and_exercise [2018/03/31 00:38] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 5: | Line 5: | ||
After digging through FFmpeg documentation [(https:// | After digging through FFmpeg documentation [(https:// | ||
- | |||
- | Here I present the program listing, and an example output. The script works fine on Debian Stretch. | ||
I have to say FFmpeg is one of my most abused software. Last time I used FFmpeg to upload arbitrary file to Youtube [(https:// | I have to say FFmpeg is one of my most abused software. Last time I used FFmpeg to upload arbitrary file to Youtube [(https:// | ||
- | ===== Program listing ===== | ||
- | <code bash> | ||
- | #!/bin/bash | ||
- | |||
- | # The file number counter | ||
- | let counter=0 | ||
- | |||
- | function cleanup { | ||
- | rm seg-*.mp4 filelist.txt | ||
- | } | ||
- | |||
- | # Calling convention: duration, font size, text | ||
- | function introduction { | ||
- | ffmpeg -f lavfi -i color=c=white: | ||
- | -vf " | ||
- | r=30: x=(w-tw)/2: y=h-h*0.9: fontcolor=black:" | ||
- | -t ${1} -preset slow -tune stillimage -y \ | ||
- | seg-${counter}.mp4 | ||
- | echo "file seg-${counter}.mp4" | ||
- | let counter++ | ||
- | } | ||
- | |||
- | # Calling convention: duration, text | ||
- | function segment { | ||
- | let min=$1/60 | ||
- | let sec=$1-${min}*60 | ||
- | ffmpeg -f lavfi -i color=c=white: | ||
- | -vf " | ||
- | r=30: x=(w-tw)/2: y=h-h*0.75: fontcolor=black:, | ||
- | drawtext=text=' | ||
- | r=30: x=(w-tw)/2: y=h-h*0.5: fontcolor=black:, | ||
- | drawtext=timecode=' | ||
- | r=30: x=(w-tw)/2: y=h-h*0.25: fontcolor=black:" | ||
- | -t ${1} -preset slow -tune stillimage -y \ | ||
- | seg-${counter}.mp4 | ||
- | echo "file seg-${counter}.mp4" | ||
- | let counter++ | ||
- | } | ||
- | |||
- | function output { | ||
- | ffmpeg -f concat -i filelist.txt -c copy -y ${1} | ||
- | cleanup | ||
- | } | ||
- | |||
- | cleanup | ||
- | ############################################################################ | ||
- | # -- Insert your session introduction here -- # | ||
- | # Make sure the font is big enough! You might want to test out the # | ||
- | # introduction generation first by commenting out the main set # | ||
- | # Calling convention: | ||
- | # introduction $DURATION $FONTSIZE $TEXT # | ||
- | ############################################################################ | ||
- | introduction 10 40 " | ||
- | Threshold session: | ||
- | |||
- | W/U - 5 minutes easy, gradually build up | ||
- | 10 mins at 10 mile TT effort | ||
- | 15 seconds sprint | ||
- | 10 mins easy | ||
- | 10 mins at 10 mile TT effort | ||
- | 20 seconds sprint | ||
- | 10 mins easy | ||
- | 10 mins 10 mile TT effort | ||
- | 25 seconds sprint | ||
- | Warm down for 5 mins, easy spinning | ||
- | " | ||
- | |||
- | ############################################################################ | ||
- | # -- Insert your main set here. -- # | ||
- | # You might want to test out the introduction generation before generating # | ||
- | # these video. | ||
- | # Calling convention: | ||
- | # segment $DURATION $TEXT # | ||
- | ############################################################################ | ||
- | |||
- | segment 300 "Easy, gradually build up" | ||
- | segment 600 "10 mile TT effort" | ||
- | segment 15 " | ||
- | segment 600 " | ||
- | segment 600 "10 mile TT effort" | ||
- | segment 20 " | ||
- | segment 600 " | ||
- | segment 600 "10 mile TT effort" | ||
- | segment 25 " | ||
- | segment 300 "Cool down" | ||
- | output UEA-Triathlon-2018-02-07.mp4 | + | You can download it at [[https:// |
- | </code> | + | |
===== Example output ===== | ===== Example output ===== | ||
- | [[https:// | + | [[https:// |
public/ffmpeg-based_interval_timer_for_sport_and_exercise.txt · Last modified: 2018/03/31 00:38 by 127.0.0.1