Mediarecorder for Android audio and video recording

Source: Internet
Author: User

This is how Android supports video formats:

 

 

Android can decode JPG files.

Video encoding and decoding in H.263 format,

Only videos in h264 format can be decoded.

 

Is the life cycle of the mediarecorder class

 

 

A common case of using mediarecorder to record audio works as follows:

 

Mediarecorder recorder = new mediarecorder (); <br/> recorder. setaudiosource (mediarecorder. audiosource. MIC); <br/> recorder. setoutputformat (mediarecorder. outputformat. three_gpp); <br/> recorder. setaudioencoder (mediarecorder. audioencoder. amr_nb); <br/> recorder. setoutputfile (path_name); <br/> recorder. prepare (); <br/> recorder. start (); // recording is now started <br/>... <br/> recorder. stop (); <br/> recorder. reset (); // You can reuse the object by going back to setaudiosource () Step <br/> recorder. release (); // now the object cannot be reused 

 

We suspect that the H.263 video format generated by Android is special.

When the data is saved to the server (PC), the generated 3GP file cannot be opened.

You can save the recorded video on your mobile phone but play it normally.

 

Although the mediarecorder class is very convenient to use, it has a single method and few interfaces, mainlyCodeAll are the underlying encapsulation. Poor scalability.

 

It is a headache.

 

Related Article

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.