Open video encoding (H.264) encoding/decoding data input and output Interfaces

Source: Internet
Author: User
Tags constant definition
Anychat is an open real-time communication solution for audio and video. in earlier versions, the input and output interfaces of raw data have been opened:
1. The client callback function can be used to output the user's original video sample frame data (YUV, RGB): video data callback function
2. External video frames can be transmitted to anychat for encoding through the external data input interface: How to Use the external audio/video data input function?

For some specific scenarios, upper-layer applications want to obtain the original H. 264 encode the data, or you want. 264 encoded data is transmitted to anychat. This feature is supported since anychat r00008. This feature gives anychat more flexibility and scalability, including:
1. It facilitates data exchange between anychat and other platforms to achieve interconnection with other platforms, such as sip communication terminals;
2. By writing access pages, you can access data such as surveillance cameras and video-on-demand platforms;

The new version adds a constant definition: brac_pix_fmt_h264, And the API interface has not changed.
1. When you need to use the callback function to obtain the user's H.264 encoded data, you can input constants when setting the callback function, such:
  1. // Set the callback function

  2. Brac_setvideodataexcallback (brac_pix_fmt_h264, onvideodataexcallback, this );


  3. // Callback function implementation

  4. Void callback onvideodataexcallback (DWORD dwuserid, lpvoid lpbuf, DWORD dwlen, bitmapinfoheader bmiheader, DWORD dwtimestamp, lpvoid lpuservalue)

  5. {


  6. }


Copy code


2. When you want to pass the encoded H.264 data to anychat, you can use the external data input interface, for example:
  1. // Initialization

  2. Brac_setinputvideoformat (brac_pix_fmt_h264, 320,240, 25, 0 );

  3. // Input data

  4. Brac_inputvideodata (lph1_frame, dwsize, dwtimestamp );

Copy code


Instructions:
1. The input and output H.264 encoded frame data are all NAL units, including the starting frame MARK: 00 00 00 01, and each input and output is a nal unit;
2. The key frame must contain a sequence parameter set (SPS: sequence parameter set) and an image parameter set (PPS: picture parameter set );
3. The timestamp is a millisecond value. The difference between the two timestamps indicates the interval between two frames (unit: milliseconds)


Open video encoding (H.264) encoding/decoding data input and output Interfaces

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.