diff --git a/video_automation/README.md b/video_automation/README.md index 0a78aa9..b124522 100644 --- a/video_automation/README.md +++ b/video_automation/README.md @@ -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: @@ -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: @@ -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: diff --git a/video_automation/generate.sh b/video_automation/generate.sh new file mode 100755 index 0000000..b53f457 --- /dev/null +++ b/video_automation/generate.sh @@ -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 diff --git a/video_automation/generate_title b/video_automation/generate_title index 0e4bec3..2b9fede 100755 --- a/video_automation/generate_title +++ b/video_automation/generate_title @@ -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(); diff --git a/video_automation/template_title.png b/video_automation/template_title.png new file mode 100644 index 0000000..79a097b Binary files /dev/null and b/video_automation/template_title.png differ diff --git a/video_automation/template_title.xcf b/video_automation/template_title.xcf new file mode 100644 index 0000000..9176c14 Binary files /dev/null and b/video_automation/template_title.xcf differ diff --git a/video_automation/template_title_cs8.png b/video_automation/template_title_cs8.png new file mode 100644 index 0000000..36ff7fe Binary files /dev/null and b/video_automation/template_title_cs8.png differ diff --git a/video_automation/template_title_cs9.png b/video_automation/template_title_cs9.png new file mode 100644 index 0000000..532e056 Binary files /dev/null and b/video_automation/template_title_cs9.png differ