Question about data capture of the silverlight4 camera

Source: Internet
Author: User

first, we can capture the video stream of the camera in Silverlight Chinese. We can create a class and inherit from the videosink class. The videosink class is an abstract class (located in system. windows. in the media namespace (s), we need to implement the four methods
public abstract class videosink
{< br> Public videosink ();
Public capturesource {Get; Set ;}< br> protected abstract void oncapturestarted ();
protected abstract void oncapturestopped ();
protected abstract void onformatchange (videoformat);

// Sampledata is the data captured every 100 nanoseconds.
// The captured data streams can be stored in the appropriate carrier.
// Or encode or compress the data stream
Protected abstract void onsample (long sampletimeinhundrednanoseconds, long framedurationinhundrednanoseconds, byte [] sampledata );
}

Then, assign our capturesource to the capturesource in videosink so that videosink will automatically capture the data in the camera.

 

Although the data can be captured, in fact, I did capture the data, but the problem is that the captured data is too large. I tested that each 100 s of captured data can contain more than MB, if this huge amount of data is not processed, you can imagine how huge the data will be produced when we record a few minutes of video! I do not know video encoding, and Microsoft does not provide a dedicated coding tool in Silverlight. Therefore, the camera function is a good-looking and useful thing at present!

In fact, there is another problem, that is, the videosink is unstable when capturing data, which often leads to onformatchange. Once onformatchange occurs, the data capture will stop, I have not found a solution to this problem yet. I hope someone can give me some advice!

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.