RootEncoder
RootEncoder copied to clipboard
How do I push out if I have two surfaceviews?
Combine this framework: https://github.com/PaddlePaddle/LiteKit CameraView extends SurfaceView:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/portraitVideoLayout" android:layout_width="match_parent" android:layout_height="match_parent">
<FrameLayout
android:id="@+id/portraitVideoContentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true">
<!-- CameraView extends SurfaceView -->
<com.gooxi.demo4.CameraView
android:id="@+id/camera_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" />
<SurfaceView
android:id="@+id/mask_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" />
</FrameLayout>
<RelativeLayout
android:id="@+id/componentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/portraitVideoContentLayout">
<TextView
android:id="@+id/costTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="x ms"
android:textSize="22dp" />
</RelativeLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="start_push" />
Combine with others libraries could be difficult depend of the way they use to draw frames. You should ask to the owner of the library the way they are drawing frames in the surfaceview and get a way to extract frames to encode using Mediacodec. You have VideoEncoder class in my library to help you encode buffers.