How to Download and Burn YouTube Videos on a DVD in Linux

This is a short tutorial on how to burn YouTube videos on a DVD. It might come in handy if you want to watch them on a big TV, or if you want to send them to friends. Or maybe you published them on YouTube for your small business, and you need to send a copy to a client. There are basically three steps: downloading, converting the video to MPEG format, and building the DVD image. All these steps can be accomplished in Linux with free open-source programs.

Downloading

An easy way to download is to use Video DownloadHelper Firefox extension. It is just a matter of starting the video in YouTube and saving it – always choose the highest quality version available when saving.

Video DownloadHelper Mozilla Extension

Video DownloadHelper Mozilla Extension

Converting videos to MPEG format

The main open-source programs for processing videos are FFmpeg and MEncoder. Both of them support a wide range of video formats. My preferred solution is FFmpeg, installed as sudo apt-get install ffmpeg on Ubuntu/Debian systems. I run it as follows:

$ ffmpeg -i input-video.flv -target ntsc-dvd -aspect 16:9 \
-vf "hqdn3d" output-video.mpeg

North American users would use ntsc-dvd, while in some other places pal-dvd would be more appropriate. hqdn3d is a high quality 3D denoiser, applied to the input video using -vf option. Another common situation is when you have an input file in 2.35:1 format and you need to convert it in 16:9 DVD format. This involves scaling and padding:

$ ffmpeg -i input-video.flv -target ntsc-dvd -aspect 16:9 \
-vf "scale=720:360,pad=720:480:0:60,hqdn3d" output-video.mpeg

If the video has a logo, you can get rid of it using delogo filter:

$ ffmpeg -i input-video.flv -target ntsc-dvd -aspect 16:9 \
-vf "delogo=20:25:100:38:4, hqdn3d" output-video.mpeg

delogo filter takes a rectangular region in its parameters (x:y:width:height) and fills it up based on its surroundings. You can find a full list of filters available for FFmpeg here.

Sometimes you might want to process only a portion of the input video. You can extract it using -ss to specify the start time in seconds, and -t to specify the duration in seconds. For example to extract a video of 300 seconds in length starting from second 60, the command looks like this:

$ ffmpeg -sameq -ss 60 -t 300 -i input-video.flv output-video.mpeg

I also use FFmpeg for mp3 conversion:

$ ffmpeg -i input-video.flv -f mp3 -ab 192000 audiofile.mp3 

Building the DVD image

With all the videos converted to MPEG format, it is time to build a DVD filesystem structure and to create the ISO file. My preferred program in this case is DVDAuthor (sudo apt-get install dvdauthor). The program generates the file and directory structure of the DVD video disc. It is a professional-grade DVD authoring solution for Linux and it is driven by XML configuration.

Start by moving all the .mpeg files in a new directory and edit a text file dvd.xml:

<dvdauthor dest="DVD">
   <vmgm />
   <titleset>
     <titles>
       <video widescreen="nopanscan" />
       <pgc>
         <vob file="video1.mpeg" chapters="0,10:00,20:00,30:00"/>
	 <post>jump title 2 chapter 1;</post>
       </pgc>
       <pgc>
         <vob file="video2.mpeg" />
         <vob file="video3.mpeg" />
       </pgc>
     </titles>
   </titleset>
</dvdauthor>

Add all the .mpeg files using <vob /> tag, you can also specify chapters for each one of them. The next step is to run DVDAutor tool on dvd.xml file and to generate the ISO file:

$ export VIDEO_FORMAT=NTSC
$ dvdauthor -x dvd.xml
$ mkisofs -V MYDVD -o mydvd.iso -dvd-video DVD

Set VIDEO_FORMAT to PAL if you need to.

There are a number of GUI front-ends for DVDAuthor. I use them sometimes to create DVD menus. I particularly like DVDStyler (sudo apt-get install dvdstyler):

DVDStyler

DVDStyler

Testing and burning the ISO image

To verify the DVD image before burning it, I usually play it in VLC media player (sudo apt-get install vlc).

$ vlc mydvd.iso
VLC media player

VLC media player

There are lots of programs available to burn the image on DVD media. Probably one is already installed on your computer. If not, you can try Brasero (sudo apt-get install brasero):

Brasero

Brasero

About these ads

6 thoughts on “How to Download and Burn YouTube Videos on a DVD in Linux

  1. matanya

    I’d prefer using youtube-dl and cdrkit to script this. youtube-dl also has post-download options, so you can convert on-the-fly and ignore more ffmepg commands.

    using cdrkit would allow you to pipe the output from youtube-dl and write the file even while downloading (though this wouldn’t be recommended)

    Reply
  2. Pingback: How to Download and Burn YouTube Videos on a DVD in Linux | Hallow Demon

  3. Bob Robertson

    I second youtube-dl, it seems to automatically choose the higher resolution videos as well. Very handy.

    Reply
  4. Pingback: Links 23/5/2013: Threat to Civil Rights in UK, KDE 4.11 LTS | Techrights

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