Travails with my camera

Creating a Video Leader (countdown clock) – Part 1

Just playing with creating a Video Leader in Linux, have the video working, audio is for another time:

Here’s the code:


#!/bin/bash

cd $1

# GET COUNTDOWN CLOCK BACKGROUND

wget http://www.jobterburg.nl/PREVIEWS/LEADERS/Countdown_16x9_SQPIX_RGB.zip
unzip Countdown_16x9_SQPIX_RGB.zip
rm Countdown_16x9_SQPIX_RGB.zip

cd Countdown_16x9_SQPIX_RGB\ Folder

cp ../$2 .

# CREATE SMPTE BARS

gst-launch -e videotestsrc pattern=smpte num-buffers=500 ! video/x-raw-rgb, framerate=25/1, width=1920, height=1080 ! pngenc compression-level=9 snapshot=false ! multifilesink location="%05d.png"


# SCALE LOGO

convert $2 -scale 400 $2-small.png

i=500

# CREATE PNG FILES

for file in countdown*jpg
do
    convert $file -scale 1920x1080 "${file%.jpg}".png
    convert "${file%.jpg}".png $2-small.png -gravity North -composite "${file%.jpg}".png
    b=$(printf "%5.5i.png" $i)
    mv "${file%.jpg}".png $b
    for j in {1..24}
    do
        i=`expr $i + 1`
	c=$(printf "%5.5i.png" $i)
        cp $b $c
    done
    i=`expr $i + 1`
done

# ENCODE VIDEO

mkfifo leader.y4m

mplayer mf://*.png -mf w=1920:h=1080:fps=25:type=png -vo yuv4mpeg:file=leader.y4m &

ffmbc -y -i leader.y4m -r 25 -an -vcodec libx264 -aspect 16:9 -b 15M -g 25 -keyint_min 2 -bf 3 -refs 4 -b_strategy 2 -trellis 2 -bt 1M -partitions +partp8x8+partp4x4+partb8x8+parti8x8 -me_method umh -me_range 512  -f mov leader.mov

# CLEAR UP

mv leader.mov ../

rm leader.y4m *.png *.jpg

cd ../

rmdir --ignore-fail-on-non-empty  Countdown_16x9_SQPIX_RGB\ Folder
rmdir --ignore-fail-on-non-empty  __MACOSX

Further work needed to add audio tones and convert to a DNxHD or XDCAM output file.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s