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

问题描述:

我是一名iOS开发人员,我已经为客户编写了一个应用程序,这是一个健身(锻炼)计时器应用程序,它可以在锻炼过程中拍摄您的影像,并为完成的视频添加实时叠加和声望计数.这是一个相当艰巨的项目,我想知道是否可以在Android上实现同样的功能?

I am an iOS developer and I have written an app for a client, it is a fitness (Crossfit) timer app, it films you on your workout and adds real time overlays and rep counts to the finished video. It was a fairly challenging project to complete and I was just wondering if the same thing would be possible on Android?

基本上,我需要知道的是,是否可以将变化的文本(例如,以秒为单位的计时器)叠加到录制的视频上?

Essentially what I need to know is, is it possible to overlay text that changes (e.g a timer counting up in seconds) onto a recorded video?

如果有人编写了可以执行此操作的应用程序,我将不胜感激,因为Java不是我的强项,所以我很高兴看到代码段!

If anyone has written an app that does this I would be grateful to see code snippets as Java is not my forte!

谢谢!

  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.该链接为您提供了有关该主题的更多信息:如何在录像中添加文本?​​ 查看全文