monktan89 / HardwareVideoCodec

HardwareVideoCodec

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HardwareVideoCodec

Download

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.

ScreenRecord_1 ScreenRecord_1

Latest release

V1.5.1

  • Support RTMP stream.
  • Better beautifying filter.

Features

  • 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.

Start

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
        }
    }
}

Join the HardwareVideoCodec community

Please use our issues page to let us know of any problems.

License

HardwareVideoCodec is GPL-licensed.

About

HardwareVideoCodec

License:GNU General Public License v2.0


Languages

Language:C 65.7%Language:C++ 16.7%Language:Java 9.7%Language:Makefile 6.0%Language:Shell 1.1%Language:HTML 0.4%Language:Roff 0.3%Language:MATLAB 0.1%