69

In WebRTC, I always see the implementation about peer-to-peer and how to get video streaming from one client to another client. How about server-to-client?

Is it possible for WebRTC to streaming video file from server-to-client? (I am thinking about using WebRTC Native C++ API to create my own server application to connect to the current implementation on chrome or firefox browser client application.)

OK, if it is possible, will it be faster than many current video streaming services?

A-letubby
  • 8,474
  • 8
  • 38
  • 48

7 Answers7

55

Yes it is possible as the server can be one of the peers in that peer-to-peer session. If you respect the protocols and send the video in SRTP packets using VP8, the browser will play it. To help you build these components on other applications or servers, you can check this page and this project as a guide.

Now, comparing WebRTC with other streaming services... It will depend on several variables like the Codec or the protocol. But, for instance, comparing WebRTC (SRTP over UDP with VP8 Codec) against Flash (RTMP over TCP with H264 Codec), I would say that WebRTC wins.

  • The player will be Flash Player against the native <video> tag.
  • The transport would be TCP against UDP.

But of course, everything depends on what you are sending to the client.

nico.ruti
  • 605
  • 6
  • 17
nakib
  • 4,304
  • 2
  • 28
  • 39
  • 3
    the second link in your answer is broken. otherwise thanks! – nelsonic Jan 03 '16 at 20:51
  • Why is UDP better than TCP for video ? – Alex Aug 29 '16 at 12:43
  • That question is replied some times on SO. See for instance this answer: http://stackoverflow.com/a/6187510/776409 – nakib Aug 29 '16 at 14:47
  • @Alex Because TCP re send pkg when it died => not realtime, read more about Udp and Tcp – nobjta_9x_tq Nov 19 '16 at 02:51
  • 1
    @user198829 :) in practice you will end up re-implementing TCP re-transmission over UDP. No user wants to watch video with missing parts of the picture ! Video coding uses reference to other frames in past and in future so your dropped packet can choke decoder and in best case cause long artifact propagation like on this image, read more about video compression. http://community.avid.com/cfs-filesystemfile.ashx/__key/CommunityServer.Components.UserFiles/00.00.03.89.66/transcode.jpg – Alex Nov 20 '16 at 11:43
  • The 2nd link perhaps now is at https://webrtc.googlesource.com/src/+/master/examples/peerconnection/client/ see https://webrtc.org/native-code/ – Tino Mar 26 '18 at 10:54
11

I have written some apps and plugins using the native WebRTC API, and there isn't a lot of information out there yet, but here are a few useful resources to get you started:

QT Example: http://research.edm.uhasselt.be/jori/qtwebrtc
Native to Browser example: http://sourcey.com/webrtc-native-to-browser-video-streaming-example/

Kamo
  • 232
  • 2
  • 4
  • Also check this Google group discussion: https://groups.google.com/forum/#!msg/discuss-webrtc/Pdas21qohck/CCRZTxPx5esJ – Kamo Mar 15 '14 at 03:10
5

I started with the WebRTC Native C++ to Browser Video Streaming Example but it doesnot build anymore with the actual WebRTC Native Code.

Then I made modifications merging into a standalone process :

  • management of the peerConnection (the peerconnection_server)
  • access to Video4Linux capture (the peerconnection_client).

Removing the stream from browser to the WebRTC Native C++ client give a simple solution to access throught a WebRTC browser to a Video4Linux device that is available from GitHub webrtc-streamer.

Live Demo

mpromonet
  • 11,326
  • 43
  • 62
  • 91
  • Compiling webrtc was a bit more involved than I'd expected, and I needed to make a few small small updates to your source (looked like webrtc API changes), but this code did yield server side video. Thanks! – mpr Dec 29 '16 at 16:52
3

We are attempting to replace MJPEGs with Webrtc for our server software and have a prototype module for doing this using a smattering of components tied to the Openwebrtc project. It has been an absolute bear to do, and we have frequent ICE negotiation errors (even over a simple LAN), but it mostly works.

We also built a prototype with the Google Webrtc module, but it had many dependencies. I find it easier to work with the Openwebrtc modules because Google's stuff is so tightly tied to general peer-to-peer scenarios on the browser.

I compiled the following from scratch:

libnice 0.1.14 gstreamer-sctp-1.0 usrsctp

Then I have to interact with libnice a bit directly to gather candidates. Also have to write out the SDP files by hand. But the amount of control--being able to control the source of the pipeline--makes it worthwhile. The resulting pipeline (with two clients off one server source) is below:

resulting webrtc pipeline

mpr
  • 3,250
  • 26
  • 44
0

Of course. I'm writting a program using native WebRTC api which can join the conference as a peer and record both video and audio.

see: How to stream audio from browser to WebRTC native C++ application

and you can definitely streaming media from native app.

I'm sure you can use dummy_audio_file to streaming audio from local file, and you can find a way to access the video streaming progress by your own.

simpx
  • 184
  • 1
  • 11
0

Yes it is. We have developed an load test tool to publish and play for Ant Media Server. This tool can broadcast media file. We used the same native WebRTC library used in Ant Media Server.

mgct
  • 1
  • 3
  • 10
  • this is basically an ad without any source or library links – proc Apr 24 '22 at 21:00
  • @proc You can find related documentation https://resources.antmedia.io/docs/load-testing. This is the repository link: https://gitlab.com/Ant-Media/webrtc-test – mgct Apr 25 '22 at 13:32
0

Sure it's possible, it allows covert live streaming to WebRTC, for example:

OBS/FFmpeg ---RTMP---> Server ---WebRTC--> Chrome/Client

For this scenario, it allows the ultra low latency live streaming, about 600~800ms, to play the live streaming by WebRTC. Please take a look at this demo.

Winlin
  • 1,136
  • 6
  • 25