Home > Forum > Video writing

Video writing

May 11 (9 months ago)
Ashish Yadav wrote
I have bitmap image which is dynamic come on runtime at the 18 fps or 15 fps so i have to create a video in AVI which means when i click start it takes that bitmap image and start making video and when i click stop button it should stop making video you have Video from images in memory but when i click start it start but i could not find the process where i place my bitmap image dynamic which come's on runtime .
previously i was using video writer from emgu cv library and also AVIwriter library
you have some thing tell me know its urgent
Reply
17 Answers
May 11 (9 months ago)
Roman Minyaylov agent wrote
Hi

You can use OnVideoFrame* events to replace currently playing frame to your frame.
May 17 (9 months ago)
Ashish Yadav wrote
please can you elaborate or example with some eg
May 18 (9 months ago)
Ashish Yadav wrote
Input_AddVideoBlank() is use in video making from image in that there is a parameter of duration but i can tell duration at the start is dynamic means bitmap image come dynamic at 15 fps and when i click stop the video the video making should stop so i can't predetermine the video duration it can be 1 min or 1 hour
May 18 (9 months ago)
Roman Minyaylov agent wrote
If video duration is dynamic you can use Video Capture SDK.

In screen capture mode with screen source set to Color, you'll have OnVideoFrame* events, like in Video Edit SDK.

Screen Capture demo have sample code how to use SDK in screen capture mode.
If Color source used no real screen capture happened, just frames with predefined color.
May 18 (9 months ago)
Ashish Yadav wrote
but how to pass dynamic bitmap to video capture in screen capture sample code it take screen window but i could not found anything that i should replace with bitmap dynamic


private void VideoCapture1_OnVideoFrameBitmap(object sender, VideoFrameBitmapEventArgs e)
{



using (Graphics g = Graphics.FromImage(e.Frame))
{
g.DrawImage(frame, 0, 0, frame.Width, frame.Height);
e.UpdateData = true;
VideoCapture1.Push_Source_AddVideoFrame(frame);// frame comes dynamic but it did not work

}
// }
}
May 18 (9 months ago)
Ashish Yadav wrote
VideoCapture1.Push_Source_AddVideoFrame(resized.ToBitmap());

Unable to allocate window handle
Unable to push frame, Unable to cast COM object of type 'System.__ComObject' to interface type 'VisioForge.MediaFramework.Interfaces.IVFLiveVideoSource'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{8E1449D8-0106-486A-85F4-FC9A5D52C2B2}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
please help me
May 19 (9 months ago)
Roman Minyaylov agent wrote
Let me made sample app for you.
May 19 (9 months ago)
Ashish Yadav wrote
ok
May 19 (9 months ago)
Roman Minyaylov agent wrote
May 19 (9 months ago)
Ashish Yadav wrote
ok i will check thanks
May 19 (9 months ago)
Ashish Yadav wrote
i have written code in my application it create recording but whole recording is black or blank it does not shoes the images
private void VideoCapture1_OnVideoFrameBitmap(object sender, VideoFrameBitmapEventArgs e)
{

Bitmap frame = testVideoRec;


using (var grf = Graphics.FromImage(e.Frame))
{
var dur = e.StartTime / 1000;
// var idx = dur % _images.Count;

grf.DrawImage(frame, new Rectangle(0, 0, frame.Width, frame.Height), new Rectangle(0, 0, frame.Width, frame.Height), GraphicsUnit.Pixel);
e.UpdateData = true;
}
}

//////////////////////////////////////////////////
var source = new ScreenCaptureSourceSettings
{
Left = 0,
Right = 1280,
Top = 0,
Bottom = 960,
FrameRate = 15,
Mode = VFScreenCaptureMode.Color
};
VideoCapture1.Screen_Capture_Source = source;

VideoCapture1.Audio_PlayAudio = false;
VideoCapture1.Audio_RecordAudio = false;

VideoCapture1.Mode = VFVideoCaptureMode.ScreenCapture;
VideoCapture1.Output_Format = new VFMP4v8v10Output();
VideoCapture1.Output_Filename = @"C:\Users\User\Documents\VisioForge\output34.mp4";

VideoCapture1.Debug_Mode =false;

VideoCapture1.Start();
///////
please check where it is wrong please help me
May 19 (9 months ago)
Roman Minyaylov agent wrote
Looks ok. Please share your app source code. OnError event provide any errors?
May 19 (9 months ago)
Ashish Yadav wrote
onError there is no error and my app source code is two big there are many dependence first let me create it for small project in above code testVideoRec is the frame which come dynamic
May 19 (9 months ago)
Ashish Yadav wrote

Unable to allocate window handle. -this error come two time then stop
May 19 (9 months ago)
Ashish Yadav wrote
and also your code also create blank video only i have run
May 19 (9 months ago)
Ashish Yadav wrote
Clear - RemoveHandlers
Clear - dsGraphCB
Clear - FEventWorker
Clear - dsDXVideoEffects11
Clear - FCurrentFrameBuffer
Clear - dsTempVidCap
Clear - FHost (Invalidate)
Clear - Done
Capture - Step 1
Capture - Step 2
Capture - Step 3
Capture - Step 4
Add screen capture source...
Add screen capture source... Done.
Capture - Step 5
Capture - Step 5 - 1
Capture - Step 5 - 2
Capture - Step 5 - 3
Capture - Step 5 - 4
Capture - Step 5 - 5
Capture - Step 5 - 6
Capture - Step 5 - 7
Capture - Step 5 - 8
Capture - Step 5 - 9
Capture - Step 6
Capture - Step 7
Capture - Step 8
Capture - Step 10
Adding audio stream.
Capture - Step 11
Capture - Step 12
Init MP4/M4A output
Init H264 encoder... Done.
Capture - Step 13
Capture - Step 14
Capture - Step 15
Updating video renderer...
Capture - Step 17
Capture - Step 18
Updating video renderer...Done
Capture - Step 19
Capture - Step 20
Capture - Step 21
Run...
Capture - Step 23
Capture - Step 24
Capture - Step 26
Capture - Step 27
Capture - Step 28
Capture - Step 29
Run was successful...
Capture - Step 30
DirectShow event: ClockChanged, 0
DirectShow event: Paused, 0
Stop - 1
Stop - dsMediaControl
Stop - dsAudioEffects1Legacy
Stop - Clear
Clear - RemoveHandlers
Clear - DisposeRot
Clear - dsGraphCB
Clear - FEventWorker
Clear - dsFilterGraph (RemoveAllFilters)
Clear - dsVideoSampleGrabberMain
Clear - dsMP4Encoder
Clear - dsVideoEffectsProcessor
Clear - dsDXVideoEffects11
Clear - dsScreenSource
Clear - dsVideoSmartTee
Clear - dsMediaControl
Clear - dsMediaSeeking
Clear - dsMediaEvent
Clear - FCurrentFrame
Clear - FCurrentFrameBuffer
Clear - dsMainScreen
Clear - dsCaptureBuilder
Clear - dsFilterGraph (ReleaseComObject)
Clear - FHost (Invalidate)
Clear - Done
Stop - FHost.Invalidate
Stop - Finish
your code debug values
May 20 (9 months ago)
Roman Minyaylov agent wrote