Wednesday, January 12, 2022

How to create a video DVD in Linux from a HD video source

 These days, we are likely to record our videos in some high-definition format. Sometimes, however, it may still be convenient to provide the final cut of a movie on a DVD disk. This guide describes how to use your Linux PC to create a DVD disk from any source material.

The procedure consists of four simple steps:

  1. Rendering the source video to a lossless format
  2. Converting the result to a DVD compliant format (.vob)
  3. Authoring the DVD
  4. Burning the DVD
Step 1 is done in your favorite movie editor, steps 2 and 3 on the command line, and step 4 in a simple GUI. The goal here is to produce a simple DVD with a single video clip and without start menu, but with chapters.

1. Rendering the source video

Whatever video editor you are using, when you finished editing your video, you will probably render it to .mp4 or some other format. In principle, you could use this output file for the following procedure. However, to get the best DVD quality, it is helpful to render to a lossless format.
I am creating and editing my videos in Kdenlive and save the (intermediate) result with the lossless codec HUFFYUF.


Please note, that these files will be huge. A 2-hour video in 720p at 24fps took 120 GB. But this is only a temporary file - after step 2, you can immediately delete it. The file that I created this way is named "myvideo.mkv".

2. Converting the result to a DVD compliant format (.vob)

In this step we convert the video to a DVD compliant format (mpeg2 with special settings). Make sure that ffmpeg is installed on your system (check with: "which ffmpeg"). 
Open a text/terminal window, go into the folder that contains your intermediate file (in my case: "myvideo.mkv") and run ffmpeg like this:

ffmpeg -i myvideo.mkv -target ntsc-dvd -maxrate 8000000 -b:v 4100000 output.vob

This will produce the file "output.vob" which is needed for the next step. The above command produces a DVD in NTSC format. If you need PAL format, just replace "ntsc-dvd" with "pal-dvd". 

A DVD can hold video files of up to approx. 4 GB. The size of the output file is adjusted with the value after "-b:v". Smaller values produce smaller files. It should be adjusted to achieve the largest possible file size, while not exceeding 4.4 GB. The value of 4100000 worked well for me and produced a 3.9 GB vob file for my 2-hour video. 

3. Authoring the DVD

In this step, the final DVD files will be produced and stored in the folder "mydvd". It requires to install "dvdauthor". If you don't need chapters on your DVD, just run
  
dvdauthor -o mydvd/ -t output.vob

where "output.vob" is the result from step 2.).
It is also possible to create chapters (usually a good idea!) with the "-c" option. The "-c" option is followed by a comma (,) separated list of chapter markers, where each has the form [[h:]mm:]ss. The seconds have to be specified, while the minutes and hours are optional.
Here is an example if you want chapters at 35 seconds, 5:03 minutes, 21:45 minutes, and at 1 hour 3 minutes and 15 seconds

dvdauthor -o mydvd/ -t -c 00,35,05:03,21:45,1:03:15 output.vob

Then the video format needs to be stored in a shell variable (replace "NTSC" with "PAL" if required).

export VIDEO_FORMAT=NTSC

And the following finalizes the DVD file structure.

dvdauthor -o mydvd/ -T

The folder "mydvd" contains now all files needed for the DVD.

4. Burning the DVD

In this last step, the DVD is burnt, using the GUI k3b. After starting "k3b", you select on the bottom "more actions..."


... and in the pull-down menu a "New Video DVD project".


On the new screen, click on the "VIDEO_TS" folder...


... and paste all files from the folder "mydvd/VIDEO_TS" into the right area.


Finally, press "Burn". And a little later you will have your DVD.