Capturing Video (How I Did It)
One of the common questions we get here at linuxjournal.com is how we produce our videos. Shawn produced a howto video on some ways of doing it. The following describes how I capture my videos and also the script that I use to add the Linux Journal logo watermark to it.
The video capture howto part of the article is fairly simple: I use xvidcap:
$ xvidcap --cap_geometry 640x480
The --cap_geometry argument sets the initial size of the capture area so that I always get the same size video. This is also a requirement for my watermark adding script.
I keep my videos short and just recapture them if I make a mistake during the capture process. If you need to capture long videos, redoing the entire thing each time you make a mistake is probably not feasible so you'll need to use some kind of video editing tool for the final editing. Numerous video editing tools exist, check out our recent articles on LiVES: LiVES1, LiVES2, and LiVES3.
A couple of notes about xvidcap: it, at least the version that I'm using, tends to crash quite often. Don't attempt to capture and review the captured video more than a couple times without restarting xvidcap. If you have a recalcitrant audio setup, as I seem to, run a quick "test test test" capture before you dive in to make sure everything is working correctly and your sound level is set correctly. By default xvidcap saves captured videos to the file test-0000.mpeg, make sure to rename the file if you want to save it before capturing a new video.
Once I've got a video captured I add the Linux Journal logo watermark to the video by running my add-logo.sh script:
$ sh add-logo.sh --left video.mpeg
The script accepts either --left or --right and uses that to determine which image file to use (I have 2 files, one with the logo on the left and the other on the right). If --left is specified it looks for the file logo-left-640x480.jpg, if --right, then logo-right-640x480.jpg. The geometry portion of the overlay file name (eg 640x480) is based on the size of the captured video, so if you were to capture at 1024x768 you'd need a file named logo-left-1024x768.jpg. To create an overlay image you merely need an image or the right size with a gray background, specifically the color #808080.
When the script runs it adds the overlay to the input video and creates two output videos of the same base name, one with a .mp4 extension and one with a .ogv extension. The script also accepts the option --remove-audio, which removes the audio track from the output videos.
One of the things in the script that you will probably need to change is the ffmpeg command that does the overlay:
ffmpeg -sameq $opts -i $mpeg -vhook "/usr/lib64/vhook/watermark.so -f $logo" $mp4
The location of the watermark library will most likely be different on your system (I use openSUSE). If you have a very recent version of ffmpeg you may even need to change how this is done as the -vhook capability may have been removed as it's been deprecated and replaced by a different mechanism.
The full source code for the add-logo.sh script appears below:
#!/bin/bash
function usage()
{
if [[ "$*" ]]; then
echo "$*" >&2
fi
cat >&2 <<EOF
Usage: $(basename $0) OPTIONS FILE.mpeg
--left Add logo on left side
--right Add logo on right side
--remove-audio Remove audio stream from converted videos
EOF
exit 1
}
function error()
{
echo "$*" >&2
exit 1
}
#######################################################################
left=0
right=0
remove_audio=0
mpeg=
while [[ "$1" ]]
do
case "$1" in
--left)
left=1
right=0
shift
;;
--right)
left=0
right=1
shift
;;
--remove-audio)
remove_audio=1
shift
;;
-*)
usage "Unrecognized option $1"
;;
*)
if [[ "$mpeg" ]]; then usage "Unexpected argument: $1"; fi
mpeg=$1
shift
mext="${mpeg#*.}"
if [[ "$mext" != 'mpeg' ]]; then error "Invalid mpeg file: $mpeg"; fi
;;
esac
done
if [[ ! "$mpeg" ]]; then usage; fi
geometry=$(file $mpeg | grep -P -o '\d+ x \d+' | tr -d ' ')
if [[ $left -eq 1 ]]; then
logo=logo-left-$geometry.jpg
elif [[ $right -eq 1 ]]; then
logo=logo-right-$geometry.jpg
else
error "Specify one of --left or --right"
fi
if [[ ! -f $logo ]]; then error "Logo file not found: $logo"; fi
if [[ $remove_audio -ne 0 ]]; then opts='-an'; fi
mp4=$(basename $mpeg .mpeg).mp4
ogv=$(basename $mpeg .mpeg).ogv
rm -f $mp4 $ogv
ffmpeg -sameq $opts -i $mpeg -vhook "/usr/lib64/vhook/watermark.so -f $logo" $mp4
ffmpeg -sameq $opts -i $mp4 $ogv
# vim: tabstop=4: shiftwidth=4: noexpandtab:
# kate: tab-width 4; indent-width 4; replace-tabs false;
| Attachment | Size |
|---|---|
| xvidcap.jpg | 33.62 KB |
| add-logo.sh_.txt | 1.49 KB |
Mitch Frazier is an Associate Editor for Linux Journal.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- RSS Feeds
- New Products
- Using Salt Stack and Vagrant for Drupal Development
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- Validate an E-Mail Address with PHP, the Right Way
- Readers' Choice Awards
- New Products
- This is the easiest tutorial
5 min 33 sec ago - Ahh, the Koolaid.
5 hours 44 min ago - git-annex assistant
11 hours 43 min ago - direct cable connection
12 hours 6 min ago - Agreed on AirDroid. With my
12 hours 16 min ago - I just learned this
12 hours 20 min ago - enterprise
12 hours 50 min ago - not living upto the mobile revolution
15 hours 42 min ago - Deceptive Advertising and
16 hours 17 min ago - Let\'s declare that you have
16 hours 18 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.



Comments
How to increase/slow a scene
Hi,
I noticed that some videos made by Shawn Powers have some scenes where the playback is increased.
Do you know how this is made? What is the tool used? Kino, avidemux, other?
Thanks for you feedback.
Sam
I found the answer using
I found the answer using ffmpeg:
------------------------------------------------
#!/bin/bash
# Description: make time lapse video
# Usage: time-lapse.sh
# Source Video: the video that you are wanting to speed up
# Destination File: the file where the video will be saved
# Frames: the number of frames to pull per second (1 will speed it up the most, 10 will be slower)
mkdir ffmpeg_temp
ffmpeg -i $1 -r $3 -f image2 ffmpeg_temp/%05d.png
ffmpeg -i ffmpeg_temp/%05d.png -b 512 $2
rm -rf ./ffmpeg_temp
------------------------------------------------
source: http://wp.pr0gr4mm3r.com/linux/how-to-create-a-time-lapse-video-using-ff...
Sam
Tech tips
Heh, maybe you should talk to Shawn about verifying the sound level before recording. The intro/outtro on his tech tips are so quiet I can barely hear them, even with my volume turned all the way up (I have to turn up the volume for the main part of the tech tip, too).
great tool
This will be a great tool for creating how-to videos for end users and new help desk employees at my job. Thanks for the tips. Can run windows virtual machine and capture for windows how-tos
Adding Audio?
Do you add your audio after the fact or do you record the audio with xvidcap? If you add the audio after, what do you use?
With xvidcap
I record the audio at the same time as the video (with xvidcap).
Mitch Frazier is an Associate Editor for Linux Journal.
To audio. Use
To audio.
Use recordmydesktop instead
Crashed For Me
As I mentioned above xvidcap crashes once in a while, on the other hand recordmydesktop crashed all the time.
Mitch Frazier is an Associate Editor for Linux Journal.
audio
Is there a method to capture system/application sounds along with the video being captured?
Yes
Said capability does exist, unfortunately I don't know how to do it, fortunately though our in-house expert, Dave Phillips, is helping me figure out how to make it work. I will post more when I have it working.
Mitch Frazier is an Associate Editor for Linux Journal.