libguestfs webinar video — final cut

Here is the video, handout and transcript:

How did I do it in the end? Using ffmpeg on the command line and the editing script from my previous posting.

#!/bin/bash -

set -e

input="libguestfs-20111118 1602-1.mp4"

codec="-b 500k -vcodec libx264 -ab 128k"
codec_novideo="-vn -ab 128k"
codec_noaudio="-b 500k -vcodec libx264"

cd /tmp

# part1: verbatim
# part2: replace video with "network failure" slide
# part3: verbatim
# part4: replace video with slide #5 from handout
# part5: verbatim
# part6: replace video with slide #1 from handout

split () {
    rm -f part1.avi part2_audio.avi part3.avi part4_audio.avi part5.avi part6_audio.avi

    ffmpeg -i "$input" -t 00:11:30 $codec part1.avi

    # end 13:33
    ffmpeg -i "$input" -ss 00:11:30 -t 00:02:03 $codec_novideo part2_audio.avi

    # end 32:03
    ffmpeg -i "$input" -ss 00:20:09 -t 00:11:54 $codec part3.avi

    # end 34:20
    ffmpeg -i "$input" -ss 00:32:03 -t 00:02:17 $codec_novideo part4_audio.avi

    # end 40:46
    ffmpeg -i "$input" -ss 00:34:20 -t 00:06:26 $codec part5.avi

    # end 49:32
    ffmpeg -i "$input" -ss 00:41:55 -t 00:07:37 $codec_novideo part6_audio.avi

static_slides () {
    # to replace part2 video
    rm -f part2_video.avi
    ffmpeg -loop_input -i /tmp/network_failure.png -t 00:02:03 \
        -vf pad='1024:768' -r 8 $codec_noaudio part2_video.avi

    # to replace part4 video
    rm -f part4_video.avi
    ffmpeg -loop_input -i /tmp/slide6.png -t 00:02:17 \
        -vf pad='1024:768:iw/2' -r 8 $codec_noaudio part4_video.avi

    # to replace part6 video
    rm -f part6_video.avi
    ffmpeg -loop_input -i /tmp/slide1.png -t 00:07:37 \
        -vf pad='1024:768:iw/2' -r 8 $codec_noaudio part6_video.avi

combine () {
    # combine audio and video
    rm -f part2.avi
    ffmpeg -i part2_audio.avi -i part2_video.avi $codec part2.avi
    rm -f part4.avi
    ffmpeg -i part4_audio.avi -i part4_video.avi $codec part4.avi
    rm -f part6.avi
    ffmpeg -i part6_audio.avi -i part6_video.avi $codec part6.avi

assemble () {
    rm -f "$output"
    # Concatenate parts into final video.  Note no transcoding here.
    mencoder part{1,2,3,4,5,6}.avi -ovc copy -oac copy -o "$output"


The final video isn’t a fully open format, in that it uses patented (in the US) H.264 and MP3. However it is fully playable with free software, particularly outside the US. The other advantage of using libx264 is it resulted in the smallest file size of all the codecs I tried.


1 Comment

Filed under Uncategorized

One response to “libguestfs webinar video — final cut

  1. Byron

    Just as I finished watching the original! 🙂 Nice command line fu though. 🙂

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.