如何利用媒体codeC的Android对COM preSS MP4视频? [英] How to compress mp4 video using MediaCodec Android?
问题描述
在我的Android应用程序,我想COM preSS MP4视频通过改变它的分辨率,码率。我不希望使用FFmpeg的(因为我不希望使用NDK),所以我决定用媒体codeC API。
In my Android app, I want to compress mp4 video by changing its resolution, bitrate. I don't want to use FFmpeg (because I don't want to use NDK), so I decided to use MediaCodec API.
下面是我的逻辑步骤:
- 与MediaExtractor提取视频文件,然后去code数据。
- 创建新的连接codeR与我的新决议,比特率和连接code数据。
- 使用MediaMuxer创建一个新的MP4文件。
我的问题是:我不知道如何设置的去codeR输出和连接codeR输入之间的连接。我可以去$ C C视频$到地面或EN codeA从表面新的视频。但我不知道如何将它们连接起来。
My problem is: I don't know how to setup the connection between output of decoder and input of encoder. I can decode the video to a Surface or encode a new video from a surface. But I don't understand how to connect them.
我读到这些链接: Android的媒体codeC:减少MP4视频大小,<一个href="http://stackoverflow.com/questions/15950610/video-com$p$pssion-on-android-using-new-media$c$cc-library">Video COM pression在Android上使用新媒体codeC图书馆并从Bigflake的例子:<一href="https://android.googlesource.com/platform/cts/+/jb-mr2-release/tests/tests/media/src/android/media/cts/De$c$cEditEn$c$cTest.java">https://android.googlesource.com/platform/cts/+/jb-mr2-release/tests/tests/media/src/android/media/cts/De$c$cEditEn$c$cTest.java
I read these links: Android MediaCodec: Reduce mp4 video size, Video compression on android using new MediaCodec Library and the example from Bigflake: https://android.googlesource.com/platform/cts/+/jb-mr2-release/tests/tests/media/src/android/media/cts/DecodeEditEncodeTest.java
任何人都可以给我一个明确的解释,我有什么做的?
Can anybody give me a clear explanation what I have to do?
推荐答案
我已经使用这个来看看如何操纵机器人视频:的 https://github.com/hoolrory/AndroidVideoSamples ,检查<一href="https://github.com/hoolrory/AndroidVideoSamples/blob/master/CommonVideoLibrary/src/com/roryhool/commonvideolibrary/VideoResampler.java%20'VideoResampler.java'"相对=nofollow> VideoResampler.java
在 CommonVideoLibrary
。
I have used this to see how to manipulate video in android: https://github.com/hoolrory/AndroidVideoSamples , check the VideoResampler.java
in the CommonVideoLibrary
.
这篇关于如何利用媒体codeC的Android对COM preSS MP4视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!