Record WebRTC call in iOS

3,075 views
Skip to first unread message

Remya Das

unread,
Jun 4, 2015, 2:44:25 AM6/4/15
to discuss...@googlegroups.com
Hi,

I'm developing an iOS app which is based on WebRTC.

I want to record the call (Audio & Video). How can I do this?


Michael Schropp

unread,
Dec 17, 2015, 3:26:04 AM12/17/15
to discuss-webrtc
If you still need to record the camerastream, I had the same problem and found a way to do so.

You can use the RTCAVFoundationVideoSource (instead of the RTCVideoSource) Class that exposes the AVCaputureSession. Sadly it is not possible to add a second Output to the Session, because the RTC-Framework will lose the camerastream.

But it is possible to add a own delegate and write, with an AVAssetWriter, the buffersamples to a file and still send the samples to the rtc-framwork.

Code in Swift:
func configurateForRecording()
    {
        for outputs in captureSession.outputs {
            if let videoOutput = outputs as? AVCaptureVideoDataOutput {
// adding self as delegate and store rtc as externalSampleBufferDelegate
                externalSampleBufferDelegate = videoOutput.sampleBufferDelegate;
                videoOutput.setSampleBufferDelegate(self, queue: recordQueue)
            }
        }
    }



    
    func captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection: AVCaptureConnection!) {
        
        // write here with AVAssetWriter to File
        writeSampleBuffer(sampleBuffer, type: AVMediaTypeVideo)

        // send sampelBuffer to RTC 
        externalSampleBufferDelegate?.captureOutput!(captureOutput, didOutputSampleBuffer: sampleBuffer, fromConnection: connection)
    }

If you have questions, hit me up.

Michael

Manish Pathak

unread,
Nov 11, 2016, 5:13:23 AM11/11/16
to discuss-webrtc, schro...@googlemail.com
Hello Michael,

I am in a urgent need to implement the same, I have achieved it through AVCaptureMovieFileOutput but it was giving problems later on.
What I want you to let me know what is here
externalSampleBufferDelegate ?
&
From where should exactly get this
captureSession, I am using appRTC lib.
& while creating localVidoeTrackForBackCamera like this -

        _recordCaptureSession = [[RTCAVFoundationVideoSource alloc] initWithFactory:_factory constraints:mediaConstraints];
        _recordCaptureSession.useBackCamera = YES;

Please tell me where I am wrong I am able to export the video with this too but the local  preview of my device gets freezes on remote end ?

Thanks

Vinay

unread,
Mar 10, 2019, 4:57:28 AM3/10/19
to discuss-webrtc
Hi Remya Das,

Did you got the solution for live video call recording by using WebRTC.

Nagamuni reddy

unread,
Mar 10, 2019, 1:28:42 PM3/10/19
to discuss-webrtc
Hi vinay, 
I have the solution for recording live video call using WebRTC.

Ryan Warren

unread,
Mar 13, 2019, 4:47:30 PM3/13/19
to discuss...@googlegroups.com
Please post your solution.
--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/fd5910e3-890f-4bbe-8d62-89ba3b6a3224%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Srinivasan P

unread,
Mar 27, 2019, 8:54:50 AM3/27/19
to discuss-webrtc
Hi, can you post your solution here?

Vidhi kalola

unread,
Apr 2, 2019, 5:41:02 AM4/2/19
to discuss-webrtc
Hi,
Can you please post your solution here?


On Sunday, March 10, 2019 at 10:58:42 PM UTC+5:30, Nagamuni reddy wrote:

Ibrahim salah

unread,
Apr 3, 2019, 1:55:24 AM4/3/19
to discuss-webrtc
hi,
i need to know which library did you used,
and how to add turn server in it
thanks,

Nagamuni reddy

unread,
Apr 8, 2019, 2:13:43 AM4/8/19
to discuss-webrtc
Hi Ibrahim, 
I did it in webRTC source code and didn't use any library for that.

Shraddha Susare

unread,
Jun 28, 2020, 6:33:20 AM6/28/20
to discuss-webrtc
Hi,
@Michael -  The code snippet that you have posted is for local video that we get from AVCapture Session. Do you have any idea about how to record the remote video?

Piasy Xu

unread,
Jun 28, 2020, 7:21:42 PM6/28/20
to discuss-webrtc
Check this out: https://github.com/HackWebRTC/webrtc/commit/dfbcd2c75d27dafd24512d6ca3d24c6d86d63b82

在 2020年6月28日星期日 UTC+8下午6:33:20,Shraddha Susare写道:

Shraddha Susare

unread,
Jul 3, 2020, 11:02:14 AM7/3/20
to discuss-webrtc

Basically I want to record the remote video in iOS app (using Google WebRTC pod). I got success in recording local video using AVCaputureSession. Now, in order record remote video, first I need to get remote video frames/buffer from RTCVideoRenderer(i know one method like renderFrame( RTCVideoFrame *)frame in this class, which renders frame, but how to get that frame). Does anyone help in this, how can I get frames from renderer?

Note: In android, they provided VideoSink method so we can get the frames, but no such class in iOS.


Sanjay Kumawat

unread,
Feb 17, 2021, 5:42:49 AM2/17/21
to discuss-webrtc
I was able to extract the frame but cannot convert RTCVideoFrame to CMBufferBuffer can someone please help

Markus Handell

unread,
Feb 17, 2021, 6:31:21 AM2/17/21
to discuss...@googlegroups.com
The encoded sink APIs [1] lets you capture the remote stream's encoded content. You need to 0) add an encoded sink, 1) Call GenerateKeyFrame and store the incoming keyframe + later frames only (earlier will be undecodable)

You will have to mux the incoming frames into some container yourself. Not sure what muxing tech you have access to.




--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages