简体   繁体   English

如何修剪android中的视频(没有ffmpeg)?

[英]How to trim video in android (without ffmpeg)?

Hi I am trying to trim video in android, but all of the source codes I have found are using ffmpeg, is there a smaller library, which I can use ? 嗨,我想在Android中修剪视频,但我发现的所有源代码都使用ffmpeg,是否有一个较小的库,我可以使用它? Because ffmpeg library is about 8-9 MB, and my application is about 6 MB, adding ffmpeg library to my app will make it more than double size. 因为ffmpeg库大约是8-9 MB,而我的应用程序大约是6 MB,所以将ffmpeg库添加到我的应用程序将使它超过双倍大小。

You can do this with mp4parser library. 您可以使用mp4parser库执行此操作 Have a look at the ShortenExample it does exactly what the name suggests. 看看ShortenExample它完全符合名称的建议。 Since the library cannot re-encode the video it can only cut the video at I-frames. 由于图书馆无法对视频进行重新编码,因此只能以I帧剪切视频。 So the points in time where you can make a cut are quite coarse. 因此,您可以进行切割的时间点非常粗糙。

On Android 4.1 you can access the hardware codecs via MediaCodec API which could be an option (but I haven't seen any example of that yet) 在Android 4.1上,您可以通过MediaCodec API访问硬件编解码器,这可能是一个选项(但我还没有看到任何示例)

Or, you can use this class: TrimVideoUtils.java 或者,您可以使用此类: TrimVideoUtils.java

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM