All Projects → MasayukiSuda → Gpuvideo Android

MasayukiSuda / Gpuvideo Android

Licence: mit
This library apply video filter on generate an Mp4 and on ExoPlayer video and Video Recording with Camera2.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Gpuvideo Android

Ios tips
iOS的一些示例,持续更新中:1、AVFoundation 高仿微信相机拍摄和编辑 2、AVFoundation 人脸检测、实时滤镜、音视频编解码、GPUImage框架的使用等音视频相关内容 3、OpenGLES 4、LeetCode算法练习 5、iOS Crash防护和APM监控 6、WKWebView相关的内容 等........
Stars: ✭ 896 (+122.33%)
Mutual labels:  opengl-es, gpuimage, video-recording, filter
Ltvideorecorder
A demo project demonstrating how to add filter, drawing, and text to a video
Stars: ✭ 16 (-96.03%)
Mutual labels:  video-processing, video-recording, filter
Android Ultimategpuimage
provide video record method with filter and other cool staff. Yes, It's a full functional video recorder
Stars: ✭ 188 (-53.35%)
Mutual labels:  gpuimage, video-recording, filter
Metalpetal
A GPU accelerated image and video processing framework built on Metal.
Stars: ✭ 907 (+125.06%)
Mutual labels:  gpu, video-processing, filter
Librestreaming
Android real-time effect filter rtmp streaming library.using Mediacodec HWencoding&librtmp stream.
Stars: ✭ 856 (+112.41%)
Mutual labels:  opengl-es, gpuimage, filter
Gpuimage X
A Cross-platform (for both Android & iOS) Framework for GPU-based Filters, Video and Image Processing.
Stars: ✭ 154 (-61.79%)
Mutual labels:  gpuimage, video-processing, filter
Transcoder
🎞 Hardware-accelerated video transcoding using Android MediaCodec APIs. Supports cropping, concatenation, clipping, audio processing, video speed and much more.
Stars: ✭ 404 (+0.25%)
Mutual labels:  opengl-es, video-processing
Wslivedemo
音视频,直播SDK,rtmp推流,录制视频,滤镜。百万用户,线上迭代半年,已经稳定。
Stars: ✭ 1,782 (+342.18%)
Mutual labels:  opengl-es, gpuimage
Gapid
GAPID is a collection of tools that allows you to inspect, tweak and replay calls from an application to a graphics driver.
Stars: ✭ 1,975 (+390.07%)
Mutual labels:  opengl-es, gpu
FunFilter
Freely painted area, the software will automatically add filter on its.
Stars: ✭ 15 (-96.28%)
Mutual labels:  filter, video-processing
Ezfilter
A lightweight (<180KB), easy-to-extend Android filter and dynamic sticker framework for adding filters and stickers for camera, video, bitmap and view.(一个轻量级(<180KB)、易扩展的Android滤镜和动态贴纸框架,支持摄像头、视频、图片和视图添加滤镜和贴纸。)
Stars: ✭ 155 (-61.54%)
Mutual labels:  opengl-es, filter
Camera2GLPreview
Android camera preview application using Camera2 API and OpenGL ES/Vulkan
Stars: ✭ 140 (-65.26%)
Mutual labels:  filter, opengl-es
Ios Gpuimage Plus
GPU accelerated image filters for iOS, based on OpenGL.
Stars: ✭ 217 (-46.15%)
Mutual labels:  gpuimage, filter
Ios Nbuimagepicker
Modular image picker with Simulator-compatible AVFondation camera, assets library, filters and more.
Stars: ✭ 196 (-51.36%)
Mutual labels:  gpuimage, filter
glip-lib
An OpenGL Image Processing Library (in C++/GLSL).
Stars: ✭ 14 (-96.53%)
Mutual labels:  gpu, video-processing
Magiccamera3
30+Camera different effects with C++ and opengles 3.0
Stars: ✭ 235 (-41.69%)
Mutual labels:  opengl-es, filter
laav
Asynchronous Audio / Video Library for H264 / MJPEG / OPUS / AAC / MP2 encoding, transcoding, recording and streaming from live sources
Stars: ✭ 50 (-87.59%)
Mutual labels:  video-recording, video-processing
Vuh
Vulkan compute for people
Stars: ✭ 264 (-34.49%)
Mutual labels:  glsl-shaders, gpu
Metalvideoprocess
MetalVideoProcess is a High-Performance video effects processing framework. It's base on GPUImage3 Metal, support asynchronous and multithread processing.
Stars: ✭ 52 (-87.1%)
Mutual labels:  gpuimage, video-processing
Libva
Libva is an implementation for VA-API (Video Acceleration API)
Stars: ✭ 305 (-24.32%)
Mutual labels:  video-processing, video-recording

GPUVideo-android

Platform API

This library apply video filter on generate an Mp4 and on ExoPlayer video and Video Recording with Camera2.
Android MediaCodec API is used this library.

Features

  • apply video filter, scale, and rotate Mp4.
  • apply video filter on ExoPlayer video.
  • apply video filter on Video Recording with Camera2.

apply video filter on generate an Mp4


Sample Video
No filter

GlGlayScaleFilter
apply

GlMonochromeFilter
apply

GlWatermarkFilter
apply

apply video filter on ExoPlayer video

apply video filter on Video Recording with Camera2.

Gradle

Step 1. Add the JitPack repository to your build file

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
        implementation 'com.github.MasayukiSuda:GPUVideo-android:v0.1.1'
        // if apply video filter on ExoPlayer video
        implementation 'com.google.android.exoplayer:exoplayer-core:2.9.3'
}

Sample Usage apply video filter on generate an Mp4

    new GPUMp4Composer(srcMp4Path, destMp4Path)
            .rotation(Rotation.ROTATION_90)
            .size((width) 540, (height) 960)
            .fillMode(FillMode.PRESERVE_ASPECT_FIT)
            .filter(new GlFilterGroup(new GlMonochromeFilter(), new GlVignetteFilter()))
            .listener(new GPUMp4Composer.Listener() {
                @Override
                public void onProgress(double progress) {
                    Log.d(TAG, "onProgress = " + progress);
                }

                @Override
                public void onCompleted() {
                    Log.d(TAG, "onCompleted()");
                    runOnUiThread(() -> {
                        Toast.makeText(context, "codec complete path =" + destPath, Toast.LENGTH_SHORT).show();
                    });
                }

                @Override
                public void onCanceled() {
                    Log.d(TAG, "onCanceled");
                }

                @Override
                public void onFailed(Exception exception) {
                    Log.e(TAG, "onFailed()", exception);
                }
            })
            .start();

Builder Method

method description
rotation Rotation of the movie, default Rotation.NORMAL
size Resolution of the movie, default same resolution of src movie
fillMode Options for scaling the bounds of an movie. PRESERVE_ASPECT_FIT is fit center. PRESERVE_ASPECT_CROP is center crop , default PRESERVE_ASPECT_FIT
filter This filter is OpenGL Shaders to apply effects on video. Custom filters can be created by inheriting GlFilter.java. , default GlFilter(No filter). Filters is here.
videoBitrate Set Video Bitrate, default video bitrate is 0.25 * 30 * outputWidth * outputHeight
mute Mute audio track on exported video. Default mute = false.
flipVertical Flip Vertical on exported video. Default flipVertical = false.
flipHorizontal Flip Horizontal on exported video. Default flipHorizontal = false.

Sample Usage apply video filter on ExoPlayer video

STEP 1

Create SimpleExoPlayer instance. In this case, play MP4 file.
Read this if you want to play other video formats.

    TrackSelector trackSelector = new DefaultTrackSelector();

    // Measures bandwidth during playback. Can be null if not required.
    DefaultBandwidthMeter defaultBandwidthMeter = new DefaultBandwidthMeter();
    // Produces DataSource instances through which media data is loaded.
    DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, Util.getUserAgent(context, "yourApplicationName"), defaultBandwidthMeter);
    // This is the MediaSource representing the media to be played.
    MediaSource mediaSource = new ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse(MP4_URL));

    // SimpleExoPlayer
    player = ExoPlayerFactory.newSimpleInstance(context, mediaSource);
    // Prepare the player with the source.
    player.prepare(videoSource);
    player.setPlayWhenReady(true);

STEP 2

Create GPUPlayerView and set SimpleExoPlayer to GPUPlayerView.

    gpuPlayerView = new GPUPlayerView(this);
    // set SimpleExoPlayer
    gpuPlayerView.setSimpleExoPlayer(player);
    gpuPlayerView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    // add gpuPlayerView to WrapperView
    ((MovieWrapperView) findViewById(R.id.layout_movie_wrapper)).addView(gpuPlayerView);
    gpuPlayerView.onResume();

STEP 3

Set Filter. Filters is here.
Custom filters can be created by inheriting GlFilter.java.

    gpuPlayerView.setGlFilter(new GlSepiaFilter());

Sample Usage apply video filter on Video Recording with Camera2.

SetUp on onResume method.

  sampleGLView = new GLSurfaceView(getApplicationContext());
  FrameLayout frameLayout = findViewById(R.id.wrap_view);
  frameLayout.addView(sampleGLView);
  
  gpuCameraRecorder = new GPUCameraRecorderBuilder(activity, sampleGLView)
    .lensFacing(LensFacing.BACK)
    .build();

Release on onPause method.

  sampleGLView.onPause();      

  gpuCameraRecorder.stop();
  gpuCameraRecorder.release();
  gpuCameraRecorder = null;

  ((FrameLayout) findViewById(R.id.wrap_view)).removeView(sampleGLView);
  sampleGLView = null;

Start and Stop Video record.

  // record start.
  gpuCameraRecorder.start(filepath);
  // record stop.
  gpuCameraRecorder.stop();

This filter is OpenGL Shaders to apply effects on camera preview. Custom filters can be created by inheriting GlFilter.java. , default GlFilter(No filter). Filters is here.

  gpuCameraRecorder.setFilter(GlFilter);

Other methods.

  // if flash enable, turn on or off camera flash. 
  gpuCameraRecorder.switchFlashMode();
  // autofocus change.
  gpuCameraRecorder.changeAutoFocus();
  // set focus point at manual.
  gpuCameraRecorder.changeManualFocusPoint(float eventX, float eventY, int viewWidth, int viewHeight); 
  // scale camera preview
  gpuCameraRecorder.setGestureScale(float scale);

Builder Method

method description
cameraRecordListener onGetFlashSupport, onRecordComplete, onError, and onCameraThreadFinish. Detail is here.
filter This filter is OpenGL Shaders to apply effects on camera preview. Custom filters can be created by inheriting GlFilter.java. , default GlFilter(No filter). Filters is here.
videoSize Resolution of the movie, default width=720, height=1280.
cameraSize Preview size.
lensFacing Select back or front camera. Default LensFacing.FRONT.
flipHorizontal Flip Horizontal on recorded video. Default flipHorizontal = false.
flipVertical Flip Vertical on recorded video. Default flipVertical = false.
mute Mute audio track on recorded video. Default mute = false.
recordNoFilter No Filter on recorded video although preview apply a filter. Default recordNoFilter = false.

Filters

  • Bilateral
  • BoxBlur
  • Brightness
  • BulgeDistortion
  • CGAColorspace
  • Contrast
  • Crosshatch
  • Exposure
  • FilterGroup
  • Gamma
  • GaussianBlur
  • GrayScale
  • Halftone
  • Haze
  • HighlightShadow
  • Hue
  • Invert
  • LookUpTable
  • Luminance
  • LuminanceThreshold
  • Monochrome
  • Opacity
  • Overlay
  • Pixelation
  • Posterize
  • RGB
  • Saturation
  • Sepia
  • Sharpen
  • Solarize
  • SphereRefraction
  • Swirl
  • ToneCurve
  • Tone
  • Vibrance
  • Vignette
  • Watermark
  • WeakPixelInclusion
  • WhiteBalance
  • ZoomBlur

References And Special Thanks to

Sample Dependencies

License

MIT License

ExoPlayer and ExoPlayer demo.

Copyright (C) 2014 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].