CN105744278A - Android system based H264 coding and decoding method - Google Patents

Android system based H264 coding and decoding method Download PDF

Info

Publication number
CN105744278A
CN105744278A CN201610086874.2A CN201610086874A CN105744278A CN 105744278 A CN105744278 A CN 105744278A CN 201610086874 A CN201610086874 A CN 201610086874A CN 105744278 A CN105744278 A CN 105744278A
Authority
CN
China
Prior art keywords
video
mediacodec
decoding
decoder
parameter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610086874.2A
Other languages
Chinese (zh)
Inventor
钟添华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Star-Net Wisdom Technology Co Ltd
Original Assignee
Fujian Star-Net Wisdom Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Star-Net Wisdom Technology Co Ltd filed Critical Fujian Star-Net Wisdom Technology Co Ltd
Priority to CN201610086874.2A priority Critical patent/CN105744278A/en
Publication of CN105744278A publication Critical patent/CN105744278A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/40Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video transcoding, i.e. partial or full decoding of a coded input stream followed by re-encoding of the decoded output stream

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses an android system based H264 coding and decoding method. The decoding process comprises the steps of creating a decoder by using MediaCodec.createDecoderByType when the parameter is applicable to video/avc; creating a decoding format by using MediaFormat.createVideoFormat, wherein the parameters are the video/avc, a video length and a video width; configuring the created decoder by using a MediaCodec.configure interface, and carrying the created decoding format parameters; placing decoding data to the decoder by using MediaCodec.quequeInputBuffer and then obtaining decoded YUV data through the MediaCodec.dequeue InputBuffer; and cycling until decoding is finished. According to the android system based H264 coding and decoding method, hardware coding and decoding is finished by using MediaCodec, and hardware acceleration can be used directly.

Description

A kind of method based on Android system H264 encoding and decoding
[technical field]
The present invention relates to a kind of method based on Android system H264 encoding and decoding.
[background technology]
Audiovisual applications, such as VOIP voice and video telephone and field of video monitoring, in order to improve Consumer's Experience, video is usually and requires high definition, but time mobile phone terminal viewing video often occurs, meeting one card, bypassing network reason, major part is attributed to CPU and takes and cause, performance is inadequate, for solving this problem, the scheme that eager searching can be hardware-accelerated.
In order to solve this problem, one is to use software codec by JNI encapsulation, if use software mode, performance is not high, in encoding and decoding high-resolution, time such as 720P/1080P/4K, CPU is substantially unable to do what one wishes, and another is the interface using vendor hardware encoding and decoding, but these interfaces Ge great producer all disunities, often changing a chip solution, corresponding interface also and then changes.
Early stage, androidSDK was but without the API providing hardware encoding and decoding, until after API16, just providing MediaCodec class, just supported hardware compression interface.
Owing to android mobile phone substantially updates on the market, system after 4.x substantially, the MediaCodec interface that the unified androidsdk of use of the decoding interface of the present invention provides.
[summary of the invention]
The technical problem to be solved is in that to provide a kind of method based on Android system H264 encoding and decoding, uses MediaCocdec to complete hardware compression, can directly use hardware-accelerated.
The present invention is achieved in that
A kind of method based on Android system H264 encoding and decoding, including:
Decoding process:
Step a1: use MediaCodec.createDecoderByType, parameter is suitable for video/avc and creates decoder;
Step a2: using MediaFormat.createVideoFormat, parameter is video/avc, and video is long, video width creates codec format;
Step a3: use the MediaCodec.configure interface configuration step a1 decoder created, carry the step a2 codec format parameter created;
Step a4: use MediaCodec.quequeInputBuffer that decoding data are put into decoder, then pass through MediaCodec.dequeueInputBuffer and obtain decoded yuv data;
Step a5: circulation step a4 until decoding terminates;
Coding flow process:
Step b1: use MediaCodec.createEncoderByType, parameter is suitable for video/avc and creates decoder;
Step b2: using MediaFormat.createVideoFormat to create video format, video format parameter has video/aac, and video length and width, frame per second, code check, IDR interval, color space are set to YUV420P;
Step b3: use the MediaCodec.configure interface configuration step b1 encoder created, carry the step b2 video format parameter created;
Step b4:android camera collection to data form be usually NV21 form, it is necessary to convert YUV420P form to, after converting, use MediaCodec.quequeInputBuffer YUV420P data are put into encoder;
Step b5: obtain the H264 data after coding by MediaCodec.dequeueInputBuffer;
Step b6: circulation step b4, b5, until end-of-encode.
It is an advantage of the current invention that: the invention solves use high-resolution video encoding and decoding performance bottleneck problem, improve audiovisual applications and use high-resolution, and tool has certain versatility in android framework, can directly use hardware-accelerated.
[accompanying drawing explanation]
The invention will be further described in conjunction with the embodiments with reference to the accompanying drawings.
Fig. 1 is decoding process schematic diagram in the present invention.
Fig. 2 is that the present invention encodes schematic flow sheet.
[detailed description of the invention]
Refer to shown in Fig. 1 and Fig. 2, a kind of method based on Android system H264 encoding and decoding, including:
Decoding process:
Step a1: use MediaCodec.createDecoderByType, parameter is suitable for video/avc and creates decoder;
Step a2: using MediaFormat.createVideoFormat, parameter is video/avc, and video is long, video width creates codec format;
Step a3: use the MediaCodec.configure interface configuration step a1 decoder created, carry the step a2 codec format parameter created;
Step a4: use MediaCodec.quequeInputBuffer that decoding data are put into decoder, then pass through MediaCodec.dequeueInputBuffer and obtain decoded yuv data;
Step a5: circulation step a4 until decoding terminates;
Coding flow process:
Step b1: use MediaCodec.createEncoderByType, parameter is suitable for video/avc and creates decoder;
Step b2: use MediaFormat.createVideoFormat to create video format, video format parameter has video/aac, and video resolution (long, wide), frame per second, code check, IDR interval, color space is set to YUV420P;
Step b3: use the MediaCodec.configure interface configuration step b1 encoder created, carry the step b2 video format parameter created;
Step b4:android camera collection to data form be usually NV21 form, it is necessary to convert YUV420P form to, after converting, use MediaCodec.quequeInputBuffer YUV420P data are put into encoder;
Step b5: obtain the H264 data after coding by MediaCodec.dequeueInputBuffer;
Step b6: circulation step b4, b5, until end-of-encode.
The invention solves use high-resolution video encoding and decoding performance bottleneck problem, improve audiovisual applications and use high-resolution, and tool has certain versatility in android framework, can directly use hardware-accelerated.
The foregoing is only the preferably enforcement use-case of the present invention, be not intended to limit protection scope of the present invention.All any amendment of making, equivalent replace and improvement etc. within the spirit and principles in the present invention, should be included within protection scope of the present invention.

Claims (1)

1. the method based on Android system H264 encoding and decoding, it is characterised in that: including:
Decoding process:
Step a1: use MediaCodec.createDecoderByType, parameter is suitable for video/avc and creates decoder;
Step a2: using MediaFormat.createVideoFormat, parameter is video/avc, and video is long, video width creates codec format;
Step a3: use the MediaCodec.configure interface configuration step a1 decoder created, carry the step a2 codec format parameter created;
Step a4: use MediaCodec.quequeInputBuffer that decoding data are put into decoder, then pass through MediaCodec.dequeueInputBuffer and obtain decoded yuv data;
Step a5: circulation step a4 until decoding terminates;
Coding flow process:
Step b1: use MediaCodec.createEncoderByType, parameter is suitable for video/avc and creates decoder;
Step b2: using MediaFormat.createVideoFormat to create video format, video format parameter has video/aac, and video length and width, frame per second, code check, IDR interval, color space are set to YUV420P;
Step b3: use the MediaCodec.configure interface configuration step b1 encoder created, carry the step b2 video format parameter created;
Step b4:android camera collection to data form be usually NV21 form, it is necessary to convert YUV420P form to, after converting, use MediaCodec.quequeInputBuffer YUV420P data are put into encoder;
Step b5: obtain the H264 data after coding by MediaCodec.dequeueInputBuffer;
Step b6: circulation step b4, b5, until end-of-encode.
CN201610086874.2A 2016-02-16 2016-02-16 Android system based H264 coding and decoding method Pending CN105744278A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610086874.2A CN105744278A (en) 2016-02-16 2016-02-16 Android system based H264 coding and decoding method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610086874.2A CN105744278A (en) 2016-02-16 2016-02-16 Android system based H264 coding and decoding method

Publications (1)

Publication Number Publication Date
CN105744278A true CN105744278A (en) 2016-07-06

Family

ID=56245155

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610086874.2A Pending CN105744278A (en) 2016-02-16 2016-02-16 Android system based H264 coding and decoding method

Country Status (1)

Country Link
CN (1) CN105744278A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109660745A (en) * 2018-12-21 2019-04-19 深圳前海微众银行股份有限公司 Video recording method, device, terminal and computer readable storage medium
CN113099238A (en) * 2021-06-09 2021-07-09 广州易方信息科技股份有限公司 Decoding method for judging video played by android mobile phone

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102291580A (en) * 2011-07-28 2011-12-21 南京联慧通信技术有限公司 Video transmission method based on Android system
US20120243601A1 (en) * 2007-05-11 2012-09-27 Advanced Micro Devices, Inc. Software video transcoder with gpu acceleration
CN104023260A (en) * 2013-02-28 2014-09-03 腾讯科技(深圳)有限公司 Hardware decoding implementation method and device, and player
CN104159113A (en) * 2014-06-30 2014-11-19 北京奇艺世纪科技有限公司 Method and device for selecting video coding mode for Android system
CN104469368A (en) * 2014-12-08 2015-03-25 东南大学 Universal performance detection method for mobile phone platform VPU video coding and decoding

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120243601A1 (en) * 2007-05-11 2012-09-27 Advanced Micro Devices, Inc. Software video transcoder with gpu acceleration
CN102291580A (en) * 2011-07-28 2011-12-21 南京联慧通信技术有限公司 Video transmission method based on Android system
CN104023260A (en) * 2013-02-28 2014-09-03 腾讯科技(深圳)有限公司 Hardware decoding implementation method and device, and player
CN104159113A (en) * 2014-06-30 2014-11-19 北京奇艺世纪科技有限公司 Method and device for selecting video coding mode for Android system
CN104469368A (en) * 2014-12-08 2015-03-25 东南大学 Universal performance detection method for mobile phone platform VPU video coding and decoding

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109660745A (en) * 2018-12-21 2019-04-19 深圳前海微众银行股份有限公司 Video recording method, device, terminal and computer readable storage medium
CN113099238A (en) * 2021-06-09 2021-07-09 广州易方信息科技股份有限公司 Decoding method for judging video played by android mobile phone

Similar Documents

Publication Publication Date Title
TWI725299B (en) Picture file processing method, device, and storage medium
KR102606583B1 (en) Video coding method and system using post-processing display
CN104144349B (en) SPICE coding and decoding videos extended method and system based on H264
CN103179133B (en) Based on the client of entity class and the method for server communication
CN103442071A (en) Mobile phone screen content real-time sharing method
CN104168439B (en) A kind of method for video coding and device
CN101009803A (en) High-resolution video transfer system and method
CN104702909A (en) Video data processing method and video data processing device
CN105681826B (en) Video-frequency data transmission system and method and video data decoding method
CN109246447A (en) The method for signaling step-by-step movement time sublayer access-sample
CN105744278A (en) Android system based H264 coding and decoding method
CN103248830A (en) Real-time video combination method for augmented reality scene of mobile intelligent terminal
CN113079406A (en) Video processing method and device
US9936266B2 (en) Video encoding method and apparatus
US20170163990A1 (en) Video transcoding method and system
CN103634603A (en) Method, device and system for video encoding and decoding
CN102724553A (en) Image encoding method, image decoding method, image encoder and image decoder
JP6990179B2 (en) Methods and equipment for selecting processes to be applied to video data from a candidate process set driven by a common information dataset.
CN109005163A (en) A kind of HTTP dynamic requests service calling method
CN110868610B (en) Streaming media transmission method, device, server and storage medium
CN104104897A (en) Mobile terminal video editing method and device
CN106254811A (en) Mobile terminal and the control method of video calling thereof and system
CN204131646U (en) A kind of digital video signal decoder
CN104780390A (en) Video processing method and device
CN106202375A (en) A kind of many browsers web flow formula video heterogeneous protocol analytics engine system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160706

RJ01 Rejection of invention patent application after publication