MP4 recording
MP4 recording
TVideoGrabber is able to record in MP4 format if compatible MP4 encoder filters are installed.
After installing the filters, to record in MP4 format use the following sample code:
- VideoGrabber.RecordingMethod = rm_MP4
- VideoGrabber.CompressionMode = cm_CompressOnTheFly
- VideoGrabber.VideoCompressor = VideoGrabber.VideoCompressorIndex ("...") (1) - VideoGrabber.StartRecording ()
To record video+audio use the following sample code:
- VideoGrabber.RecordingMethod = rm_MP4
- VideoGrabber.CompressionMode = cm_CompressOnTheFly
- VideoGrabber.CompressionType = cs_AudioVideo
- VideoGrabber.VideoCompressor = VideoGrabber.VideoCompressorIndex ("...") (1) - VideoGrabber.AudioCompressor = VideoGrabber.AudioCompressorIndex ("...") (2) - VideoGrabber.StartRecording ()
Note: if the recording does not work with the selected third-party MP4 video and/or audio encoders it may require also the corresponding third-party MP4 multiplexer, in this case invoke additionally SetMultiplexerFilterByName before invoking StartRecording to specify the third-party MP4 multiplexer to use, e.g.: ... - VideoGrabber.SetMultiplexerFilterByName ("...") (3) - VideoGrabber.StartRecording ()
(1) specify the name of the video encoder listed in the "video compressors" list (listed in the "Recording" tab of MainDemo.exe) * (2) specify the name of the audio encoder listed in the "audio compressors" list (listed in the "Recording" tab of MainDemo.exe) * (3) to retrieve the filter name after installing it with regsvr32.exe browse the DirectShowFilters list, look for something like e.g. "MP4 mux", "MPEG-4 muxer", "MP4 multiplexer", "Multiplexer", etc...
Setting / saving / restoring the encoder settings To adjust the compressor settings, invoke ShowDialog(dlg_VideoCompressor) as follows, the settings will be saved in the registry and reused for the next recordings, e.g:
- VideoGrabber.RecordingMethod = rm_MP4
- VideoGrabber.CompressionMode = cm_CompressOnTheFly
- VideoGrabber.VideoCompressor = VideoGrabber.VideoCompressorIndex ("...") (2) - VideoGrabber.ShowDialog (dlg_VideoCompressor)
Additionally it is possible to invoke use the SaveCompressorSettings... and LoadCompressorSettings... functions to save/reload programmatically several sets of compressor settings without having to invoke ShowDialog() anymore, as explained in the "Saving and restoring compressor settings programmatically " chapter.