LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices


By Mountain Man at 2009-02-01 17:34
Creating movie and slideshow (pictures with music) DVDs is extremely easy with Linux using applications which are commonly available either in standard repositories or separately in rpm or deb format. When you are done reading this tutorial you should be able to create your own DVDs which can be played on any standard DVD player. This can really come in handy when you want to share pictures and movies of your kids, your last vacation, etc with friends and family (even those without a computer). If you have at least basic linux skills (can open a console window to paste command line statements, and can use your distribution's package management functionality to install applications) you can make your own slideshow and home movie DVDs on linux using this tutorial.

A note on PAL and NTSC DVD standards: There are two basic standards for DVDs worldwide, PAL and NTSC. NTSC is the standard I have personally worked with, so the tutorial generally focuses on the NTSC standard. Where possible, I will also include notes on how to create content using the PAL standard. In cases where this information isn't included, see the specific application documentation for details. Also, I have read (but can not confirm) that most modern DVD players can handle NTSC DVDs, even in regions where PAL is the standard. A good source for practical information regarding NTSC vs PAL relating to DVD creation (resolutions allowed and audio codecs supported) is the movie-to-dvd man page (part of the videotrans application).

Sections

1. Instant gratification: Turning an existing video file into a playable DVD.
2. Creating a basic DVD slideshow from pictures and music.
3. Creating a DVD from both slideshow files and video files.
4. Working with audio.
5. Preparing photos for a slideshow.
6. More advanced video editing techniques.
7. More advanced slideshow techniques.
8. Creating transitions and opening and closing credits.
9. DVD Navigation & Menus.


Section 1: Instant gratification; turning an existing video file into a playable DVD.

First, install avidemux and dvdauthor if they are not already present on your system.

Lets start with something very basic, like an mpeg or avi home movie file you have downloaded from your digital camera or camcorder, or a flash (.flv) file you have downloaded from the internet. If your movie is in DV or MiniDV format, you probably want to use Kino for editing and conversion instead of the movie editing/conversion software discussed in this tutorial.

1. Start avidemux, and click on the “open” icon in the upper left of the screen.
2. Browse to the avi, mpg, or flv file you want to turn into a DVD and then click on “open” in the dialog box.
3. If prompted to index the file, select yes.
4. Click on the “Auto” menu item at the top of the screen, and select “DVD”. Accept the preset values in the “Auto Wizard” dialog box which comes up. This auto feature will set the video, audio, and format settings to format the video for a DVD. You may want to look at the values it placed in each of these fields on the left side of the screen to see the changes it made. If you know what you are doing, you can make further adjustments to these fields before saving the video so long as you stay within the DVD standard. However, at this point we are going to leave these at the preset values. Later in the tutorial we will explore making some additional changes to these settings.
5. Click on File/Save/Save Video and tell avidemux where you want to save the converted file and what you want to name it. Create a folder for this tutorial named “dvdtutorial” and name the new movie file “dvdmovie1.vob”. Once you click “save”, the application will convert the movie you opened in step 2 to DVD ready format. Depending on the size of the video file and the speed of your system, this could take some time to process.

Now we will create the DVD file structure including the converted movie file, and create a DVD iso image ready for burning to DVD media.

1. Using a text editor, save the text in the code box below with the file name “dvdauthor.xml” in the folder named “dvdtutorial” that you created in step 5 above. Note the single line between the <pgc> and </pgc> tags. This references the dvd ready movie file you created in step 5 above. If you had additional movie files you wanted to include you could create similar lines for them as well. The order of the lines in the file determines the order movies will be played on the DVD. The chapter marker is optional, and more than one chapter can be indicated for each line. Also note the format="ntsc" entry. If you want to create a pal DVD you will want to change “ntsc” to “pal” before saving the file*.
Code:
<dvdauthor dest="DVD">
  <vmgm />
   <titleset>
     <titles>
	     <video format="ntsc"/> 
       <pgc>
	       <vob file="dvdmovie1.vob" chapters="0"/>

       </pgc>
      </titles>
   </titleset>
 </dvdauthor>
2. Create a new folder named “DVD” in the “dvdtutorial” folder.
3. Open the command line console and change to the “dvdtutorial” folder.
4. Run the command
Code:
dvdauthor -x dvdauthor.xml
5. This will create the DVD file structure. Once this is completed you will see two new sub folders in the “DVD” folder, named AUDIO_TS & VIDEO_TS . AUDIO_TS will be empty, but the VIDEO_TS folder will contain a file named “VTS_01_1.VOB” which is the video file which will be played by your DVD player. Many linux video players can play this file in it's current format as well. In addition, there are other files in the VIDEO_TS folder needed for the DVD file structure.
6. Next, run the command
Code:
mkisofs -dvd-video -udf -o dvd.iso DVD
(again from the “dvdtutorial” folder).
7. This will create a dvd iso image named “dvd.iso” which can be burned by your favorite DVD burning application.

From here, if you want to test the process, you can open your favorite DVD burning app, (like K3b) and burn the dvd iso image to DVD. You can take the DVD you burn and try it in your home DVD player!


*A note on ntsc vs pal in avidemux: I don't have any pal formatted source movies (my camera has a pal option but creates ntsc no matter what choice I make...) so I can't personally confirm this. However, according to the poster on this forum thread, avidemux detects if a source video file is pal and the DVD auto set choices are set accordingly. If not, you could try manually adjusting the auto settings to achieve a pal compliant video. I would query the topic on the avidemux forums first to gain more information on what might need to be done here. Also, in researching this I found many notes from those in pal countries stating that it was best to keep ntsc format movies in ntsc, as they found that even budget DVD players handled ntsc discs just fine. I'll leave this choice up to the reader. Lastly, a very simple way to ensure pal formatting would be to use the videotrans application from the command line (featured below) to convert the file to pal.

Optional / Alternate method of converting a movie file to a .vob:
Videotrans is a very powerful application which works from the command line. Instead of using avidemux as we did above, we could have installed videotrans and used one of the following commands to convert the movie file (substitute the name of your movie file for “movietoconvert.mpg”). Per the man page, “This program takes one or more movie files in any format that mplayer understands and converts them into a DVD compatible format ”. I've found it works with any mpg, avi, and flv file I have thrown at it. The resulting .vob file would then be referenced in the dvdauthor.xml file we created above and the remaining steps followed to create a DVD.

For ntsc:
Code:
movie-to-dvd -m ntsc -M -r 720x480 movietoconvert.mpg
For pal:
Code:
movie-to-dvd -m pal -M -r 720x576 movietoconvert.mpg
I really like videotrans, but it does have some downsides:
1. Where avidemux inserts black borders to achieve the final dvd compliant aspect ratio, videotrans will stretch the picture instead. This isn't always noticeable (it depends on how much stretching was needed), but in my opinion the black borders are preferable.
2. The program can only perform the conversion to dvd format; it doesn't allow the more advanced editing functions avidemux can perform. However, if need be you could first make edits in avidemux (leaving audio & video settings on “copy”), and then process the file in videotrans.


Section 2: Creating a basic DVD slideshow from pictures and music.

First, install dvd-slideshow if not already present on your system. There are known issues with dvd-slideshow and the version of ffmpeg on recent versions of Ubuntu. If you experience this problem it can be fixed quickly and easily with a search of the forums.

1. Create a new folder in the “dvdtutorial” folder you created earlier, and name it “pictures”. Copy 4 or 5 png or jpg images into the pictures folder.
2. Find an audio file you want to use for this example. It can be in ogg, wav, or mp3 format. Copy this file to the “dvdtutorial” folder. This file will be referred to as “myaudio.mp3” in future steps.
3. Open the console and switch to the “dvdtutorial” folder.
4. Run the command:
Code:
dir2slideshow -t 3 -c 1 -n 'firstslideshow' pictures
5. This will create a text file named “firstslideshow.txt”, which defines how the slideshow will be created. You can open this file in a text editor to see what was created. We will be editing this file for custom effects in section 7 of the tutorial. For now, the only change you may want to make is to put in a better title for the slideshow on the line “title:3:firstslideshow”. Spaces and periods are fine, but avoid any special characters like a colon, etc. An acceptable replacement line would be “title:3:First Slide Show”. You can also leave the file unchanged and proceed to step 6.
6. Now run the command
Code:
dvd-slideshow -n 'My First Slideshow' -f 'firstslideshow.txt' -a myaudio.mp3
7. Don't forget to substitute the name of the audio file you copied over in step 2 above for “myaudio.mp3”. If you have a multiple core processor and want to speed up processing, you can add -smp at the end of the line. For pal, add -p to the end of the line.
8. When it is done processing, you will now have a file named “My_First_Slideshow.vob”. You can play this file with most linux movie players.
9. To burn this to DVD, follow the steps to create a DVD in section 1 above, but substitute “My_First_Slideshow.vob” for the “dvdmovie1.vob” entry in the dvdauthor.xml file.


Section 3: Creating a DVD from both slideshow files and video files.

This next step sounds easy, right? Just edit the dvdauthor.xml file as follows:
Code:
<dvdauthor dest="DVD"> 
  <vmgm /> 
   <titleset> 
     <titles> 
	     <video format="ntsc"/> 
       <pgc> 

	       <vob file="dvdmovie1.vob" chapters="0"/> 
	       <vob file="My_First_Slideshow.vob" chapters="0"/> 	    

       </pgc> 
      </titles> 
   </titleset> 
 </dvdauthor>
This is true if you used one of the videotrans commands listed at the end of section 1 to convert the home movie (assuming you aren't mixing and matching pal with ntsc). However, in my experience two problems come up when I run dvdauthor combining the home movies created with the avidemux auto DVD settings and dvd-shlideshow videos:

1. Audio will be included for whichever file is first, but not the second one. This appears to be due to the different audio codecs. The default audio codec for dvd-slideshow is AC3, with a bitrate of 192 kbps. The default audio codec for DVDs using avidemux is mp2, with a bitrate of 160 kbps.
2. Dvdauthor generates a warning “WARN: not a valid DVD frame rate: 30.0” if you process files created with avidemux default auto DVD settings by themselves, but this warning doesn't seem to cause any real problems. However, when this kind of file is combined with a slideshow vob it does create problems with creating the DVD, and the following two warning lines are included in the output:
Code:
WARN: attempt to update frame rate from 30.0 to 30000.0/1001.0 (NTSC VIDEO); skipping 
WARN: Video PTS does not line up on a multiple of a field.
So how do you fix this? I've tinkered around with the settings in avidemux and posted the question on the avidemux forum and found the solutions to both problems. When setting up avidemux, after choosing the automatic presets for creating a DVD file as we did above, add the following steps:

To fix the audio issue:
1. Change the audio codec on the left from “MP2” (TwoLAME) to “AC3 (lavc)”
2. Click on “Configure” just below the audio codec, and change the bitrate to 192. Now the audio track for the home movies will have the same settings as the slideshow files.

To fix the video issue:
According to a helpful moderator at the avidemux forum, the problem is that the standard for NTSC DVD files is actually 29.97 fps, not 30 fps. Both slideshow and default avidemux DVD files show 30 fps in properties from nautilus, but this is due to rounding. There are two ways to fix this issue before encoding DVD video files in avidemux:
You can either change the video codec from DVD (lavc) to DVD (mpeg2enc), or you can keep the DVD (lavc) codec setting and add a filter to resample the frame rate to 29.97 fps.

Now the movie files you encode with avidemux will play nicely on a DVD with the slideshows you create with dvd-slideshow!


Section 4: Working with audio.

From time to time you may find the need to edit audio tracks either of a home movie, or for use with a slideshow. For either use, I turn to Audacity.

My main audio editing need for slideshows is to either crop off an unwanted beginning of a track, or to adjust the volume in cases where some sections are too loud and others are too quiet. Once you have opened the audio file (mp3, wav, ogg) in Audacity, you will see a digital representation of the file. To crop off the beginning, select the first part of the track using the left mouse button. You can hit play to make sure you have the right part. Then select “Edit” and then “Delete” from the top menu. To adjust the volume of a specific section of a song, select the part of the song you want to adjust, and click on “Effect” and then “Amplify”. This will bring up a dialog box where you can put either a positive or negative number of decibels you want to amplify by. Once you have made your changes to the file, select File/Export and use the dialog box to export it as a WAV file. The WAV file can now be referenced in the -a switch by dvd-slideshow.

To edit audio for a home movie, you first have to extract the audio from the movie itself. You can use ffmpeg from the command line to do this. Just substitute the name of your movie file for “homemovie.mpg” and specify the name of the wav file you want instead of “audiotrack.wav” (or leave this as it is):
Code:
ffmpeg -i  homemovie.mpg -vn -acodec pcm_s16le -ar 44100 -ac 2 audiotrack.wav
Once you have the wav file, open it in audacity. My main reasons for editing home movie audio tracks are:

1. Silence unwanted noise on the track. Usually this means someone was talking in the background while I was recording. I also sometimes end up with various popping sounds that are created when I adjust the camera/tripod during recording. Either way they present no problem: just select the offending section of audio and click on Edit/Silence.
2. Remove mechanical noise created by my camera when recording. Hopefully you don't have this problem, but if you do audacity has a noise removal feature as well. First, select a section which is othewise silent (just noise). A second or two should be long enough. Then, click on Effect/Noise Removal, and click on “Get Noise Profile” when the dialog box comes up. Then, press control + a to select the entire file, and go back to Effect/Noise Removal. Make any changes in the dialog box that you want, and click on “OK”.

Once you have made edits to the wav file, export it using a new name as a wav file (even though you opened it as a wav file, Audacity always considers saving in wav format as an export because it isn't the application's native format). Open the home movie file using avidemux and select Audio/Main Track. Change the audio source from “Video” to “External WAV”, and browse to the edited wav file. The processed audio track will now be used with this file.

Note: Avidemux has an issue in how it handles video cutting if the audio track is imported from another source. If you delete sections from the beginning or middle of a video before saving the file with the new audio track, the audio becomes out of sync (it doesn't cut out the corresponding segments of audio). As a workaround, if I need to edit out sections (other than the end) of a home movie that uses an external audio file, I will first save the entire movie to DVD format and then open the dvd formatted version and make any cuts from that file. If you do this, leave the audio and video settings at “copy” when editing the DVD formatted file (no need to re-encode), but make sure you change the container type from the default “AVI” to “MPEG-PS(A+V)” before saving the edited file. You could also do this the other way around; first edit the video in avidemux with the original audio, leaving the audio and video settings to "copy" and container type avi. Then extract the wav from the edited file, process it in audacity, and then import the modified audio using avidemux before doing the conversion to dvd format.



Section 5: Preparing photos for a slideshow.

I won't go into detail on this topic, but will say that to remove redeye I use showfoto (part of KDE/digicam). If you haven't already tried this feature in showfoto, I highly recommend it; it is the best red eye reduction tool I've ever used. For everything else (rotating images, brightening, etc) I use Gimp. From time to time I will crop an image using Gimp as well, but most of the time I find it is better to use the cropping feature within dvd-slideshow discussed in section 7 instead of cropping the image directly. This is faster, easier to adjust later, and avoids the need to get the height to width ratio correct in the crop (you can end up with black bars on the top/bottom or sides).


Section 6: More advanced video editing techniques.

You already know how to use avidemux to create a DVD ready home movie which can be used along with a photo slideshow, as well as how to process audio tracks separately and combine them back in. avidemux has many other capabilities beyond this. My personal favorites are editing out unwanted sections of video, splicing movies together, and creating a fade in and/or fade out effect on the processed video. The first two can be done in avidemux in copy mode (audio & video set to "copy" to make changes without re-encoding the video), or just prior to processing the video to DVD format. If you are in copy mode for video already processed to DVD format, make sure you set the container type (Format) to "MPEG PS (A+V)", otherwise you probably want the container type to be "AVI". Creating fade in and/or fade out effects can only be done as part of re-encoding the video, so you will want to make these settings after you've set the audio and video codecs to create a DVD file (per instructions in sections 1 & 3) before selecting File/Save/Save Video. So long as you have avidemux in copy mode, there is no lossy conversion so you can edit and save a file as many times as you want without loosing quality. Most video and audio codecs (including those used for DVDs) are lossy so you want to minimize the number of times you convert your video (ideally you should only make one conversion, to DVD format).

1. Editing out any unwanted segments of the home movie. The controls at the bottom of the screen let you play the video as well as skip one frame (single > and < buttons) at a time or skip to the next keyframe (>> and << buttons). First go to the first frame you want to cut out of the video, and click on the “A” with an arrow next to it on the bottom middle of the screen. Next, find the last frame you want to cut and click on the “B” button next to the A one. If you are cutting out the beginning of a video file, make sure the end of the cut is on a keyframe since the new video will need to start there. Once you have set the beginning and ending markers for the cuts, go to Edit/Delete to delete the selected section of video.
2. Splicing two segments of video together. Avidemux makes this very easy provided both segments have the same video and audio format. If for example you want to make a single video out of a title segment created in Section 8 and the DVD encoded video it announces, this is very easy. First open the title segment, then select File/Append and select the DVD encoded movie you want to append to the title segment. Now save the video in copy mode (don't forget to set the container type to "MPEG PS (A+V)" when copying DVD formatted video). If you want to insert a segment of video in the middle of an existing movie, you would first cut the existing movie into two files at the point you want to insert the new video. This is a two step process as you would first delete the end portion of the movie to save the first segment, and then reopen the whole movie and delete the first segment to save just the second part. From here you just have to open the first segment and append the middle and end segments to it before saving the new combined movie.
3. If you want to create a fade in or fade out effect, click on filters under Video on the left hand side of the screen. Scroll down the list and double click on “Fade”. To create a fade out effect, leave it as the default “out” and enter a value in the start frame. If the video has 30 frames per second, starting 30 frames from the end frame will give you 1 second of fade. Subtract 30 frames from the end frame value listed (without changing the value in the end frame field), and type this into the start frame field. Click on ok to add this filter to the list.

In addtion to the features outlined above, Avidemux will also allow you to do much more including adding text/subtitles, speeding up or slowing down the video, and even encode a segment to play in reverse.

Section 7: More advanced slideshow techniques.

Lets take another look at the firstslideshow.txt file we created in section 2. Here is an example of how this will likely look (with different photo file names of course):
Code:
background:0::black 
title:3:My First Slideshow 
fadeout:1 
background:1 
fadein:1 
pictures/img_0752.jpg:3 
crossfade:1 
pictures/img_0753.jpg:3 
crossfade:1 
pictures/img_0756.jpg:3 
crossfade:1 
pictures/img_0760.jpg:3 
fadeout:1 
background:1
The settings in this file were created by the parameters we passed when we ran dir2slideshow. The parameter "-t 3" told it we wanted to have each picture display for 3 seconds. The parameter "-c 1" told it we wanted to crossfade for one second in between pictures. If you want different parameters for the entire show, you can re run dir2slideshow with the values you want. If you want make individual changes, you can just edit the values in this file with a text editor. Also, the order of the pictures in the show is determined by the order they appear in the file. If you want to change the order of pictures you can do that by editing the text file as well (or check the dir2slideshow man page for sorting options). This is all pretty basic and I think intuitive. Now on to the fun part!

Subtitles:
You can add subtitles to any picture by adding a colon after the duration value and then typing the text you want to be the subtitle. For example, here is how the line for the first photo would look with the subtitle “This is a really great shot!”:
Code:
pictures/img_0752.jpg:3 : This is a really great shot!
If you want to view subtitles during playback on your computer, you can launch mplayer from the command line (replace “slideshow.vob” with the name of the slideshow you want to view:
Code:
mplayer -sid 0 slideshow.vob
Cropping:
Sometimes you want to crop a photo to focus in on one section. To do this, add another colon after the subtitle (or two colons after the time value if no subtitle is wanted) and then enter the amount you want to crop, as well as where in the picture to focus the crop. For example, to zoom in on the center part of the first picture, I would change the line to:
Code:
pictures/img_0752.jpg:3 : This is a really great shot!:crop:50%;middle
# Or, if I didn't want to keep the subtitle:
pictures/img_0752.jpg:3 : :crop:50%;middle
The value after “crop:” (80%) tells how aggressively to crop the photo. 100% means show the whole thing. 50% shows the cropped area at twice the original size. The smaller the percentage, the more of a “zoom” effect this creates. The word after the semicolon says where in the photo to zoom in on. In this case I selected the middle, but I could have selected any of the following: topleft top topright left middle right bottomleft bottom bottomright

To get the hang of how crop works, create a copy of the firstslideshow.txt and name it croptest.txt. Pick one of the photos which you think is interesting to experiment with and remove the lines for all of the others. Make 3 or 4 copies of the line for the remaining photo and practice applying different crops to it, and then run dvd-slideshow from the command line on the file to see what this does. We don't need audio to demonstrate this so you can run the following command:
Code:
dvd-slideshow -n 'croptest' -f 'croptest.txt'
Kenburns:
The Kenburns effect allows you to smoothly move from one focus to another on the same photo. You can use it to create a zoom in or zoom out effect, or to pan across the photo. I typically use it in conjunction with the crop command and the basic syntax is the same, except it takes both a starting and an ending set of parameters which are separated by a semicolon. Once you've played with and have a good grasp of the crop command a bit, kenburns becomes intuitive. In this example, I'm going to start by showing the whole photo, then use kenburns to “zoom in” to the middle of the photo (30% crop), then hold the cropped view for 3 seconds. Instead of one line for the photo, it will now have the following three lines (I've dropped the subtitle for clarity). I've included comments following the # on each line:
Code:
pictures/img_0752.jpg:3::crop:100%;middle                   #  Show the photo first at 100% (no crop) for 3 seconds.  Same as pictures/img_0752.jpg:3
pictures/img_0752.jpg:3::kenburns:100%;middle; 30%;middle   #  Zoom from showing 100% (no crop) to showing 30% over 3 seconds, keeping the focus on the middle.  
pictures/img_0752.jpg:3::crop:30%;middle                    #  Show the cropped photo at 30% for 3 seconds.
The easiest way to get the hang of this is to define the beginning and end views in terms of the crop command first (lines 1&3 above). Then, make a copy of the first line and place it in between the two. On the new line, replace the term “crop” with “kenburns”, and add a semicolon at the end of the line and then the crop values from the 3rd line. For example, say I want to scroll across the middle of the picture from left to right, with a 30% crop. I would first create the following two lines:
Code:
pictures/img_0752.jpg:3::crop:30%;left        #  Show the left of the photo at 30% crop for 3 seconds.  
pictures/img_0752.jpg:3::crop:30%;right       #  Show the right of the photo at 30% crop for 3 seconds.
To create the middle (kenburns) line, I start with a copy of the top line, and change “crop” to “kenburns”. Then I add a semicolon to the end of the line and copy the crop values (in this case “ 30%;right”) to the end of the line. That's all! Here is how all three lines together would look:
Code:
pictures/img_0752.jpg:3::crop:30%;left                    #  Show the left of the photo at 30% crop for 3 seconds.  
pictures/img_0752.jpg:3::kenburns:30%;left; 30%;right     #  New line.  Scrolls from left to right over 3 seconds.  
pictures/img_0752.jpg:3::crop:30%;right                   #  Show the right of the photo at 30% crop for 3 seconds.

Cropping and Kenburns effects with greater precision:
top, left, middle, etc are easy to use but only give you limited control over where you want to zoom on the picture. Dvd-slideshow lets you use another method which gives greater precision. Instead of using one of the position keywords, you can provide x & y values (in terms of percent) of where you want to focus in the picture. The following two lines will produce exactly the same effect:
Code:
pictures/img_0752.jpg:3::crop:50%;middle                                    
pictures/img_0752.jpg:3::crop:50%;50%,50%
The first percent value after the semicolon determines how far from the left of the photo to focus the zoom on. Making this value smaller (say 40%) will move the focus to the left. Making it larger moves the focus to the right. The second value in the pair determines how far from the top of the photo to focus the zoom on. Making this value smaller moves the focus up, and making it larger moves the focus down. You can use this kind of input in the same way for kenburns as you can for the crop command. In addition, you can mix and match the format for the two parameters you use with kenburns. For example, the following line is fine:
Code:
pictures/img_0752.jpg:3::kenburns:100%;middle;50%;40%,60%       #  Starts by showing the full picture, then zooms to 50% with a focus just to the left and below the midpoint.
When using this method, pay special attention to which separator is a comma, and which is a semicolon!

Automating Testing of Different Crop and Kenburns Settings:
If you are like me, you won't always know exactly what crop or kenburns settings you want to apply to a photo without seeing the results and doing some fine tuning. When you have a slideshow with more that a few photos, waiting until you process the entire show to see if you get the crop/kenburns effect you wanted, or even if the syntax was correct isn't practical. I use a test file called “croptest.txt” for trying out crop and kenburns effects, and use the script below to automate the process of checking the results of different settings:
Code:
#!/bin/bash 
dvd-slideshow -n 'croptest' -f 'croptest.txt' -L 
mplayer -loop 3 croptest.vob 

# Don't exit the batch file until a key is pressed.  This prevents the teminal window from being closed so any errors can be viewed. 
read -p "Done!  Press Enter to continue."
Open a new file in your text editor, and save the lines above as “lcroptest”, and set the permissions as executable. You might notice that there is a switch at the end of the dvd-slideshow line that we haven't used before (-L). This puts the program in low quality mode, which greatly speeds up the process. The quality of the video isn't as good, but it gives enough of a picture to tell you if the crop/kenburns effect is being applied the way you want. I keep another copy of the same script, named “hcroptest” but with a “-H” switch at the end of the dvd-slideshow command instead of -L. This puts the program in high quailty mode, and every now and then I want to see high quality results as a final test. Once the slideshow is rendered the script calls mplayer and has it loop the video 3 times. I put the loop parameter in because often when I run this I take a sip of my tea or stretch my legs. Sometimes I'm only rendering 3 seconds of video and this way I'm not rushing to pause mplayer (spacebar) to see if the results are what I wanted. Once I have the results I want, I copy the lines I just created from the test file to the real slideshow text file, confident that when the whole slideshow is rendered, this section won't have any surprises. I also keep crop and kenburns lines that I've used before in the croptest.txt file commented out with the # symbol so I can either reuse them with different images, or use them as a syntax reference. Since I often run this batch file by double clicking it, I've added the last line to hold the terminal window open until I hit enter. Feel free to remove this line if it isn't helpful to you.


I highly recommend reading the documentation posted on the dvd-slideshow website. There are some additional features I haven't mentioned, including the ability to use a “wipe” effect in between pictures instead of crossfade in the 0.8.0 version of the program.



Section 8: Creating transitions and opening and closing credits.


Simple Title Sections:
dvd-slideshow automatically creates a title section for each slideshow you create. When you stack these together on a dvd you can see the name of each slideshow as it starts. I find it helpful to do the same for home movies so the viewer can tell what they are about to watch. The simplest way to do this is to take the top 3 lines of an existing slideshow text file and put the title you want in the appropriate line. To create a title section for a video I made when my wife and I were on a cruise ship, I could create a text file named cruiseship_title.txt with the following lines:

background:0::black
title:3:Cruise Ship
fadeout:1
background:1

Then I can use dvd-slideshow (dvd-slideshow -n 'cruiseship_title' -f 'cruiseship_title.txt') to create a video file named cruiseship_title.vob that starts with a black screen, fades into the title “Cruise Ship”, and then fades back to black. Once I have this file, I can place it in the dvdauthor.xml file above the home video of us on the ship.

More Advanced Title Sections:
To create a more sophisticated title section, I start by creating an all black image in gimp that is 720 x 480 pixels (same as ntsc frame size, use 720 x 576 for pal), and I save this image as “black.png”. Next, I add the title text that I want in white centered over the black image (“Cruise Ship”), saving this file first as “cruiseship_title.xcf” (to allow future edits), and then “cruiseship_title.png” (a format dvd-slideshow can read). Next I extract the first frame in the cruise ship video as a jpeg, so I can have the title screen fade into the first frame of the video before it gets started. To do this, I first open the home movie in avidemux. By default it starts with the first frame of the movie, so I don't have to make any changes there. Then I select File/Save/Save JPEG Image, and save the image as “cruiseship.jpg” in the pictures folder. Next, I modify the cruiseship_title.txt file accordingly:
Code:
pictures/black.png:.05 
crossfade:.75 
pictures/cruiseship_title.png:2 
crossfade:1 
pictures/cruiseship.jpg:.04::crop:95%;middle
I've applied a slight crop to the cruiseship.jpg line to help mitigate the fact that dvd-slideshow adds black bars on top and bottom when it renders an image already in the dvd aspect ratio (I have no idea why it does this; see the * below for other workarounds). When I run “dvd-slideshow -n 'cruiseship_title' -f 'cruiseship_title.txt'” now, the new cruiseship_title.vob starts with a black screen, fades into the title, and then fades into the first frame of the cruise ship video. When I place this in front of the cruise ship home video file on the dvd, it creates a nice effect. There is a bit of distortion when switching from the slideshow still frame and the first frame of the running movie, but this is barely noticeable when viewed on the TV. Also, by using a title page created in gimp instead of the title function in dvd-slideshow, I have much greater control over things like font, title placement, etc. It also gives a much crisper appearance and allows me to use multiple lines instead of just one. If you are using a newer version of dvd-slideshow that supports the “wipe” transition effect, you could also replace the second crossfade line with wipe to make it look like you changed slides to load the movie.

* If you aren't happy with the 95% crop workaround to mitigate the effect of dvd-slideshow changing the aspect ratio of the image extracted from the video when creating the intro segment, I know of two other options to address this. The first is to remove the 95% crop on the last line of cruiseship_title.txt and render it with dvd-slideshow adding a -r switch. Then, you can import the vob this creates into Avidemux and use the crop and resize filters to remove the added top and bottom bars and return the video to the original aspect ratio. The other option is to create the introduction video using image2mpeg which has a switch to keep the aspect ratio from being changed. Reworking the dvd-slideshow video with avidemux is probably easiest because image2mpeg can take a bit of work to install and has little user documentation. However, reworking the video has the downside of forcing you to perform the lossy DVD encoding process a second time. This probably isn't a huge issue but is of course less than ideal. Once you learn how to use image2mpeg, it offers some neat extra transitions which make it especially suited to creating banners and transition segments between video clips. Check out the home page linked above for examples of what this application can do.

Opening and Closing Credits:
Opening and closing credits are even easier than the more advanced title sections above. Starting again from the all black 720 x 480 pixel black.png image, I've created opening and closing credits for my slideshow. One thing I found looks very sharp is to crossfade between an all black screen with the title words on top (for example “Music”) and the same page but with the music listings included below, and then crossfade back to the title page before crossfading again to a second page of music listings. Because the only thing which is changing is the actual music listings, these float gracefully in and out of view according to whatever timing you choose. Instead of trying to explain this further, I've posted a tarball with examples which shows how this works. Just extract the tarball and run the "renderexamples" script in the examples folder it creates to generate the example slideshows (you need dvd-slideshow installed for the script to work). This will render example dvd-slideshow movies for the opening and closing credits along with the more advanced title example above and an example of the kenburns effect. Feel free to modify the files in the tarball for use in your own projects.


Section 9: DVD Navigation & Menus.


All of the DVDs created with this tutorial have been autoplay DVDs which do not have a menu for navigation. I decided to focus on this for two reasons. First, this allows the tutorial to focus on quickly creating working DVDs. Second, I've found over the years that I have been producing annual DVDs to share with friends and family that while I enjoyed the “gee wiz” factor that menus (especially flashy ones) add to the finished product, my viewers generally didn't. In fact, for older or less technical friends and family members, menu structures could make it difficult for them to start my DVDs in the first place. Menus that are easy to read on a bright, crisp, computer monitor can be difficult to see on a normal TV, especially when not right up next to it. This is especially true when it comes to determining which item on the menu is selected, and of course more of a challenge for older viewers or those with older TVs. At the same time, the chapter/skip buttons on DVD remotes are typically the biggest buttons aside from the play button, and relatively easy to find by touch. Because of all of this, I've gone back from using menus and instead focus on creating well edited autorun DVDs. Instead of menus, I have a short section in the opening of the DVD which explains how to skip between segments and lists the contents of the disc including chapter numbers (see examples tarball in section 8). I limit chapter markers to the opening and closing credits, the beginnings of slideshows, and the title sections for videos. In the odd chance someone wants to jump straight to an item towards the end of the disc, this will limit the number of chapter skips needed. Also, aside from the credits, each time you hit a chapter marker with a disc designed this way you instantly see what the upcoming segment is named. My guess is that most of my friends and family won't even take advantage of the chapter skip feature or read the viewing instructions, but it makes me feel better having it in there and the 30 seconds it takes to display the opening information gives them some time to turn on their TV and switch it to DVD mode before my first slideshow starts playing. Your friends & family may be different than mine, but if you are interested you might try handing a finished DVD to some relatives you consider representative of your overall audience and watch what they do next.

Making DVDs with Navigation Menus:
If you want to make a DVD with menu navigation instead of autorun DVDs like are created with this tutorial, you have plenty of options under Linux. My first suggestion would be a really slick application called DeVeDe. This application will allow you to quickly and easily create nice looking simple menues for your DVDs. It also gives you the option of having it encode your video to DVD format, or using DVD encoded video without further processing. Other choices include Qdvdauthor, dvdwizard, Varsha, and DVDStyler. This isn't a comprehensive list, but hopefully it provides a good place to start. Even if you aren't interested in making navigation menus many of these programs are worth exploring because of the other features they offer.


  



All times are GMT -5. The time now is 08:22 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration