I have ported ffmpeg library to Android. Using JNI interface, I am able to run ffmpeg commands by giving arguments to ffmpeg's main method, just like from command line.
In order to get a specific part of a video, I use this command :
ffmpeg -i /mnt/sdcard/input_video.mp4 -ss 00:00:12 -t 00:00:10 -an /mnt/sdcard/output_video.mp4
and it works great. The video is split from 12. seconds to 22. seconds and the video is saved, the method returns normally (as 0).
However, if I make a second similar call (different start time for example) just after the first one is completed, ffmpeg is not able to process the request and it throws a segmentation fault.
For the first call, it gives such an info :
Guessed Channel Layout for Input Stream #0.0 : mono
and works. But for the second, the message is like this one:
Guessed Channel Layout for Input Stream #1.0 : mono
and it doesn't work. I don't know if it has something to do with the error.
The problem, in general, should be related to static global variables (I think) but I could not manage to reset them properly. What might be the solution to make multiple successful calls to the main method of ffmpeg?