android mediacodec api,使用Android MediaCodec API无需原生代码即可加速视频转码

badge.svg?event=push68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6e61746172696f312f5472616e73636f6465722e73766768747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f6e61746172696f312f5472616e73636f6465722e737667

banner.png

Looking for a powerful camera library to take videos? Take a look at our CameraView.

Need support, consulting, or have any other business-related question? Feel free to get in touch.

Like the project, make profit from it, or simply want to thank back? Please consider sponsoring me!

Transcoder

Transcodes and compresses video files into the MP4 format, with audio support, using hardware-accelerated Android codecs available on the device. Works on API 18+.

implementation 'com.otaliastudios:transcoder:0.9.1'

Fast transcoding to AAC/AVC

Hardware accelerated

Multithreaded

Convenient, fluent API

Concatenate multiple video and audio tracks [docs]

Clip or trim video segments [docs]

Choose output size, with automatic cropping [docs]

Choose output rotation [docs]

Choose output speed [docs]

Choose output frame rate [docs]

Choose output audio channels [docs]

Choose output audio sample rate [docs]

Override frames timestamp, e.g. to slow down the middle part of the video [docs]

Error handling [docs]

Configurable validators to e.g. avoid transcoding if the source is already compressed enough [docs]

Configurable video and audio strategies [docs]

screenshot-1.pngscreenshot-2.png

This project started as a fork of ypresto/android-transcoder. With respect to the source project, which misses most of the functionality listed above, we have also fixed a huge number of bugs and are much less conservative when choosing options that might not be supported. The source project will always throw - for example, accepting only 16:9, AVC Baseline Profile videos - we prefer to try and let the codec fail if it wants to.

Support

If you like the project, make profit from it, or simply want to thank back, please consider sponsoring me through the GitHub Sponsors program! You can have your company logo here, get private support hours or simply help me push this forward.

Transcoder is trusted and supported by ShareChat, a social media app with over 100 million downloads.

sharechat.png

Feel free to contact me for support, consulting or any other business-related question.

Setup

Please read the official website for setup instructions and documentation. You might also be interested in our changelog. Using Transcoder is extremely simple:

Transcoder.into(filePath)

.addDataSource(context, uri) // or...

.addDataSource(filePath) // or...

.addDataSource(fileDescriptor) // or...

.addDataSource(dataSource)

.setListener(new TranscoderListener() {

public void onTranscodeProgress(double progress) {}

public void onTranscodeCompleted(int successCode) {}

public void onTranscodeCanceled() {}

public void onTranscodeFailed(@NonNull Throwable exception) {}

}).transcode()

Take a look at the demo app for a complete example.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值