Giter Club home page Giter Club logo

ffmpegrecorder's Introduction

FFmpegRecorder

Screenshot

This is an Android video recorder that supports:

  • Pause and resume when recording like Vine
  • Crop and scale the output video to designated size
  • Support both portrait and landscape orientation

These core features use FFmpegFrameRecorder, FFmpegFrameFilter from JavaCV.

Credits

License

Copyright 2016 Lei Wang

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.

ffmpegrecorder's People

Contributors

awenblue avatar bitdeli-chef avatar crazyorr avatar

Stargazers

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

Watchers

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

ffmpegrecorder's Issues

How can i export this application to aar library

I want to use FFmpegRecordActivity from Nativescript.
For that I have to export application to aar library and call FFmpegRecordActivity class from javascript via Intent.

I did that part It worked.

But after FFmpegRecordActivity is displayed it breaks with this error.

java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:309)
at org.bytedeco.javacpp.Loader.load(Loader.java:413)
at org.bytedeco.javacpp.Loader.load(Loader.java:381)
at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1650)

It seems not nativescript problem. Because same thing happened when i import aar from another android studio application.

camera, external storage permissions are given and on for application


I did the trick from bytedeco/javacv#133 : moved *.so files to "app/src/main/jniLibs/armeabi-v7a" and "app/src/main/jniLibs/armeabi" folders and it seems not working

Works quite bad for 1080p

Though default MediaRecorder works fine with 1080p video resolution

Can this project optimized for higher resolutions as well?

Now I clearly can see lugs

App crashes sometimes when I press done button (to finish recording)

05-19 13:43:25.285 17113-30204/com.github.crazyorr.ffmpegrecorder A/libc: Fatal signal 8 (SIGFPE), code -6, fault addr 0x42d9 in tid 30204 (Thread-31252)
05-19 13:43:25.305 17113-30278/com.github.crazyorr.ffmpegrecorder A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 30278 (AsyncTask #6)
05-19 13:43:25.346 6507-6507/? A/DEBUG: pid: 17113, tid: 30204, name: Thread-31252  >>> com.github.crazyorr.ffmpegrecorder <<<
05-19 13:43:25.375 6507-6507/? A/DEBUG:     #03 pc 0000e8a4  /data/app/com.github.crazyorr.ffmpegrecorder-1/lib/arm/libswresample.so
05-19 13:43:25.375 6507-6507/? A/DEBUG:     #04 pc 0000b868  /data/app/com.github.crazyorr.ffmpegrecorder-1/lib/arm/libswresample.so
05-19 13:43:25.375 6507-6507/? A/DEBUG:     #05 pc 0000c388  /data/app/com.github.crazyorr.ffmpegrecorder-1/lib/arm/libswresample.so
05-19 13:43:25.375 6507-6507/? A/DEBUG:     #06 pc 0000d600  /data/app/com.github.crazyorr.ffmpegrecorder-1/lib/arm/libswresample.so (swr_convert+2360)
05-19 13:43:25.376 6507-6507/? A/DEBUG:     #07 pc 0001503d  /data/data/com.github.crazyorr.ffmpegrecorder/cache/slice-ffmpeg-3.2.1-1.3_e3128a5b50aeace251d3aa308a4b04261bbb0d49-classes.dex (offset 0x50000)
05-19 13:43:26.109 1501-1683/? E/InputDispatcher: channel 'd65a8c8 com.github.crazyorr.ffmpegrecorder/com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

About OOM

Hi,Thanks for your help, I encountered a new problem in your demo, I recorded the time to reach 20 seconds after the emergence of OOM,Look forward to your reply.

image

i can't record video with 30fps

i try to set private int frameRate = 30;
i want to record video 360x360 so i set
private int videoWidth = 360;
private int videoHeight = 360;
the result video always from 22 to 25.
what i can do to increase frame to exacly when i set at private int frameRate.
ps: i try to change private static final int PREFERRED_PREVIEW_WIDTH = 640;
private static final int PREFERRED_PREVIEW_HEIGHT = 360;
i try different value and i realize fps down when i change it..some time i got only 16 17
ps:thanks for your help and iam so sorry for my bad English

FC when set targetSdkVersion 23 or above

Hi
i'm using your project, but found that when i set my project targetSdkVersion is 23 or above, it's will FC.
but when i set targetSdkVersion is 22, it's ok.
Could u please help me have check?

Record video with mirror effect

I want to record video with mirror effect for front camera using this recorder, is this possible? If it is please help
thank you

用东西挡住摄像头,让Preview里面是全黑,不一会就OOM

Process: com.github.crazyorr.ffmpegrecorder, PID: 10415
java.lang.OutOfMemoryError: Failed to allocate memory within limits: totalBytes = 95M + 600K > maxBytes = 96M
at org.bytedeco.javacpp.Pointer.deallocator(Pointer.java:558)
at org.bytedeco.javacpp.Pointer.init(Pointer.java:121)
at org.bytedeco.javacpp.BytePointer.allocateArray(Native Method)
at org.bytedeco.javacpp.BytePointer.<init>(BytePointer.java:82)
at org.bytedeco.javacv.FFmpegFrameRecorder.recordImage(FFmpegFrameRecorder.java:778)
at org.bytedeco.javacv.FFmpegFrameRecorder.record(FFmpegFrameRecorder.java:756)
at org.bytedeco.javacv.FFmpegFrameRecorder.record(FFmpegFrameRecorder.java:749)

正常情况,我从AS 的Monitor看内存走势,开始录制不久就会有内存抖动,但是回收很正常,不会OOM。
image

我把摄像头挡住,Preview里面是全黑的时候,看Monitor。 内存不抖,涨得很慢,但是不回收,然后就直接OOM. 大概1分钟的时候。

image

How can I improve the video quality?

I have used this library fro my video record app. But video's quality is so bad and video frames not progressing smoothly. What is the best parameters for good quality?

how can i set video quality

private int videoWidth = 1280;
private int videoHeight = 720;
private int frameRate = 30;
private int frameDepth = Frame.DEPTH_UBYTE;
private int frameChannels = 2;

i set videoHeight and videoWidth for hd quality but output video is too bad.

how can i improve the quality?

long recording and encoding delay

I found that the recording is so long delayed by encoding into video.
The mRecordedFrameQueue is behind the preview so much. So, I should wait a long time after I press the stop button which invoke the stopRecording().
Is there any solution to solve this ?

Video capture orientation not handled proper

I have been doing R & D on capturing video in square format and output for the same. Library does meet the requirements but the issue is whenever i capture video with portrait/landscape mode then resulting video is not rotating as per screen like native recorder.

device-2018-01-04-144441

Please let me know what needs to be done here to overcome orientation problem. If I get success then I will do PR for contribution.

Device info : Moto G play Android 6.0

full screen preview

Hi, how to set initialize full screen with correct ratio and best resolution in any device and camera?

Reset the state

Hi guy
Additional, how to reset the state?
In the example, we must recreate the activity.
Could u please add a reset state method in the next version?

OutOfMemoryError: Failed to allocate memory within limits

Dear CrazyOrr:
I use this Project, after recording 1 minutes will be crash, the reason is java.lang.OutOfMemoryError: Failed to allocate memory within limits: totalBytes = 255M + 112K > maxBytes = 256M
do you have some good suggestions to correct this error
Thanks very much

camera does not starts

Hello Sir
When i starts my video recording activity camera does not starts, even when i starts or stops recoding.
issue

Conflict between gradle dependencies - Android Studio (Unsatisfied link Error)

Hi,

I am using:
Android Studio 3.0.1
minSdkVersion 21
targetSdkVersion 27

Following are the dependencies I am using along with javacpp:

dependencies {
implementation 'com.github.yalantis:ucrop:2.2.1-native'
implementation 'com.amazonaws:aws-android-sdk-core:2.2.+'

  compile(group: 'org.bytedeco', name: 'javacv-platform', version: '1.3') {
        exclude group: 'org.bytedeco.javacpp-presets'
    }
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: versions.ffmpeg
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: versions.ffmpeg, classifier: 'android-arm'
}
ext {
    versions = [
            'ffmpeg': '3.2.1-1.3'
    ]
}

Following is the error that I am getting which points to mFrameRecorder = new FFmpegFrameRecorder(mVideo, videoWidth, videoHeight, 1); :

com.github.crazyorr.ffmpegrecorder E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.github.crazyorr.ffmpegrecorder, PID: 18887
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at org.bytedeco.javacpp.Loader.load(Loader.java:585)
at org.bytedeco.javacpp.Loader.load(Loader.java:530)
at org.bytedeco.javacpp.avcodec$AVPacket.(avcodec.java:1694)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:149)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:129)
at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity.initRecorder(FFmpegRecordActivity.java:421)
at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity.access$1100(FFmpegRecordActivity.java:51)
at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity$5.doInBackground(FFmpegRecordActivity.java:287)
at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity$5.doInBackground(FFmpegRecordActivity.java:282)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
at java.lang.Thread.run(Thread.java:818) 

Audio synchronization issue

Hi Lei,

i noticed that when i try to record a video with multiple parts, an audio in the resulting video file is not syncing correctly with all video parts. It seems to be the audio is not cropped accurately while recording.
Do you know about this issue and do you plan to fix it?

Thanks.

Wrong orientation in pad when portrait the pad

Dear CrazyOrr
Now, i'm adapter the pad for my app. And current we potrait the app in pad and phone.
But in pad, we preview the camera is portrait, it's ok, but when we preview the video result, it's landscape, could u please help to solve it?
Many thanks.

java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil

It is working fine in kitkat but in marshmallow i'm getting this error:

FATAL EXCEPTION: AsyncTask #1
                                                                                    Process: com.github.crazyorr.ffmpegrecorder, PID: 22199
                                                                                    java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                                                        at android.os.AsyncTask$3.done(AsyncTask.java:309)
                                                                                        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
                                                                                        at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
                                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                                        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                                        at java.lang.Thread.run(Thread.java:818)
                                                                                     Caused by: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
                                                                                        at java.lang.Class.classForName(Native Method)
                                                                                        at java.lang.Class.forName(Class.java:324)
                                                                                        at org.bytedeco.javacpp.Loader.load(Loader.java:585)
                                                                                        at org.bytedeco.javacpp.Loader.load(Loader.java:530)
                                                                                        at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1694)
                                                                                        at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)
                                                                                        at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:129)
                                                                                        at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity.initRecorder(FFmpegRecordActivity.java:415)
                                                                                        at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity.access$1100(FFmpegRecordActivity.java:50)
                                                                                        at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity$5.doInBackground(FFmpegRecordActivity.java:288)
                                                                                        at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity$5.doInBackground(FFmpegRecordActivity.java:283)
                                                                                        at android.os.AsyncTask$2.call(AsyncTask.java:295)
                                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                                                                                        at java.lang.Thread.run(Thread.java:818) 

Video is green color using avutil.AV_PIX_FMT_NV21 format

setting the pixel format:

    FFmpegFrameFilter frameFilter = new FFmpegFrameFilter(TextUtils.join(",", filters),
                    previewWidth, previewHeight);
            frameFilter.setPixelFormat(AV_PIX_FMT_NV21);
mFrameRecorder.record(filteredFrame);

build.gradle

ext {
    versions = [
            'ffmpeg': '3.4.1-1.4'
    ]
}

    compile(group: 'org.bytedeco', name: 'javacv-platform', version: '1.4') {
        exclude group: 'org.bytedeco.javacpp-presets'
    }

    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: versions.ffmpeg
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: versions.ffmpeg, classifier: 'android-arm'

Tried the following too, but no luck:
1.

 mFrameRecorder.setPixelFormat(avutil.AV_PIX_FMT_NV21);
FFmpegFrameFilter frameFilter = new FFmpegFrameFilter(TextUtils.join(",", filters),
                    previewWidth, previewHeight);
            frameFilter.setPixelFormat(AV_PIX_FMT_NV21);
mFrameRecorder.record(filteredFrame);

2.

mFrameRecorder.setPixelFormat(avutil.AV_PIX_FMT_NV21);
FFmpegFrameFilter frameFilter = new FFmpegFrameFilter(TextUtils.join(",", filters),
                    previewWidth, previewHeight);
            frameFilter.setPixelFormat(AV_PIX_FMT_NV21);
mFrameRecorder.record(filteredFrame,AV_PIX_FMT_NV21);

 mFrameRecorder.record(filteredFrame,avutil.AV_PIX_FMT_NV21);

Set FFmpegRecorder in half screen layout

screenshot_2017-11-03-14-37-14
i want to implement FFmpegRecorder in this custom layout, means first half is image and second half is FFmpegREcorder. I have tried to implement from sample project but i am getting following error

java.lang.ArithmeticException: / by zero
at customecamera.com.ffmpegcamera.FixedRatioCroppedTextureView.onMeasure_Original(FixedRatioCroppedTextureView.java:40)
at customecamera.com.ffmpegcamera.FixedRatioCroppedTextureView.onMeasure(FixedRatioCroppedTextureView.java)
at android.view.View.measure(View.java:22035)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6622)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at customecamera.com.ffmpegcamera.FixedAspectRatioFrameLayout.onMeasure_Original(FixedAspectRatioFrameLayout.java:68)
at customecamera.com.ffmpegcamera.FixedAspectRatioFrameLayout.onMeasure(FixedAspectRatioFrameLayout.java)
at android.view.View.measure(View.java:22035)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:22035)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6622)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:22035)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6622)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:22035)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:22035)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6622)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure_Original(ContentFrameLayout.java:139)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java)
at android.view.View.measure(View.java:22035)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6622)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure_Original(ActionBarOverlayLayout.java:400)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java)
at android.view.View.measure(View.java:22035)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:22035)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:590)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:343)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:384)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:547)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$3(RenderTask.java:681)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
waiting for reply..

Capture picture

Is there any option to capture picture using this library?

App crashes after starting the recording

Hi i have used this demo project and increased but have increased PREFERRED_PREVIEW_WIDTH and PREFERRED_PREVIEW_HEIGHT but i am getting this error everytime

com.github.crazyorr.ffmpegrecorder A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 
0xde258000 in tid 29247 (Thread-667)

Please help

Recorder preview issue

In vertical mode recorder is showing proper preview and saving video in proper ratio, but when i am trying to shoot video horizontally, video preview is getting stretched vertically but getting saved in correct ratio. I need to handle the stretch in preview in horizontal mode.

About java.lang.UnsatisfiedLinkError

Hi,CrazyOrr:

Thank you for sharing the code,But I have some problems with porting your code, 

I used the Android Studio to import your project with the following error:
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
Process: com.ksyun.live.demo, PID: 26297
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at org.bytedeco.javacpp.Loader.load(Loader.java:585)
at org.bytedeco.javacpp.Loader.load(Loader.java:530)
at org.bytedeco.javacpp.avcodec$AVPacket.(avcodec.java:1694)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:149)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:129)
at com.ksyun.media.streamer.demo.CameraActivity.initRecorder(CameraActivity.java:607)
at com.ksyun.media.streamer.demo.CameraActivity.access$1000(CameraActivity.java:93)
at com.ksyun.media.streamer.demo.CameraActivity$3.doInBackground(CameraActivity.java:493)
at com.ksyun.media.streamer.demo.CameraActivity$3.doInBackground(CameraActivity.java:488)
at android.os.AsyncTask$2.call(AsyncTask.java)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:818) 

This error appears on any phone!

Look forward to your reply!

libjniavutil.so: unused DT entry: type 0xf arg 0x18b9d

.ffmpegrecorder W/linker: /data/app/com.github.crazyorr.ffmpegrecorder-1/lib/arm/libjniavutil.so: unused DT entry: type 0xf arg 0x18b9d
05-08 20:04:03.393 6712-6775/com.github.crazyorr.ffmpegrecorder I/art: Rejecting re-init on previously-failed class java.lang.Class<org.bytedeco.javacpp.avutil>
05-08 20:04:03.397 6712-6775/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.github.crazyorr.ffmpegrecorder, PID: 6712
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at org.bytedeco.javacpp.Loader.load(Loader.java:585)
at org.bytedeco.javacpp.Loader.load(Loader.java:530)
at org.bytedeco.javacpp.avcodec$AVPacket.(avcodec.java:1694)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:149)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:129)
at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity.initRecorder(FFmpegRecordActivity.java:415)
at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity.access$1100(FFmpegRecordActivity.java:50)
at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity$5.doInBackground(FFmpegRecordActivity.java:288)
at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity$5.doInBackground(FFmpegRecordActivity.java:283)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
at java.lang.Thread.run(Thread.java:818) 

Lib so not installed to apk

The first of all , I try to install your project to my device then I can run it. When I try to install javacv by gradle dependencies , I can not use because UnsatisfiedLinkError exception. I try to monitor by Naive Lib Monitor . Lib so have inside in my apk but it didn't install to my apk. Thank

App crashing on Switch and Resume recording

Firstly, Its a great sample exactly what I was looking for.

I have to integrate a similar recorder but I am facing a crash which occurs sometimes and does not provide a detail log about it.
Please see the logs below:

com.github.crazyorr.ffmpegrecorder D/FFmpegRecordActivity: Preview frame interval: 46ms
com.github.crazyorr.ffmpegrecorder V/FFmpegRecordActivity: bufferReadResult: 3584
com.github.crazyorr.ffmpegrecorder A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8f07ce80 in tid 3484 (Thread-5)
                                                                        
                                                                        [ 02-12 12:47:53.949 25422:25422 W/         ]
                                                                        debuggerd: handling request: pid=3233 uid=10069 gid=10069 tid=3484
com.github.crazyorr.ffmpegrecorder D/FFmpegRecordActivity: Preview frame interval: 54ms
com.github.crazyorr.ffmpegrecorder A/libc: failed to resend signal during crash: Operation not permitted

This crash occurs 5 out of 8 times and usually when I pause and switch and resume again for recording or when clicking Done.

ext {
    versions = [
            'ffmpeg': '3.2.1-1.3'
    ]
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile(group: 'org.bytedeco', name: 'javacv-platform', version: '1.4') {
        exclude group: 'org.bytedeco.javacpp-presets'
    }
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: versions.ffmpeg
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: versions.ffmpeg, classifier: 'android-arm'

    compile 'com.github.bumptech.glide:glide:3.7.0'
}

Thanks in advance!!

Different recording speeds

Hi,

Is it possible to record video at different fps? For example I would like to record video at 120fps.

Thank you!

Exception while initialization on FFmpegFrameRecorder

i am getting following error on initialization
mFrameRecorder = new FFmpegFrameRecorder(mVideo, videoWidth, videoHeight, 1);

E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #6
Process: com.ormatheapp, PID: 7325
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.ExceptionInInitializerError
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:149)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:129)
at com.ormatheapp.CreateOrmaActivity.initRecorder(CreateOrmaActivity.java:524)
at com.ormatheapp.CreateOrmaActivity.access$1400(CreateOrmaActivity.java:57)
at com.ormatheapp.CreateOrmaActivity$7.doInBackground(CreateOrmaActivity.java:396)
at com.ormatheapp.CreateOrmaActivity$7.doInBackground(CreateOrmaActivity.java:391)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:841) 
Caused by: java.lang.TypeNotPresentException: Type org/bytedeco/javacpp/avcodec not present
at java.lang.Class.getDeclaringClass(Native Method)
at org.bytedeco.javacpp.Loader.getEnclosingClass(Loader.java:204)
at org.bytedeco.javacpp.Loader.load(Loader.java:567)
at org.bytedeco.javacpp.Loader.load(Loader.java:530)
at org.bytedeco.javacpp.avcodec$AVPacket.(avcodec.java:1694)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:149) 
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:129) 
at com.ormatheapp.CreateOrmaActivity.initRecorder(CreateOrmaActivity.java:524) 
at com.ormatheapp.CreateOrmaActivity.access$1400(CreateOrmaActivity.java:57) 
at com.ormatheapp.CreateOrmaActivity$7.doInBackground(CreateOrmaActivity.java:396) 
at com.ormatheapp.CreateOrmaActivity$7.doInBackground(CreateOrmaActivity.java:391) 
at android.os.AsyncTask$2.call(AsyncTask.java:288) 
at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:841) 
kindly help or suggest to solve this issue
i have added all the dependency on my gradle file

Error in android sdklevel 26

hi all

when i use the libraries and code in a project with SDK version 26 , an error appears on
mFrameRecorder = new FFmpegFrameRecorder(mVideo, videoWidth, videoHeight, 1);

the log :
01-03 12:25:10.401 11112-11112/com.github.crazyorr.ffmpegrecorder E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.github.crazyorr.ffmpegrecorder, PID: 11112
java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at org.bytedeco.javacpp.Loader.load(Loader.java:585)
at org.bytedeco.javacpp.Loader.load(Loader.java:530)
at org.bytedeco.javacpp.avcodec$AVPacket.(avcodec.java:1694)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:149)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:129)
at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity.initRecorder(FFmpegRecordActivity.java:566)
at com.github.crazyorr.ffmpegrecorder.FFmpegRecordActivity.onCreate(FFmpegRecordActivity.java:264)
at android.app.Activity.performCreate(Activity.java:5977)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2258)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5272)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)

java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.hcf.client/app_lib/libavutil.so" is 32-bit instead of 64-bit

添加
ReLinker.log(logger).recursively().loadLibrary(this, "avdevice");
ReLinker.log(logger).recursively().loadLibrary(this, "avfilter");
ReLinker.log(logger).recursively().loadLibrary(this, "avformat");
ReLinker.log(logger).recursively().loadLibrary(this, "jniavutil");
ReLinker.log(logger).recursively().loadLibrary(this, "avutil");
ReLinker.log(logger).recursively().loadLibrary(this, "postproc");
ReLinker.log(logger).recursively().loadLibrary(this, "swscale");
ReLinker.log(logger).recursively().loadLibrary(this, "swresample");
ReLinker.log(logger).recursively().loadLibrary(this, "jniavdevice");
ReLinker.log(logger).recursively().loadLibrary(this, "jniavfilter");
ReLinker.log(logger).recursively().loadLibrary(this, "jniavformat");
ReLinker.log(logger).recursively().loadLibrary(this, "jnipostproc");
ReLinker.log(logger).recursively().loadLibrary(this, "jniswresample");
ReLinker.log(logger).recursively().loadLibrary(this, "jniswscale");
ReLinker.log(logger).recursively().loadLibrary(this, "jniavcodec");
ReLinker.log(logger).recursively().loadLibrary(this, "avcodec");

运行的时候 又报上面的错,

我用的是 minSdkVersion 15
targetSdkVersion 26
buildToolsVersion "26.0.2"

UnsatisfiedLinkError: org.bytedeco.javacpp.avutil

Dear

Now, i'm using latest code, but in some platform(eg. Meizu 6.0+), it crash with following message.
I don't know how to handle it...

Caused by: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at org.bytedeco.javacpp.Loader.load(Loader.java:474)
at org.bytedeco.javacpp.Loader.load(Loader.java:419)
at org.bytedeco.javacpp.avcodec$AVPacket.(avcodec.java:1559)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:149)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:129)

After Video recording preview video quality is lagging .

 private int sampleAudioRateInHz = 44100;    
 private int frameRate = 30;

   mFrameRecorder.setFormat("mp4");
    mFrameRecorder.setSampleRate(sampleAudioRateInHz);
    mFrameRecorder.setFrameRate(frameRate);

    // Use H264
    mFrameRecorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
    mFrameRecorder.setVideoOption("crf", "14");
    mFrameRecorder.setVideoOption("preset", "ultrafast");
    mFrameRecorder.setVideoOption("tune", "film");

Video streaming is not proper

In some device FFmpegRecorder is not recording video properly means it stuck while recording and playing.
Device names are oneplus x , 3s prime
can you help me out for some video recorder configuration in library.

APK is too large

The single record demo APK is about 12.7M,too large to integrate into a project.Any way to shrink the size?

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.