Android sdk 剪切/修剪视频文件 [英] Android sdk cut/trim video file

查看:33
本文介绍了Android sdk 剪切/修剪视频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以在 android 上剪切视频(mp4 或 3gp),比如只使用电影的最后 5 秒......在 iphone 上这可以使用 AVAssetExportSession 但在 android 上我没有找到类似的,也许只是对 ffmpeg 库的一些引用,这看起来很复杂.有没有更简单的方法?

Is there any way to cut a video (mp4 or 3gp) on android, like use only the last 5 seconds of the movie... on iphone this is possible using the AVAssetExportSession but on android I haven't found anything similar, just maybe some references to ffmpeg library which seems complicated. Is there any easier way to do it?

推荐答案

你可以用我的 mp4parser 图书馆.看看 ShortenExample 它完全符合名称的含义.由于库无法重新编码视频,因此只能以 I 帧剪切视频.因此,您可以进行切割的时间点非常粗糙.

You can do this with my mp4parser library. Have a look at the ShortenExample it does exactly what the name suggests. Since the library cannot re-encode the video it can only cut the video at I-frames. So the points in time where you can make a cut are quite coarse.

在 Android 4.1 上,您可以通过 MediaCodec API 访问硬件编解码器,这可能是一个选项(但我还没有看到任何示例)

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 sdk 剪切/修剪视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆