Related products: Video Capture SDK .Net

Video capture to MP4 using Video Capture SDK .Net

MP4 v8 (legacy) / v10 (DirectShow based)

Create VFMP4v8v10Output object

VFMP4v8v10Output mp4Output = new VFMP4v8v10Output();

Set MP4 settings using settings dialog

MP4v10SettingsDialog mp4SettingsDialog = new MP4v10SettingsDialog();

mp4SettingsDialog.ShowDialog(this);
mp4SettingsDialog.SaveSettings(ref mp4Output);

Or

 

Set MP4 settings without using settings dialog

 

1. Set MP4 mode - v8 or v10

mp4Output.MP4Mode = VFMP4Mode.v8;
// or
mp4Output.MP4Mode = VFMP4Mode.v10;

2. Set video settings

mp4Output.Video.Profile = VFH264Profile.ProfileMain; // H264 profile
mp4Output.Video.Level = VFH264Level.Level4; // H264 level
mp4Output.Video.Bitrate = 2000; // bitrate

// optional parameters
mp4Output.Video.MBEncoding = VFH264MBEncoding.CABAC; //CABAC / CAVLC
mp4Output.Video.BitrateAuto = false; // true to use auto bitrate
mp4Output.Video.RateControl = VFH264RateControl.VBR; // rate control - CBR or VBR

3. Set audio settings

mp4Output.Audio_AAC.Bitrate = 192;
mp4Output.Audio_AAC.Version = VFAACVersion.MPEG4; // MPEG-4 / MPEG-2
mp4Output.Audio_AAC.Output = VFAACOutput.RAW; // RAW or ADTS
mp4Output.Audio_AAC.Object = VFAACObject.Low; // type of AAC

Apply settings

1. Use MP4 format for output

VideoCapture1.Output_Format = mp4Output;

2. Set video capture mode

VideoCapture1.Mode = VFVideoCaptureMode.VideoCapture;

3. Set file name (be sure that you have write access rights)

VideoCapture1.Output_Filename = "c:\\123.mp4";

4. Start capture

VideoCapture1.Start();

MP4 v10 NVENC

Create VFMP4v8v10Output object

var mp4Output = new VFMP4v8v10Output();

Set MP4 settings using settings dialog

var mp4SettingsDialog = new MP4v10SettingsDialog();

mp4SettingsDialog.ShowDialog(this);
mp4SettingsDialog.SaveSettings(ref mp4Output);

Or

 

Set MP4 settings without using settings dialog

 

1. Set MP4 mode - v10 NVENC

mp4Output.MP4Mode = VFMP4Mode.v10_NVENC;

2. Set video settings

mp4Output.Video_NVENC.Profile = VFNVENCVideoEncoderProfile.H264_Main; // H264 profile
mp4Output.Video_NVENC.Level = VFNVENCEncoderLevel.H264_4; // H264 level
mp4Output.Video_NVENC.Bitrate = 2000; // bitrate

// optional parameters
mp4Output.Video_NVENC.RateControl = VFNVENCRateControlMode.VBR; // rate control - CBR or VBR

3. Set audio settings

mp4Output.Audio_AAC.Bitrate = 192;
mp4Output.Audio_AAC.Version = VFAACVersion.MPEG4; // MPEG-4 / MPEG-2
mp4Output.Audio_AAC.Output = VFAACOutput.RAW; // RAW or ADTS
mp4Output.Audio_AAC.Object = VFAACObject.Low; // type of AAC

Apply settings

1. Use MP4 format for output

VideoCapture1.Output_Format = mp4Output;

2. Set video capture mode

VideoCapture1.Mode = VFVideoCaptureMode.VideoCapture;

3. Set file name (be sure that you have write access rights)

VideoCapture1.Output_Filename = "c:\\123.mp4";

4. Start capture

VideoCapture1.Start();

MP4 v11 (Media Foundation based encoders)

Create VFMP4v11Output object

var mp4Output = new VFMP4v11Output();

Set MP4 settings using settings dialog

var mp4SettingsDialog = new MFSettingsDialog();​

mp4SettingsDialog.ShowDialog(this);
mp4SettingsDialog.SaveSettings(ref mp4Output);

Or

 

Set MP4 settings without using settings dialog

 

1. First step - get available encoders

var filtersAvailableInfo = VideoCaptureCore.MP4_v11_GetFiltersAvailable();

2. Depending from available encoders select video codec

mp4Output.Video.Codec = VFMFVideoEncoder.MS_H264; // Microsoft H264
mp4Output.Video.Profile = VFMFH264Profile.Main; // H264 profile
mp4Output.Video.Level = VFMFH264Level.Level4; // H264 level
mp4Output.Video.AvgBitrate = 2000; // bitrate

// optional parameters
mp4Output.Video.CABAC = true; // CABAC / CAVLC
mp4Output.Video.RateControl = VFMFCommonRateControlMode.CBR; // rate control

// many other parameters available

3. Set audio settings

mp4Output.Audio.Bitrate = 192;
mp4Output.Audio.Version = VFAACVersion.MPEG4; // MPEG-4 / MPEG-2
mp4Output.Audio.Output = VFAACOutput.RAW; // RAW or ADTS
mp4Output.Audio.Object = VFAACObject.Low; // type of AAC

Apply settings

1. Use MP4 format for output

VideoCapture1.Output_Format = mp4Output;

2. Set video capture mode

VideoCapture1.Mode = VFVideoCaptureMode.VideoCapture;

3. Set file name (be sure that you have write access rights)

VideoCapture1.Output_Filename = "c:\\123.mp4";

4. Start capture

VideoCapture1.Start();

VisioForge © 2006-2019

  • GitHub-Mark-64px
  • Twitter Социальные Иконка
  • VisioForge Facebook page
  • YouTube channel