通过 ffmpeg 修剪 Android 视频 [英] Android video trimming via ffmpeg
问题描述
我已从 此链接从 github 下载了视频修剪代码.
I have downloaded video trimming code from github from this link.
它第一次运行完美,但是当我第二次尝试运行它时,代码毫无异常地崩溃,然后当我在崩溃后第三次尝试运行它时,它再次运行!有没有人对这种行为有任何想法?
It’s working perfectly for the first time, but when I try to run it for the second time the code crashes without any exception then again when I try to run it for the 3rd time after the crash it works! Does any one have any idea for this kind of behaviour?
我也在开发一个应用程序,它有一个剪辑视频模块.如果有人可以帮助我,我将不胜感激.
I am also developing an application which has one module of trimming videos. I would really appreciate it, if any one could help me .
推荐答案
https://lists.ffmpeg.org/pipermail/libav-user/2012-May/001964.html
调用Activity中第三方库的native方法两次导致Android应用关闭
阅读有关ffmpeg.c"中静态变量的问题...
read about the issue with static vars in 'ffmpeg.c' ...
我敢打赌,你有同样的问题,需要做一些事情(3 个替代选择)来重置或 GC 那些变量:
I would bet that u have the same problem and need to do something (3 alternate choices) to reset or GC those vars:
获取加载 lib 的 java 类加载器并对其进行 GC
get the java classloader that loaded the lib and GC it
在 c 层执行 OP 在上述链接中所做的操作
in the c-layer do what the OP did in above link
编写第二个共享库,在每个调用周期中在第一个库上使用dlsym"和dlclose"
write a 2nd shared lib that uses 'dlsym' and 'dlclose' on the first library during each call cycle
github,请参阅自述文件"这里
github , see the 'README' here
你遇到的同样的问题
这篇关于通过 ffmpeg 修剪 Android 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!