Use the DVD Writer to write a DVD image A set of files that contain all of the video and audio content for a DVD, organized with a table of contents (optional). See also: Title, Chapter, ISO Image An ISO image (.iso) is a disk image of a file system. It includes data files that are contained in the ISO image along with filesystem metadata. ISO images are an alternative to physical media for distribution of a "DVD" over the Internet. Most operating systems allow ISO images images to be "played" as if they were physical discs. See also: DVD Image.. to the hard disk. To write to a DVD, perform the following steps:
1. |
Add the LEAD Multimedia controls to your project: |
|
On the Project pull-down menu, use the Components option, and select the LEAD Multi-Media Library (15). |
2. |
Select the ltmmConvertCtrl Control, and add it to your form. |
3. |
Add the LEAD DVD Writer (2.0) and the LEAD Video Resize Filter (2.0) references to your project: |
|
On the Project pull-down menu, use the References option, and select the LEAD DVD Writer (2.0) and LEAD Video Resize Filter (2.0). |
4. |
Declare the following structure that will be filled with the chapter The name for each individual video file on a DVD. For example, under the title "Water Skiing", you might have the chapters "My first try," "My first wreck," and "My first jump." names, as follows: |
Private Type DVDTITLES
pszChapters(2) As String
End Type
5. |
Declare the following function to add the resize filter: |
Private Function AddResizeFilter(pConvert As IltmmConvertCtrl)
As Boolean
Dim pProcessors As ltmmProcessors
Dim pSelProcessors As ltmmProcessors
Dim lIndex As Long
Dim bstr As String
Dim pProc As ltmmProcessor
lIndex
= 0
' Get the video processor's pointer
Set pProcessors = pConvert.VideoProcessors
' Get the selected video processor
Set pSelProcessors = pConvert.SelectedVideoProcessors
' find the index for the resize filter
bstr = "@device:sw:{E526D606-22E7-494C-B81E-AC0A94BFE603}\{E2B7DCA5-38C5-11D5-91F6-00104BDB8FF9}"
lIndex = pProcessors.Find(bstr)
If
lIndex <> -1 Then
'
Add the resize filter
Set
pProc = pProcessors.Item(lIndex)
pSelProcessors.RemoveAll
pSelProcessors.Add
pProc, 0
Set
pProc = Nothing
Set
pProcessors = Nothing
Set
pSelProcessors = Nothing
AddResizeFilter
= True
Exit
Function
Else
Set
pProcessors = Nothing
Set
pSelProcessors = Nothing
AddResizeFilter
= False
Exit
Function
End If
AddResizeFilter = False
End Function
6. |
Configure the resize settings: |
Private Sub ConfigureResizeFilter(lWidth As Long, lHeight
As Long)
Dim pResize As ILMVResize
Set pResize = Main.ltmmConvertCtrl1.GetSubObject(ltmmConvert_Object_SelVideoProcessor)
' Set the resize filter settings
pResize.Enabled = True
pResize.AutoSize = False
pResize.EnableQuickResize = False
pResize.AspectRatio = True
pResize.Width = lWidth
pResize.Height = lHeight
pResize.Flags = RESIZE_RESAMPLE
Set pResize = Nothing
End Sub
7. |
Declare the following variables: |
Private aTitles(2) As DVDTITLES
8. |
Fill the titles chapters in the Load of the form: |
aTitles(0).pszChapters(0)
= "C:\Movie1.mpg"
aTitles(0).pszChapters(1) = "C:\Movie2.mpg"
aTitles(1).pszChapters(0) = "C:\Movie3.mpg"
aTitles(1).pszChapters(1) = "C:\Movie4.mpg"
9. |
Set the target format The format to be used for the converted file. This includes the file format, any special settings used by that format, and which audio and/or video codec A COmpressor combined with a DECompressor, or encoder and a decoder, which allows you to both compress and decompress that same data. is to be used for the conversion, and any special settings used by the codecs. to be a DVD: |
ltmmConvertCtrl1.TargetFormat = ltmmConvert_TargetFormat_DVD
10. |
Set the DVD compatible video encoder Also known as compressor Also known as an encoder, this is a module or algorithm to compress data. Playing that data back requires a decompressor, or decoder., this is a module or algorithm to compress data. Playing that data back requires a decompressor, or decoder Also known as a decompressor, this is a module or algorithm to decompress data.. to be the LEAD MPEG2 encoder (2.0). |
Dim lIndex As Long
lIndex = ltmmConvertCtrl1.VideoCompressors.Find("@device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\LEAD
MPEG2 Encoder (2.0)")
ltmmConvertCtrl1.VideoCompressors.Selection = lIndex
11. |
Set the DVD compatible audio encoder to be the LEAD MPEG audio encoder (2.0). |
lIndex = ltmmConvertCtrl1.AudioCompressors.Find("@device:sw:{33D9A761-90C8-11D0-BD43-00A0C911CE86}\LEAD
MPEG Audio Encoder (2.0)")
ltmmConvertCtrl1.AudioCompressors.Selection = lIndex
12. |
Add the resize filter as a process. Use the resize filter to change the video size so the dimensions are standard DVD dimensions. |
|
(In order for a DVD to be accepted by DVD players, the video size must be acceptable. It is recommended to use the DVD full resolution (720X480 for NTSC) because not all DVD navigators can handle the conversion from a DVD to a DVD image that is less than 720X480.) |
If AddResizeFilter(ltmmConvertCtrl1) = False Then
MsgBox
"Can't insert the resize filter"
Exit
Sub
End If
13. |
Configure the resize settings. Set the dimensions to be 720 x 480. |
ConfigureResizeFilter 720, 480
14. |
Set the DVD target folder: |
ltmmConvertCtrl1.TargetFile = "C:\DVDImage"
15. |
Retrieve the DVD Writer object: |
Dim pDvdWriter As LTDvdWriter
Set pDvdWriter = ltmmConvertCtrl1.GetSubObject(ltmmConvert_Object_Sink)
16. |
Set the DVD temporary folder: |
pDvdWriter.TempPath = "C:\temp"
17. |
Remove all of the menu titles: |
pDvdWriter.RemoveAllMenuTitles
18. |
Set the MenulessTitlePlay option to TRUE. This will concatenate all the titles for playback so each title The name for a group of related video files (called "Chapters") on your DVD. For example, for a DVD called "My Summer Vacation," you might have the titles "Water Skiing," "New Friends," and "Hiking." For each of those titles, you might have one or more different video files. will be played automatically, in sequential order. |
pDvdWriter.MenulessTitlePlay = True
19. |
Create multiple titles, each title containing multiple chapters. |
|
Note: In order to add a new title to the DVD image being created, overwriting must be disabled before writing the image. |
Dim
szTitle As String
Dim nChapter As Integer
Dim nTitle As Integer
For nTitle = 0 To 1
'
open a title
pDvdWriter.TitleBreak
= False
'
add a menu for the current title
szTitle
= "Title" & CStr(nTitle + 1)
pDvdWriter.AddMenuTitle
szTitle, -1
'
Create 2 chapters in the title
For
nChapter = 0 To 1
'
put the source movie file
ltmmConvertCtrl1.sourcefile
= aTitles(nTitle).pszChapters(nChapter)
'
Start writing the chapter
ltmmConvertCtrl1.StartConvert
While
ltmmConvertCtrl1.State <> ltmmConvert_State_Stopped
'
Wait for the conversion to finish. You can use a window
'to
receive notifications
DoEvents
Me.Caption
= "Writing..."
Wend
Next
nChapter
'
Close the title
pDvdWriter.TitleBreak
= True
'
Disable Overwrite so the title will be appended to an existing DVD
'image
pDvdWriter.Overwrite
= False
Next nTitle
20. |
Write the menu title. |
|
Menu writing should be the last step in a DVD image authoring process. Writing the menu first will cause an error and if a new title is written after the menu has been written, the menu will be destroyed. |
'
Change the writing state to indicate that the next conversion is a menu
pDvdWriter.TitleMenu = True
' Set the loop behavior for the menu background.
pDvdWriter.MenuLoop = True
' Set the source background movie (or you could use a still image file
as
' the background menu)
ltmmConvertCtrl1.sourcefile = "c:\background.mpg"
' Start writing the menu
ltmmConvertCtrl1.StartConvert
'
Wait to complete the conversion
While ltmmConvertCtrl1.State <> ltmmConvert_State_Stopped
'
Wait for the conversion to finish. You can use a window
'to
receive notifications
DoEvents
Me.Caption
= "Writing..."
Wend
21. |
Finish the menu conversion by setting TitleMenu to False and Overwrite to True to close the "menu write" mode. This merges the menu subtitle information with the background video and modifies the DVD image. |
pDvdWriter.TitleMenu = False
pDvdWriter.Overwrite = True
20. |
Free the convert and DVD writer objects. |
Set pDvdWriter = Nothing