HardwareVideoCodec is an efficient video encoding library for Android. Supports software
and hardware
encode. With it you can easily record videos of various resolutions on your android app.
- Support RTMP stream.
- Better beautifying filter.
- Support for changing resolution without restarting the camera.
- Fix audio distortion.
- Supports 20 filters.
- Support hard & soft encode.
- Record video & audio. Pack mp4 through MediaMuxer.
- Use OpenGL to render and support filter.
- Supports 20 filters
- Support beauty filter.
- Support for changing resolution without restarting the camera.
- More features.
If you are building with Gradle, simply add the following code to your project:
- Project root build.gradle
buildscript {
ext.kotlin_version = '1.2.30'//Latest kotlin version
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
maven {
url 'https://dl.bintray.com/lmylr/maven'
}
}
}
- Module build.gradle
dependencies {
implementation 'com.lmy.codec:hardwarevideocodec:1.5.1'
implementation 'com.lmy.codec:rtmp:1.0.1'//If you want to use RTMP stream.
}
- Extend BaseApplication
class MyApplication : BaseApplication()
- MainActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val mTextureView = TextureView(this)
setContentView(mTextureView)
val mPresenter = RecordPresenter(CodecContext(this).apply {
ioContext.path = "${Environment.getExternalStorageDirectory().absolutePath}/test.mp4"
//ioContext.path = "rtmp://192.168.16.203:1935/live/livestream"//If you want to use RTMP stream.
})
mPresenter.setPreviewTexture(mTextureView)
//For recording control
mTextureView.setOnTouchListener { v, event ->
when (event.action) {
MotionEvent.ACTION_DOWN -> {
mPresenter.encoder?.start()
mPresenter.audioEncoder?.start()
}
MotionEvent.ACTION_UP -> {
mPresenter.encoder?.pause()
mPresenter.audioEncoder?.pause()
}
}
true
}
}
}
Please use our issues page to let us know of any problems.
HardwareVideoCodec is GPL-licensed.