Add overlays to video on Android [closed]

China☆狼群 提交于 2019-12-05 04:55:46

问题


I'm developing an Android application, this application load video file from android gallery that saved on SD Card.
I need to know how can I add overlays to this video
I need to add title and image on this video like brand images

I can not find an example or tutorial describe how to do this operation

Do I have to use decoding to add overlays? , And if yes how can I do that.

Any example about this...


回答1:


Provided you're playing the video using a VideoView or similar, you can overlay any View (e.g. TextView, ImageView) using a RelativeLayout. For example, to show a text on the top right corner of the video:

<RelativeLayout
    android:id="@+id/playerLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

        <VideoView
            android:id="@+id/videoPlayer"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <TextView
            android:id="@+id/videoText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_margin="3dp"
            android:text="@string/player_text" />

</RelativeLayout>



回答2:


As @rbarriuso said, ffmpeg4Android is able to meet your requirement. There is also a guide to install both library and demo in both Android Studio and Eclipse. Following, there are also the watermark command which may satisfy you.

Hope it can help



来源:https://stackoverflow.com/questions/18577563/add-overlays-to-video-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!