hi, i tried recording but return the error org.bytedeco.javacv.FrameRecorder$Exception: avio_open error() error -13: Could not open '/storage/emulated/0/stream.mp4'
i use this https://github.com/bytedeco/sample-projects/blob/master/JavaCV-android-example/app/src/main/java/org/bytedeco/javacv_android_example/record/RecordActivity.java
and another question , i wanna know , can i recording voice when playing music with javacv?
Please also provide the error message that shows up on the console.
org.bytedeco.javacv.FrameRecorder$Exception: avio_open error() error -13: Could not open '/storage/emulated/0/stream.mp4'
at org.bytedeco.javacv.FFmpegFrameRecorder.startUnsafe(FFmpegFrameRecorder.java:700)
at org.bytedeco.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:294)
at com.javactest.RecordActivity.startRecording(RecordActivity.java:237)
at com.javactest.RecordActivity.onClick(RecordActivity.java:316)
at android.view.View.performClick(View.java:4466)
at android.view.View$PerformClick.run(View.java:18537)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
I said _on the console_, but you're using Android here, so please call FFmpegLogCallback.set() and check the error messages that appear in the Android log.
sorry for mistake
I/System.out: Output #0, mp4, to '/storage/emulated/0/stream.mp4':
I/System.out: Output #0, mp4, to '/storage/emulated/0/stream.mp4':
I/System.out: Stream #0:0
I/System.out: Stream #0:0
I/System.out: : Unknown: none (mpeg4)
I/System.out: : Unknown: none (mpeg4)
I/System.out: Stream #0:1
I/System.out: Stream #0:1
I/System.out: : Unknown: none (aac)
I/System.out: : Unknown: none (aac)
I/System.out: [aac @ 0x54fb8920] Qavg: NaN
I/System.out: [aac @ 0x54fb8920] Qavg: NaN
It just looks like your app doesn't have write access to the storage...
i set permission in run time and fix it ,another question , i can mixing 2 audio with javacv ?
Thank for answer
We could easily do that with FFmpegFrameFilter, but we first need to add support for audio frames. Please consider making a contribution
Support for audio frames has been added so please give it a try with JavaCV 1.4.2-SNAPSHOT: http://bytedeco.org/builds/
We can use amovie with the amix filter to mix 2 audio streams.
Hi @saudet , Do you have an FFmpegFrameFilter sample to add additional audio to a video?
FFmpegFrameFilter("movie=" + video.mp4 + " + ???", outPutWith, outPutHeight);
Thank you :)
@huunhan18pro If amovie doesn't work because you need to input multiple frames from some other source, that's something that still needs to be done, see issue #955.
I found a command to add background music to a video but I don't know how to do like that by this library. :(
String cmd = "-i video -i audio -filter_complex [0:a]volume=1[a0];[1:a]volume=1[a1];[a0][a1]amix=inputs=2[a] -map 0:v -map [a] -c:v copy -c:a aac";
@huunhan18pro filter_complex -> Again, this is issue #955.
I've implemented support for multiple inputs in commit https://github.com/bytedeco/javacv/commit/3c92eef6e3aa21eca170fc8022fd41254cfcc452, so we can now use a filter graph like [0:a][1:a]amix=inputs=2[a], which should do the same thing as amerge as used in this sample code: https://github.com/bytedeco/javacv/blob/master/platform/src/test/java/org/bytedeco/javacv/FrameFilterTest.java#L163
Please give it a try with the snapshots: http://bytedeco.org/builds/ Thanks!