Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion video_automation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ To use generate_title you might need to:
You will also need to have `mlt-melt` and ImageMagick installed. On Fedora, that's:

sudo dnf install mlt
sudo dnf install mlt-freeworld # MP4 support, available in rpmfusion repo.
sudo dnf install newt
sudo dnf install ImageMagick

Next, you need to create the following files:
Expand Down Expand Up @@ -45,7 +47,7 @@ this part wrong.

Generate the title card using `generate_title`

./generate_title "Title" "Speaker(s)"
./generate_title "Template File" "Event Name" "Title" "Speaker(s)"

Generate the final video using:

Expand All @@ -54,6 +56,10 @@ Generate the final video using:
This will generate `raw_video_final.mp4` which will contain all of the
various components, in order.

In case you prefer a guided step-by-step flow, run:

./generate.sh

## Credit

Credit where due:
Expand Down
39 changes: 39 additions & 0 deletions video_automation/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash



TEMPLATE_FILE=$(whiptail --title "Generate video (Step 1/6)" --menu "Please choose the title template:" 25 78 16 \
"template_title_cs8.png" "Presentations related to CentOS Stream 8" \
"template_title_cs9.png" "Presentations related to CentOS Stream 9" 3>&1 1>&2 2>&3)
[[ $? -ne 0 ]] && exit

generate_titlecard(){
EVENT_NAME=$(whiptail --title "Generate video (Step 2/6)" --inputbox "Please enter the event name:" 10 100 3>&1 1>&2 2>&3)
[[ $? -ne 0 ]] && exit
PRESENTATION_TITLE=$(whiptail --title "Generate video (Step 3/6)" --inputbox "Please enter the presentation title:" 10 100 3>&1 1>&2 2>&3)
[[ $? -ne 0 ]] && exit
PRESENTATION_AUTHOR=$(whiptail --title "Generate video (Step 4/6)" --inputbox "Please enter the presentation author:" 10 100 3>&1 1>&2 2>&3)
[[ $? -ne 0 ]] && exit

./generate_title "${TEMPLATE_FILE}" "${EVENT_NAME}" "${PRESENTATION_TITLE}" "${PRESENTATION_AUTHOR}"
}

generate_endcard(){
convert ${TEMPLATE_FILE} -fill "#ffffff" -font Montserrat-Bold -pointsize 54 -annotate +353+188 "Thanks for watching!" endcard.png
mogrify -fill "#000000" -font Montserrat-Regular -pointsize 28 -annotate +67+410 "For more information, visit www.centos.org" endcard.png
mogrify -fill "#000000" -font Montserrat-Regular -pointsize 28 -annotate +67+470 "Please subscribe to our YouTube channel for more great content!" endcard.png
}

generate_video(){
PRESENTATION_VIDEO=$(whiptail --title "Generate video (Step 6/6)" --inputbox "Please enter the source presentation video file name (e.g., interview.mp4):" 10 100 3>&1 1>&2 2>&3)
[[ $? -ne 0 ]] && exit

./merge_all "${PRESENTATION_VIDEO}"
}

generate_titlecard
generate_endcard
generate_video

rm titlecard.png
rm endcard.png
27 changes: 17 additions & 10 deletions video_automation/generate_title
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,40 @@
use strict;
use warnings;
use Getopt::Long qw(GetOptions);
use POSIX qw(strftime);

use Text::Wrap;
$Text::Wrap::columns = 50;
my $fontsize = 35;
$Text::Wrap::columns = 45;

my $help = 0;

GetOptions( "help" => \$help ) or help();
help() if $help;

my $title = $ARGV[0] || help();
my $author = $ARGV[1] || help();
my $wrap_title = wrap( '', '', $title );
my $event_date = strftime "%B %G", localtime;
my $event_template = $ARGV[0] || help();
my $event_name = $ARGV[1] || help();
my $presentation_title = $ARGV[2] || help();
my $presentation_author = $ARGV[3] || help();
my $presentation_title_wrapped = wrap( '', '', $presentation_title );

unless (-e 'template_title.png') {
print "template_title.png is missing. See template_title_EXAMPLE.png for an example of the correct file size for YouTube videos.";
unless (-e $event_template) {
print "$event_template is missing. See template_title_EXAMPLE.png for an example of the correct file size for YouTube videos.";
help();
}

qx/convert template_title.png -font Montserrat-Regular -pointsize $fontsize -annotate +75+350 \"$wrap_title\n\n$author\" titlecard.png/;
qx/convert $event_template -fill \"#ffffff\" -font Montserrat-Bold -pointsize 72 -annotate +353+198 \"$event_name\" titlecard.png/;
qx/mogrify -fill \"#ffffff\" -font Montserrat-Regular -pointsize 35 -annotate +353+255 \"$event_date\" titlecard.png/;
qx/mogrify -fill \"#000000\" -font Montserrat-Bold -pointsize 42 -annotate +67+420 \"$presentation_title_wrapped\" titlecard.png/;
qx/mogrify -fill \"#000000\" -font Montserrat-Regular -pointsize 35 -annotate +67+560 \"$presentation_author\" titlecard.png/;


sub help {

print qq~
Given a template_title.png file, a title, and a speaker name, generates the title card for a YouTube video.
Usage: $0 "TITLE" "SPEAKER"
Eg: $0 "Introduction to ponies" "Rich Bowen"
Usage: $0 "TEMPLATE FILE" "EVENT NAME" "PRESENTATION TITLE" "PRESENTATION SPEAKER"
Eg: $0 "template_title_cs9.png" "Wonderland" "Introduction to ponies" "Rich Bowen"

~;
exit();
Expand Down
Binary file added video_automation/template_title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added video_automation/template_title.xcf
Binary file not shown.
Binary file added video_automation/template_title_cs8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added video_automation/template_title_cs9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.