【问题标题】:How can I add overlay images or text on top of videos in Android?如何在 Android 中的视频上添加叠加图像或文本?
【发布时间】:2015-05-12 16:04:03
【问题描述】:

我正在尝试在 Android 应用程序内的 mp4 视频之上添加叠加图像/文本。 大多数解决方案都指向 FFmpeg(或 appunits AndroidFFmpeg),但不稳定且维护起来非常复杂。 有没有使用 Android SDK 的本地方法来做到这一点? (MediaCodec?MediaMuxer?)

谢谢你, 奥利

【问题讨论】:

    标签: android video ffmpeg overlay media


    【解决方案1】:

    有两种方法可以理解您的问题:

    1. 您想临时叠加视频和其他信息。 这可以使用标准布局程序来完成:

    使用内置的VideoView。您可能需要将 textView /imageView 包装在一个额外的布局中以将其推到前面:

     <VideoView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/videoView"
        android:background="#00000000"/>
     <LinearLayout
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="bottom|center_horizontal"
         android:orientation="horizontal">
         <TextView
             android:id="@+id/txt"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="Text"/>
     </LinearLayout>
    
    1. 您想将附加信息添加到视频本身。 这显然要困难得多。您可以为此使用OpenCV。有关 OpenCV+Android 的信息,请访问their website

    更新:正如this answer 中所指出的,ExtractMpegFramesTest 可能对您来说很有趣

    【讨论】:

    • 嗨 PhiLab,#2 是相关的解决方案。我正在尝试编辑视频文件本身。我将尝试使用 OpenCV 并更新线程。谢谢!
    • 2017 年这些天你几乎肯定只使用 FFMPEG
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-29
    • 1970-01-01
    • 2020-03-02
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多