且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否可以在视频中添加文字叠加层?

更新时间:2023-09-21 23:23:16

  1. 如果您只想在视频上显示文本而不是将其添加到视频文件中,那么使用FrameLayout确实很容易:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <VideoView
        android:id="@+id/VideoView"
        android:layout_height="match_parent"
        android:layout_width="match_parent" />

    <TextView
        android:text="TEXT"
        android:id="@+id/textview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</FrameLayout>

,文本将显示在视频上.

and text will be displayed over video.

  1. 如果要将文本添加到原始视频文件中,就不会那么简单.您需要外部工具来处理此问题,例如FFMPEG.该链接为您提供了有关该主题的更多信息:如何在录像中添加文本?​​ 查看全文