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.
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.
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):
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
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):