Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi! I am new in c# and i have an project which is recording a video via my webcam and save it. But i don't know how to do this in c# programming language. By the way thanks for help.
Posted
Comments
[no name] 27-Sep-14 6:52am    
If you do not know then you do some research and find out. http://www.bing.com/search?q=c%23+How+Can+I+Record+A+Video+With+Webcam = 45,200,000 results
BillWoodruff 27-Sep-14 6:57am    
Why don't you start by searching CodeProject for articles on recording video ?

If this issue is still relevant, I can recommend you to study this video guide: C# camera tutorial #6 - Recording video[^]

After watching the video you will see that first you need to create connection between your camera and the application. After this you need to implement the recording feature as follows:

C#
private void StartCapture_Click(object sender, RoutedEventArgs e)
        {

            if (_videoSender == null) return;
            var date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" +
                        DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second;

            var currentpath = AppDomain.CurrentDomain.BaseDirectory + date + ".mpeg4";

            _recorder = new MPEG4Recorder(currentpath);
            _recorder.MultiplexFinished += _recorder_MultiplexFinished;

            _connector.Connect(_videoSender, _recorder.VideoRecorder);
        }

void _recorder_MultiplexFinished(object sender, Ozeki.VoIP.VoIPEventArgs<bool> e)
        {
            _recorder.MultiplexFinished -= _recorder_MultiplexFinished;
            _recorder.Dispose();
        }

private void StopCapture_Click(object sender, RoutedEventArgs e)
        {
            if (_videoSender == null) return;
            _connector.Disconnect(_videoSender, _recorder.VideoRecorder);
            _recorder.Multiplex();
        }


This solution is based on this onvif camera software[^]. I hope I could help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900