Save the Captured Data As MPEG (Visual FoxPro 6.0)
1. |
Start with the form that you created in My First Capture. |
2. |
Add the following line to the end of Form Init Sub. |
&& Set the Target or Output file.
ThisForm.ltmmCaptureCtrl1.TargetFile = "c:\target.avi"
3. |
Add 3 button controls to your form, and name them as follows. | |
|
Name |
Caption |
|
btnSelectCompressors |
Select MPEG Compressors |
|
btnSelectMux |
Select Multiplexer |
|
btnSetFrameRate |
Set Frame Rate |
4. |
Code the btnSelectCompressors Click procedure as follows. |
&& select the MS MPEG-4 Video Codec
ThisForm.ltmmCaptureCtrl1.VideoCompressors.Selection = ThisForm.ltmmCaptureCtrl1.VideoCompressors.Find ("@device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\Microsoft MPEG-4 Video Codec V2")
&& select the MP3 audio video compressor
ThisForm.ltmmCaptureCtrl1.AudioCompressors.Selection = ThisForm.ltmmCaptureCtrl1.AudioCompressors.Find("@device:cm:{33D9A761-90C8-11D0-BD43-00A0C911CE86}\85MPEG Layer-3")
5. |
Code the btnSelectMux Click procedure as follows. Note that you should set the MPEG multiplexer, this example will use an AVI multiplexer because it is available on all computers. But you should use a real MPEG multiplexer. |
&& assign the required Mux
&& this case: AVI
ThisForm.ltmmCaptureCtrl1.TargetFormats.Item (1).Mux = "@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{E2510970-F137-11CE-8B67-00AA00A3F1A6}"
&& assign the optional SinkSubType
&& this case: MEDIASUBTYPE_Avi
ThisForm.ltmmCaptureCtrl1.TargetFormats.Item (1).SinkSubType = "{E436EB88-524F-11CE-9F53-0020AF0BA770}"
&& assign an optional Sink
&& this case: default
ThisForm.ltmmCaptureCtrl1.TargetFormats.Item (1).Sink = ""
6. |
Code the btnSetFrameRate Click procedure as follows; you should set a frame rate supported by MPEG. Look at the documentation for your MPEG multiplexer to see which frame rates it supports. Common frame rates are: 23.976, 24, 25, 29.97, 30fps. |
&& set rate to 30 fps
ThisForm.ltmmCaptureCtrl1.UseFrameRate = .T.
ThisForm.ltmmCaptureCtrl1.FrameRate = 30
&& you should check with their particular compressor which frame rates are supported.
7. |
Run your program to test it. |