首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将WebRTC本地视频流录制到Android上的文件中?

如何将WebRTC本地视频流录制到Android上的文件中?
EN

Stack Overflow用户
提问于 2016-11-04 13:55:33
回答 2查看 1.3K关注 0票数 1

我已经在使用WebRTC了。我想要本地视频流到文件。如果你能给我一个提示,我将不胜感激。

感谢您的阅读。

代码语言:javascript
复制
@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);

}
EN

回答 2

Stack Overflow用户

发布于 2016-11-04 14:01:48

Libjingle库使用GlSurfaceView来渲染视频。您可以尝试使用FFMPEG库保存该视图中的视频帧。但对音频不太确定

票数 0
EN

Stack Overflow用户

发布于 2018-11-12 19:13:32

您必须创建视频容器,如mp4,并手动编码和写入每个原始帧。此外,最新的webrtc版本还提供了从麦克风录制音频的通道。还应该对音频样本进行编码和多路复用。

有关访问远程和本地对等设备的原始视频帧的

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40416166

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档