问题
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?
If anyone has written an app that does this I would be grateful to see code snippets as Java is not my forte!
Thanks!
回答1:
- If you want to just display text over video and not add it into video file, it's really easy using 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.
- If you want to add text into original video file, it will not be that simple. You need external tools to handle this, for example FFMPEG. this links give you more info about this topic: How to add text on video recording? and How to embed text while recording video in Android?
回答2:
Yes it is possible, I have followed this tutorial and it is pretty efficient : http://www.wowza.com/forums/content.php?432-How-to-add-graphic-overlays-to-live-streams-with-Wowza-Transcoder That is for live stream and for videos you can use those softwares: Openshot or Kdenlive.
来源:https://stackoverflow.com/questions/30843932/is-it-possible-to-add-a-text-overlay-to-videos