-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FFmpegFrameRecorder doesn't generate video file in android versions 10 or higher #64
Comments
If you can't use the File API in your application, we can use OutputStream with FFmpegFrameRecorder. |
Sure, I have adopted the code to use OutputStream with FFmpegFrameRecorder like this.
Now when I start the recording I have the following error avformat_write_header error() error -22: Could not write header to 'java.io.FileOutputStream@80a7537' (For more details, make sure FFmpegLogCallback.set() has been called.) Am I missing something? that could be happening ? |
The MP4 format doesn't support streams well. Try to use another format. |
Thanks, I solved it by changing it to mkv format but I still have a problem. When I open the generated video, the total duration of the video is greater than what is actually played. In other words, if I record a 6-second video in the player, I get a 10-second video but it only plays up to 6 seconds.
I'm not sure if I'm missing something to configure. |
It's possible that's a limitation of your video player. Do you get the same result with some other known good player like VLC? |
Not with VLC the time is correct, I guess it's because of the video format that my video player doesn't work well. Thanks for the help. |
I see, I'm sure it's possible to hack something with FFmpeg by modifying FFmpegFrameRecorder itself to make it output what you need, but someone's going to need to spend some time experimenting with that... |
Hello,
I have been trying the example the example JavaCV-android-example but found that it doesn't work for Android version 10 or higher, the video file (.mp4) is not created when the recording is complete.
I'm kind of new to android development but I think the problem is occurring because FFmpegFrameRecorder needs to be passed an instance of FILE that is the .mp4 video file, however, in new versions of Android (10 or higher) the creation of files no longer works that way and the MediaStore API should be used.
So far I haven't been able to figure out how to fix this problem. Does someone know how to solve this problem?
The text was updated successfully, but these errors were encountered: