March 25, 2008

End-to-end video podcast production with Kino and FFmpeg

Author: Chad Files

Producing a video podcast entirely on Linux is not only possible but fairly easy to do. This article outlines the steps you can take to make a video podcast entirely on Linux, as I do.

Creating a podcast takes three steps:

  1. Filming -- Here you just need you, an idea, and a camera.
  2. Editing and production -- Production is the longest part of the process; it involves taking all of the raw footage and making it look good for viewers. You can use Kino to capture and edit the source video, then use FFmpeg to render the final video.
  3. Publishing -- To create a proper podcast you have to have an RSS feed complete with enclosure tags; fortunately, there are several open source tools that can do this for you.

The creative part in step 1 is up to you; we'll focus on editing, production, and publishing here.

Capturing video

130163-1-thumb.png

The first step to editing the video is to get it off of your camcorder. This process depends on the make and model of your camcorder. All of my equipment uses MiniDV to store media and FireWire (IEEE-1394) as a delivery medium. Most consumer camcorders made in the last decade support FireWire capture.

By default most Linux distributions do not allow users to access FireWire devices. It is possible to add the permissions that allow normal users to access FireWire devices; however, it is much easier to just launch Kino as the root user to do the video capture.

Once you've launched Kino, click the Capture tab in the right-hand menu to enter capture mode. Provide a file name and click the capture button. If all goes well, Kino should start capturing video from your camcorder; if you have trouble, check out the Kino Capturing DV video tutorial created by Dan Dennedy, Kino's lead developer.

After the capture completes, it is a good idea to exit Kino and restart it as a normal user. Before relaunching Kino, change the permissions of all of the files and directories it created during the capture process to those of a normal user account.

Basic editing

There are hundreds of things you can do when editing video, but there are a few tasks that are almost always necessary.

  1. Cutting and trimming -- This is the process of taking out unneeded or unwanted footage. To trim in Kino, first select a block of video from the Storyboard, then click the Trim tab in the tools menu to enter trim mode. Move the start and end points to the desired locations and click the Apply button.

    To cut a segment out of the storyboard, you have to be in Edit or Trim mode. Select the desired clip and click the Cut icon (scissors) in the toolbar, or use the keyboard combination of Ctrl-X, or click Edit -> Cut from the main menu.

    If you need to trim or cut out multiple portions of a single video segment, you have to divide the segment first by placing the playback arrow, in the Scrub bar, at the desired location and clicking the split icon in the toolbar.

  2. Rearranging -- Oftentimes footage is shot out of order and needs to be moved around during production. To move a clip, click on it in the Storyboard and drag it to its new location.
  3. Transitions -- Transitions are among the simplest effects to add, yet they give the final video a polished look. The most common transition is a dissolve, which takes frames from the end of one segment and blends them with the beginning of the next.

    Kino has to be in FX mode to add effects to a video. Select the segment where the dissolve needs begin. Check the box next to Limit to in the Overwrite tab; make sure Closing is selected from the menu next to the checkbox. These settings tell Kino to automatically split the segment and only apply the effect to the end, not the entire segment. By default Kino will set the time to the last second of the segment; for most applications this will work fine. Make sure No Change is selected in the Audio Filter tab and Cross Fade is selected in the Audio Transition tab; doing this will blend the audio from the two segments. In the Video Filter tab ensure that No Change is selected, so you do not inadvertently add a rouge effect. Finally, in the Video Transition tab select Dissolve. At this point you can preview the transition by clicking the Play button in the Transport Control bar. Clicking the Render button next to the Scrub bar will render the effect and add it to the Storyboard.

    There are several transition effects in Kino, and they all have customization settings. Play with them and see what works best for your video. If you do not like the results, you can undo them and start over.

Kino also offers some advanced editing tools.

Adding info bars

Info bars are the little graphics that appear on the bottom of the screen to provide more information in the form of text. The first step to adding an info bar is to select where in the video to add it. If you want to add an info bar in the middle of a segment, it is easer to split the segment twice: once where it starts and again where it ends. When the segments are ready, get into FX mode and select the segment that needs the info bar. Make sure the Audio Filter, Audio Transition, and Video Transition tabs have No Change selected; then go to the Video Filter tab.

Generally info bars have some sort of background to make the text stand out. The easiest way to add a background is to do it when you add the text. Another way is to superimpose an image onto the video then add the text -- a two-step process. Superimposing allows you to use a graphic such as a logo or a background that has a gradient.

Before superimposing an image you have to make it. You can use Inkscape, the GIMP, or any other tool to do this. It is best to use the dimensions of the final video when creating the image.

Once you have your image, go to the FX tab in Kino and select Superimpose from the Video Filter tab. Use the Browse button next to the Image field to find your image. Preview the changes by pressing the Play button. If you want to change the position or add an animation effect, make the appropriate changes to the settings on the Video Filter tab. Repeat the preview process until you like the result, then render. If you added animation, make sure to remember the settings; you will likely want to use the same effect with the text.

To add text to the segment, start by selecting Titler on the Video Filter tab. This tab allows you to change the font, position the text, add a background, animate the text, and of course type the text to be displayed. If you superimposed the background image, use the positioning tools to make sure the text lines up correctly. If you did not use a background image you can use the Pad settings to add a background. This tab also gives you a real-time preview of the changes in the preview window as you type.

Dubbing audio

Adding narration is a two-step process. First you have to record the audio, then you have to overlay the sound on the video. Audacity is arguably the best open source tool for doing voice recording. Open Audacity and record what you want to say, then export the audio. In the past I have had difficulty using WAV files in Kino, so I typically export audio in high quality Ogg.

To add audio in Kino you have to be in FX mode. Once there, select the segment that needs narration; make sure the Audio Transition, Video Filter, and Video Transition tabs are set to No Change. Set the Audio Filter tab to Dub and fill in the Audio File box. Again, Kino allows you to preview the changes by pressing the Play button. You can also mix the narration with the existing audio in the video by selecting Mix instead of Dub.

Adding credits

Credits are one of the easier effects to add. In FX Mode, click the Create tab and change the Frames setting to an appropriate length; 25 frames is about 1 second. Then select Titler from the Video Filter tab, and make sure the rest of the tabs are set to No Change. Type or paste all of your credits into the text box on the Video Filter tab. For a simple scrolling effect, change the Initial Position setting to Center/Bottom Off and the Final Position setting to Center/Top Off; this will make the text scroll from the bottom of the screen to the top of the screen. Of course you can adjust these settings to your liking and even add audio if you want.

Rendering the final video

Once you have everything to your liking, it's time to encode the video using Export mode. There are several tabs in this mode; for podcasting, DV File, and Other are the important ones. On the Other tab there are several ready-made export scripts that work well in most cases. If your source video is in widescreen (16:9 aspect ratio), as mine is, these may not work with some video hosting sites, because Kino exports everything in NTSC or PAL dimensions. In most cases, when a video site converts the video for display on the Web, it uses the physical dimensions, not the actual dimensions, so the final video looks stretched.

To combat this issue I suggest creating a custom script for encoding your final video. Before doing that it is best to export the edited video into new raw DV files. To do this, select the DV File tab, select a file name, select Raw DV from the File Type options, and click the Export button. The export will take a few minutes to several hours, depending on the length of your video.

Before rendering the final video you have to make a decision about what audio and video codecs to use. What you choose depends on your target audience. In my experience the most universally accepted combination is H.264 video and AAC audio. These codecs play well on all the major operating systems and have fairly good compression.

FFmpeg does a good job of producing quality video in several formats. It also accepts DV file information as a stream, which makes it ideal for accepting raw video exported from Kino. Use a command like the following to generate the video in a MP4 container.

cat dv-file.dv | ffmpeg -f dv -i pipe: -acodec aac -vcodec h264 -s 640x360 -aspect 16:9 video.mp4

This command echoes the DV files and pipes the content to FFmpeg. If Kino split your export into multiple files, be sure to use wildcards to get all of the files. The FFmpeg settings are as follows:

  • -f dv tells FFmpeg that the input format is raw DV.
  • -i pipe: lets FFmpeg know the input is coming from a pipe. You can change this to any file that FFmpeg can decode.
  • -acodec is the audio codec -- AAC in this case.
  • -vcode is the video code -- H.264 in this case.
  • -s specifies the target size. Giving FFmpeg a size lets you specify the exact size of the output. In this case it shrinks the video to 640 pixels wide and 360 tall, preserving an aspect ration of 16:9.
  • -aspect tells FFmpeg the aspect ratio to use when encoding. This is 16:9 for widescreen and 4:3 for full screen.
  • The last parameter is the name of the output file. The extension is important because it specifies what container to use. For more information about video containers take a look at the Container Format article on Wikipedia.

Running this command will encode your video and get it ready to hit the Internet. Most of the video hosting sites out there will create a Flash version of the video for you if you choose to use one. However, if you wish to do it yourself, FFmpeg will take care of it nicely:

ffmpeg -i video.mp4 -acodec mp3 -ab 64k -ar 44100 -f flv -b 650k video.flv

This command is similar to the one above. The only exceptions deal with the quality by changing the default bit rates. For more information about all of the FFmpeg options refer to the FFmpeg documentation.

If you want to host your own Flash videos, there are several open source Flash video players available, including FlowPlayer, FLV Player, and OS FLV.

Making the podcast RSS feed

The final step to making a podcast is creating an RSS podcast feed. The only difference between a normal RSS feed and a podcast RSS feed is enclosure tags, which tell podcatchers to download the files listed in the feed.

There are several ways to create these RSS feeds. Many of the free video hosting sites will do it for you. If you want more control, consider using one of the following tools.

  • WordPress -- The popular blogging software will automatically add enclosure tags to any media file that is linked to in a post. This automatic feature turns any WordPress RSS feed into a podcast feed.
  • Drupal -- The Drupal framework has several modules that allow you to create podcast RSS feeds. The Video module works well for video podcast applications; however, it can be a bit difficult to wrangle at first.
  • Movable Type -- The newly re-open-sourced Movable Type allows you to publish media in a RSS feed, after you do a little work. There is a good article about how to add enclosures to Movable Type RSS feeds if you want to go that route.

Today iTunes is the most used podcatcher, and iTunes likes feeds to have special metadata to help it display content. There are several ways to add it with the tools mentioned above, but there is no silver bullet. In my opinion, the easiest way to do it is to just use Feedburner to inject all the information that iTunes wants directly into your feed.

Resources

You can find several free resources for podcasters on the Internet. For instance:

  • Blip.tv will host all of your content for free with very few restrictions. It even creates Flash versions of the source video automatically.
  • OurMedia is a place where content producers can upload their files for free. The site also has a community of artists that are willing to share their content for use in podcasts.
  • Magnatune offers podcast-friendly music.

The bottom line is that you don't need big budget software and equipment to create a video podcast; Linux will more than get the job done.

Categories:

  • Internet & WWW
  • Graphics & Multimedia
Click Here!