Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

record-audio-video-stream example with RTMP #24

Open
Serafo44 opened this issue Jun 8, 2020 · 5 comments
Open

record-audio-video-stream example with RTMP #24

Serafo44 opened this issue Jun 8, 2020 · 5 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@Serafo44
Copy link

Serafo44 commented Jun 8, 2020

Hello !

I would like to modify the example record-audio-video-stream so that it sends the data to an RTMP page instead of recording the video in mp4. Is this possible with this example? I tried to modify the record path by putting my RTMP link in it and adding some output options but it doesn't work. Do you know how I could do it?

Thanks :D

@Malsoine
Copy link

Hey o/

I would like to send my webcam flux to an RTMP link just like Serafo44
When I click on start, it return me an ECONNRESET error, as I know, it's a socket error, but I really don't understand why it return me this error
Any help ?

@card-b
Copy link

card-b commented Jul 29, 2020

it does work - you have to make certain you set the output type to flv, and pick the aac audio codec as an output.

stream.proc = ffmpeg()
	.addInput((new StreamInput(stream.video)).url)
	.addInputOptions([
		'-f', 'rawvideo',
		'-pix_fmt', 'yuv420p',
		'-s', stream.size,
		'-r', '30',
	])
	.addInput((new StreamInput(stream.audio)).url)
	.addInputOptions([
		'-f s16le',
		'-ar 48k',
		'-ac 1',
	])
	.on('start', () => {
		console.log('Start recording >> ', stream.recordPath)
	})
	.on('end', () => {
		stream.recordEnd = true;
		console.log('Stop recording >> ', stream.recordPath)
	})
	.size(VIDEO_OUTPUT_SIZE)
	.audioCodec('aac')
	.flvmeta()
	.format('flv')
	.output(stream.recordPath); // RTMP endpoint

@Serafo44
Copy link
Author

Serafo44 commented Aug 3, 2020

Yes, i find a way to do it ahah, but do you think it's possible to create a librarie that allow us to send the webcam flux of an external project to our server (Instead of capture it with client.js) ?

@ldenoue
Copy link

ldenoue commented Sep 15, 2020

@card-b
Does this work even when the incoming WEBRTC video size changes during the session?
It's not uncommon that during a session, the video changes from e.g. 640x480 to 160x120.
Would FFMPEG in this case automatically scale it back to your VIDEO_OUTPUT_SIZE param?

I logged the sizes when a new UID gets created, and notice the Start/Stop recording events.
Unfortunately, the RTMP stream is constantly interrupted.

Would you have ideas on how to solve this?

new UID 1 new size= 320x240
Start recording >> rtmp://...
new UID 2 new size= 480x360
Start recording >> rtmp://...
Stop recording >> rtmp://...
new UID 3 new size= 640x480
Start recording >> rtmp://...
Stop recording >> rtmp://...

@markandrus markandrus added enhancement New feature or request question Further information is requested labels Sep 28, 2020
@ysle
Copy link

ysle commented Feb 10, 2022

well, You can force ffmpeg to maintain the output resolution, surely it isn't optimal but at least the RTMP could survive it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants