Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bakaoh/x264android
x264 for android
https://github.com/bakaoh/x264android
android jni x264
Last synced: about 1 month ago
JSON representation
x264 for android
- Host: GitHub
- URL: https://github.com/bakaoh/x264android
- Owner: bakaoh
- Created: 2017-01-13T03:33:47.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-06-24T20:35:13.000Z (over 3 years ago)
- Last Synced: 2023-02-26T17:03:30.737Z (almost 2 years ago)
- Topics: android, jni, x264
- Language: C++
- Size: 3.09 MB
- Stars: 11
- Watchers: 3
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# X264Android #
## Description ##
x264 jni for android
## Using ##
* Make sure you have the jcenter repository included in the `build.gradle` file in the root of your project:
```
repositories {
jcenter()
}
```* Include the following in your module's `build.gradle` file:
```
compile 'com.github.bakaoh:x264-android:X.X.X'
```for the version X.X.X, see the project on [Bintray](https://bintray.com/bakaoh/maven/x264-android).
* Create `X264Encoder` and `X264Params`
```
X264Encoder encoder = new X264Encoder();X264Params params = new X264Params();
params.width = 1280;
params.height = 720;
params.bitrate = 1000 * 1024;
params.fps = 25;
params.gop = params.fps * 2;
params.preset = "ultrafast";
params.profile = "baseline";
```* Init encoder
```
X264InitResult initRs = encoder.initEncoder(params);if (initRs.err == 0) {
// process initRs.sps, initRs.pps
}
```* Encode frame
```
X264EncodeResult encodedFrame = encoder.encodeFrame(inputFrame, X264Params.CSP_NV21, presentationTimestamp);if (encodedFrame.err == 0) {
// process encodedFrame.data
}
```## Build instructions ##
* Set the following environment variable:
```
X264_ANDROID_ROOT=""
```* Download the [Android NDK][] and set its location in an environment variable:
[Android NDK]: https://developer.android.com/tools/sdk/ndk/index.html
```
NDK_PATH=""
```* Fetch and build libx264.
```
cd "${X264_ANDROID_ROOT}/x264/src/main/cpp" && \
git clone http://git.videolan.org/git/x264.git libx264 && \
./build_x264.sh
```* Open project in Android Studio to build the JNI native libraries.