ffmpeg实战教程(六)Android CMake实现解码(MP4转YUV)

在前面的文章中我们用ffmpeg在windows上实现了多种功能,下面系列的文章我们将移植到Android系统上实现。

我们将使用最新版:

最新版ffmpeg ffmpeg3.3
新版Android studio Android studio2.3
新版JNI编译方式 CMake

对于Android开发者或许对C/C++/JNI知识不够了解。

可以先看这里:

C语言小结http://blog.csdn.net/king1425/article/details/70256764
C++小结(一)http://blog.csdn.net/king1425/article/details/70260091
JNI高阶知识总结http://blog.csdn.net/king1425/article/details/71405131

下面我们开始实现今天的功能:

1.编译Android版ffmpeg并移植到Android studio中

看这里:
windows下编译最新版ffmpeg3.3-android,并通过CMake方式移植到Android studio2.3中
http://blog.csdn.net/king1425/article/details/70338674

2.复制一份第一步移植成功的的代码命名为:ffmpegandroiddecoder

这里写图片描述

3.删减部分代码验证无误,然后编写布局代码逻辑代码

点击codec按钮出现如上图列表界面则无误
下面是相关代码:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">


        <Button
            android:id="@+id/btn_codec"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="2dp"
            android:text="Codec"
            android:textAllCaps="false" />

    </LinearLayout>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="12dp"
        android:text="ws2.mp4"
        android:id="@+id/editText1" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height=
  • 4
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值