2016-11-04 7 views
0

私はWebRTCを使用しています。ファイルにローカルビデオストリームが必要です。 あなたが私にこれに近づけるヒントをくれたら、私はそれを感謝します。WebRTCローカルビデオストリームをAndroid上のファイルに記録する方法は?

ありがとうございます。

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    //sigConnect("http://10.54.36.19:8000/"); 
    sigConnect("http://unwebrtc.herokuapp.com/"); 
    initWebRTC(); 

    Log.i(TAG, "VideoCapturerAndroid.getDeviceCount() = " + VideoCapturerAndroid.getDeviceCount()); 
    String nameOfFrontFacingDevice = VideoCapturerAndroid.getNameOfFrontFacingDevice(); 
    String nameOfBackFacingDevice = VideoCapturerAndroid.getNameOfBackFacingDevice(); 
    Log.i(TAG, "VideoCapturerAndroid.getNameOfFrontFacingDevice() = " + nameOfFrontFacingDevice); 
    Log.i(TAG, "VideoCapturerAndroid.getNameOfBackFacingDevice() = " + nameOfBackFacingDevice); 
    VideoCapturerAndroid capturer = VideoCapturerAndroid.create(nameOfFrontFacingDevice); 

    MediaConstraints videoConstraints = new MediaConstraints(); 

    VideoSource videoSource = peerConnectionFactory.createVideoSource(capturer, videoConstraints); 
    localVideoTrack = peerConnectionFactory.createVideoTrack(VIDEO_TRACK_ID, videoSource); 

    glview = (GLSurfaceView) findViewById(R.id.glview); 
    VideoRendererGui.setView(glview, null); 
    try { 
     rendereRemote = VideoRendererGui.createGui(0, 0, 100, 100, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, true); 
     rendereLocal = VideoRendererGui.createGui(72, 72, 25, 25, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, true); 
     localVideoTrack.addRenderer(rendereLocal); 
    } catch (Exception e) { 
     e.printStackTrace(); 
    } 

    mediaStream = peerConnectionFactory.createLocalMediaStream(LOCAL_MEDIA_STREAM_ID); 
    mediaStream.addTrack(localVideoTrack); 

} 

答えて

0

LibjingleライブラリはビデオをレンダリングするためにGlSurfaceViewを使用します。そのビューからビデオフレームを保存するには、FFMPEGライブラリを使用してみてください。ただし、オーディオについてはわからない

関連する問題