Git Product home page Git Product logo

x264android's Introduction

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.

  • 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="<path to x264android checkout>"
  • Download the Android NDK and set its location in an environment variable:
NDK_PATH="<path to Android NDK>"
  • 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.

x264android's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

x264android's Issues

Getting error. Can share example

dimensions not set
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --

[h264 @ 0000014dc519d980] non-existing PPS 0 referenced
[h264 @ 0000014dc519d980] decode_slice_header error
[h264 @ 0000014dc519d980] no frame!
[h264 @ 0000014dc519d980] non-existing PPS 0 referenced

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.