Skip to content

OnlyInAmerica/HWEncoderExperiments

Repository files navigation

HWEncoderExperiments

Herein lies experiments with Android 4.3's MediaCodec and MediaMuxer APIs.

The master branch is concerned with simultaneously producing a single high quality .mp4 as well as gapless 5 second chunk mp4s. The end goal is to allow an Android device to act as an HLS / MPEG-DASH server.

The audioonly branch shows a barebones example encoding AAC audio with Android's AudioRecord class.

Output

Output is stored in '/sdcard/HWEncodingExperiments' in or internal storage if /sdcard isn't available.

Output location is modified via FileUtils.OUTPUT_DIR and FileUtils.createTempFileInRootAppStorage.

Note on ColorFormats

This example doesn't yet intelligenty check for available color formats. If you experience a crash on MediaCodec.configure, try changing the appropriate part of ChunkedAvcEncoder.prepare():

private void prepare() {
…
  videoFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_TI_FormatYUV420PackedSemiPlanar);
  // On devices without a TI SOC, try:
  // COLOR_FormatYUV420PackedSemiPlanar
…
}

About

Deprecated ( See https://github.com/Kickflip/kickflip-android-sdk for my current work). Experiments with Android 4.3's MediaCodec and MediaMuxer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published