sourcey / libsourcey

C++14 evented IO libraries for high performance networking and media based applications
https://sourcey.com/libsourcey
GNU Lesser General Public License v2.1
1.32k stars 350 forks source link

How to get "webrtcrecorder.mp4" in webrtcrecorder demo #224

Closed nethz closed 6 years ago

nethz commented 6 years ago

Following the steps provided by the webrtcrecorder demo, I runing the program. But I do not know how to stop webrtcrecorder.exe and write mp4 files.

R-Gerard commented 6 years ago

I'm having the same problem. Digging into the code it looks like there's a bug in streamrecorder.cpp with the logic to call _encoder.init().

https://github.com/sourcey/libsourcey/blob/287ef70/src/webrtc/src/streamrecorder.cpp#L84-L85

https://github.com/sourcey/libsourcey/blob/287ef70/src/webrtc/src/streamrecorder.cpp#L135-L136

It looks like the logic around _awaitingAudio and _awaitingVideo is incorrect and prevents _encoder.init() from being called. Basically StreamRecorder expects one of the booleans to be true and the other to be false exactly once so that it can call the init function, however in my observations both values start as true then both flip to false.

By disabling the audio track in signaler.cpp I was able to get an mp4 file (video only, no audio):

https://github.com/sourcey/libsourcey/blob/287ef70/src/webrtc/samples/webrtcrecorder/signaler.cpp#L146-L148

R-Gerard commented 6 years ago

I've opened PR #230 to address this issue.

auscaster commented 6 years ago

Thanks for the PR 👍