jitsi / libjitsi

Advanced Java media library for secure real-time audio/video communication.
Apache License 2.0
628 stars 282 forks source link

webrtc (dtls+srtp) server for recordering stream #315

Open publicocean0 opened 7 years ago

publicocean0 commented 7 years ago

Hi i m searching a library for creating a java server for connecting from a browser to a server(as a peer node) for recordering video stream using webrtc stream from client. Can this library help me? Is there a example or a manual or another way for learning how to use this code(if i have to develop a server is not a problem .... the problem for me is the dtls+srtp protocol very complex ... i dont know so much about it )?

jitsi-developers commented 7 years ago

Hi publicocean0,

Take a look at https://github.com/jitsi/jibri.

On Sun, Jun 4, 2017 at 9:26 PM, publicocean0 notifications@github.com wrote:

Hi i m searching a library for creating a java server for connecting from a browser to a server(as a peer node) for recordering video stream using webrtc stream from client. Can this library help me? Is there a example or a manual or another way for learning how to use this code?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jitsi/libjitsi/issues/315, or mute the thread https://github.com/notifications/unsubscribe-auth/AER2Y8hljNHiaPDYoZxlQeND2hzgt6Zjks5sAtOsgaJpZM4NvaWl .


dev mailing list dev@jitsi.org Unsubscribe instructions and other list options: http://lists.jitsi.org/mailman/listinfo/dev

-- Buddhika Jayawardhana Undergraduate | Department of Computer Science & Engineering University of Moratuwa buddhika.anushka@gmail.com buddhika.12@cse.mrt.ac.lk | LinkedIn http://lk.linkedin.com/in/buddhikajay/

publicocean0 commented 7 years ago

sorry but it seams a library in python ... i m ready to suicide me :) My software is in java and my server is a web server where i m developping a page where there is a video component html from camera , this video can be saved in the webserver (db or file). but with this library is not possible to receive a videostream from a browser?

bgrozev commented 7 years ago

I'm afraid there's not much documentation. Take a look at RecorderRtpImpl (it supports only VP8). The library does not take care of signaling or connectivity establishment (ICE), so you would have to implement these parts (it does DTLS, though). It expects input through a set of sockets.

publicocean0 commented 7 years ago

Ok for Ice it is not a problem i can use my websocket For VP8 no problem. RecorderRtpImpl receives a RTPTranslator converting rtp in mediastream. Navigating a bit in the classes it seams RTPTranslator is generated by a factory in other classes. I think there is a main class for establishing a connection receiving sdp string . i found


            MediaDevice device
                = mediaService.getDefaultDevice(mediaType, MediaUseCase.CALL);
            MediaStream mediaStream = mediaService.createMediaStream(device);

            mediaStream.setDirection(MediaDirection.RECVONLY);

            byte dynamicRTPPayloadType;

            switch (device.getMediaType())
            {
            case AUDIO:
                encoding = "PCMU";
                clockRate = 8000;
                /* PCMU has a static RTP payload type number assigned. */
                dynamicRTPPayloadType = -1;
                break;
            case VIDEO:
                encoding = "VP8";
                clockRate = MediaFormatFactory.CLOCK_RATE_NOT_SPECIFIED;

                dynamicRTPPayloadType = 99;
                break;
            default:
                encoding = null;
                clockRate = MediaFormatFactory.CLOCK_RATE_NOT_SPECIFIED;
                dynamicRTPPayloadType = -1;
            }

            if (encoding != null)
            {
                MediaFormat format
                    = mediaService.getFormatFactory().createMediaFormat(
                            encoding,
                            clockRate);

                if (dynamicRTPPayloadType != -1)
                {
                    mediaStream.addDynamicRTPPayloadType(
                            dynamicRTPPayloadType,
                            format);
                }

                mediaStream.setFormat(format);
            }

            StreamConnector connector= new DefaultStreamConnector(
                            new DatagramSocket(localRTPPort),
                            new DatagramSocket(localRTCPPort));
              mediaStream.setConnector(connector);

            mediaStream.setTarget(
                    new MediaStreamTarget(
                            new InetSocketAddress(remoteAddr, remoteRTPPort),
                            new InetSocketAddress(remoteAddr, remoteRTCPPort)));
  but myabe it is sufficient 
new RecorderRtpImp(new  RTPTranslatorImpl())

i didnt know webrtc opens so many ports for trasferring video/audio. Maybe it could be a security problem for a server . I m thinking about if my solution for recording is valid. Sorry for my question , maybe is stupid ... but i m a bit confused now: localRTPPort and localRTCPPort works as server port (the same for all peers) right?

bgrozev commented 7 years ago

You would create a MediaStream, configure its input with setConnector, etc., set an RTPTranslator with setRTPTranslator, and then create a recorder for the same RTPTranslator instance.

In jitsi-videobridge/ice4j we avoid using multiple ports by multiplexing ICE sessions (while providing a DatagramSocket API for libjitsi).

publicocean0 commented 7 years ago

i tried to assign this task to different developers but they cant to do ... for missing documentations. i think it would be usefull if this library opensource could be used also by other developers for helping the opensource community ... at least with documentation or a examples

shierro commented 6 years ago

Hi guys, agree with @publicocean0 . It will be highly appreciated if we can improve the README & add a few examples