-
Notifications
You must be signed in to change notification settings - Fork 48
Using FFmpeg instead of MP4Recorder. #30
Comments
You can instantiate a StreamerSession on a specific port and send RTP stream from FFmpeg to that port. |
@bakoushin i need to receive webrtc by ffmpeg. So ffmpeg should receive stream from StreamerSession? |
#4 |
Probably this code sample is not supposed to be fully working, it just explains how things could be configured. I was able to run a H264 stream trough a Streamer using the following configuration: const { MediaInfo, CodecInfo } = require('semantic-sdp');
const MediaServer = require('medooze-media-server');
const streamer = MediaServer.createStreamer();
const video = new MediaInfo('video', 'video');
video.addCodec(new CodecInfo('h264', 96));
const session = streamer.createSession(video, {
local: { port: 5004 }, // <-- incoming stream goes here
remote: { ip: '127.0.0.1', port: 4567 }, // <-- outgoing stream goes here
});
session.getOutgoingStreamTrack().attachTo(session.getIncomingStreamTrack()); FFmpeg streamer: ffmpeg -stream_loop -1 -re -i video.mp4 -vcodec copy -f rtp "rtp://127.0.0.1:5004" FFplay receiver: ffplay -protocol_whitelist file,rtp,udp -i input.sdp The
|
@bakoushin thanks, it's pretty clear example. But i would like to achieve another goal. Let met explain better. Flow is: webrtc ---> medooze --> ffmpeg --> ffmpeg output (mp4/rtmp/etc) So i suppose we got here webrtc input:
Here loopback:
`
i would like to set:
so based on your example:
or put webrtc like this, idk:
maybe created input.sdp after and then, probably:
So is it possible (i hope it is) to do something like this? Could you provide please some sample? Thanks ! |
Just replace FFplay with FFmpeg and you are done: ffmpeg -protocol_whitelist file,rtp,udp -i input.sdp -c copy -flags +global_header out.mp4 |
Could you please suggest : code for init video session:
input.sdp
How to set bitrate fully passthrough, it speeds up just before 2500kbit ? 2) How to catch audio stream?
input.sdp: But ffmpeg can't catch stream....
I would like to achieve smth like this:
and another step:
Could please suggest @bakoushin ? |
In this repo they are solving the same problem with another SFU. The author had reported a bug in FFmpeg which prevents storing Opus within MP4. I neither wasn't able to put Opus into MP4 with FFmpeg. Maybe using GStreamer could be more fruitful. |
@bakoushin no matter about Opus. It could be pcmu or smth. Anyway FFmpeg reencode it to aac before write in mp4 wrapper. I even can't |
@bakoushin i know that ffmpeg 100% could get pcmu for example, reencode to aac and then store. So my current problem i can't even catch this anyway. Let's forget about mp4 for a while... So could please provide me with example just how to catch audio and store it. Doesn't matter which webrtc audio was setted .... |
I have try to use Kurento and with:
And it works fine with pcmu or opus forced. But reason i left Kurento that it works unstable with FullHD streaming... So i believe we could apply the same on Medooze How do you think @bakoushin ? |
i add in media soup:
and got fine audio on mp4..... So how do the same in medooze ? 🥇 |
Check You are setting the payload type to 48:
but in the sdp you are using 111:
You can do a wireshark capture to check that the what actual data the streamer session is sending to ffmpeg |
I've created a quick demo for recording to MP4 trough RTP streams sent to GStreamer/FFmpeg: |
Could you suggest
Is it possible / how to catch stream using ffmpeg instead of this recorder ?
Thanks!
The text was updated successfully, but these errors were encountered: