|
|
brtv-generate-title-slides.sh - bitreich-tv - Meme TV encoding and streaming |
|
|
 |
git clone git://bitreich.org/bitreich-tv git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/bitreich-tv (git://bitreich.org) |
|
|
 |
Log |
|
|
 |
Files |
|
|
 |
Refs |
|
|
 |
Tags |
|
|
 |
LICENSE |
|
|
|
--- |
|
|
|
brtv-generate-title-slides.sh (1626B) |
|
|
|
--- |
|
|
|
1 #!/bin/sh |
|
|
|
2 # generate title slide animation for each hashtag in file specified by stdin. |
|
|
|
3 # stdin would typically be annna's module/hashtags/hashtags.txt |
|
|
|
4 # requirements: ffmpeg(1), convert(1) |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 ### CONFIGURATION START |
|
|
|
8 |
|
|
|
9 # output title animations dir |
|
|
|
10 title="/br/gopher/tv/title" |
|
|
|
11 |
|
|
|
12 # ffmpeg flags for generated videos |
|
|
|
13 video_ext="webm" |
|
|
|
14 ffmpeg_codec="-loglevel error -acodec libopus -b:a 96K -f webm -vf scale=1280:-1 -r 30 -ac 2" |
|
|
|
15 |
|
|
|
16 # target video resolution |
|
|
|
17 video_resolution=1280x720 |
|
|
|
18 |
|
|
|
19 # slide style |
|
|
|
20 # xc:$color ( https://imagemagick.org/script/color.php ) |
|
|
|
21 # /some/file.png |
|
|
|
22 bgcontent=/br/gopher/tv/bitreich-tv-bg.png |
|
|
|
23 fgcontent=/br/gopher/tv/bitreich-tv-title-fg.png |
|
|
|
24 |
|
|
|
25 # show title slides for this duration [s] |
|
|
|
26 title_display_time=5 |
|
|
|
27 |
|
|
|
28 # logo to draw in background |
|
|
|
29 logo="bitreichtv.vtv" |
|
|
|
30 |
|
|
|
31 ### CONFIGURATION END |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 temp="$(mktemp).png" |
|
|
|
35 |
|
|
|
36 title_slide() { |
|
|
|
37 # Don't forget the whitespace at the end of the logo. |
|
|
|
38 convert -font "Liberation-Mono" \ |
|
|
|
39 -size "$video_resolution" \ |
|
|
|
40 "${bgcontent}" \ |
|
|
|
41 "${fgcontent}" \ |
|
|
|
42 -gravity center \ |
|
|
|
43 -composite \ |
|
|
|
44 -stroke '#000000' \ |
|
|
|
45 -strokewidth 2 \ |
|
|
|
46 -fill '#FFFFFF' \ |
|
|
|
47 -gravity north \ |
|
|
|
48 -pointsize 13 \ |
|
|
|
49 -draw "text -70,240 '$(cat "$logo")' " \ |
|
|
|
50 -draw "text -70,520 'Playing: ${1}'" \ |
|
|
|
51 "$temp" |
|
|
|
52 |
|
|
|
53 ffmpeg -y \ |
|
|
|
54 -f lavfi \ |
|
|
|
55 -i anullsrc=r=48000 \ |
|
|
|
56 -i "$temp" \ |
|
|
|
57 -t "${title_display_time}" \ |
|
|
|
58 $ffmpeg_codec \ |
|
|
|
59 "$2" < /dev/null |
|
|
|
60 printf '%s\n' "$2" |
|
|
|
61 } |
|
|
|
62 |
|
|
|
63 mkdir -p "$title" |
|
|
|
64 |
|
|
|
65 # make title slide for every tag in first column of stdin |
|
|
|
66 # (if title slide doesn't already exist) |
|
|
|
67 while read -r tag url; do |
|
|
|
68 out="${title}/${tag#\#}.${video_ext}" |
|
|
|
69 if [ ! -f "$out" ]; then |
|
|
|
70 title_slide "$tag" "$out" |
|
|
|
71 fi |
|
|
|
72 done |
|