How to Live stream with HTML5, without Flash? - php

The Problem: I need my clients to be able to stream their webcam to my streaming server(for instance Wowza server). I am building my site in PHP.
I have gone through various streaming sites like twitch.tv, livestream.com and found that they all use third party broadcasting software like Wirecast, XSplit broadcaster, OBS etc to stream the Webcam feeds to the server.
Then I came across sites like vLine, Opentokrtc that uses WebRTC for Video chat.
My Question: So, my question is that, is it possible for me to send the stream to the broadcasting servers like Wowza(So that they can then broadcast my live stream) without using broadcasting softwares with only WebRTC? If Yes, then how? If, No, then what are the other alternatives?
PS. I don't want to use Flash, ActionScript here.

You will basically need a server which has a pseudo WebRTC client integrated in it. WebRTC can get the stream but cannot start streaming until a PeerConnection is setup. You can try using various servers/gateways like Janus, Kurento, Licode, FreeSwitch, etc.
Also MediaStream generate by WebRTC can be directly attached to an HTML5 <video> tag.

Using WebRTC for such a use case incurs a high computing cost on the server side and is a rather new technique, which means you should be using it if you know what you are doing.
My suggestion would be to stick to Flash or MPEG-DASH instead - unless what you need must have a very low latency to it and you are fine with paying for it by smaller solution scales.

Unless I misunderstand, I think you're looking to stream video to your server (for distributing using "normal" live-streaming mechanisms), not using WebRTC to stream video from the server.
If so, WebRTC will work, though you'll need a server-side implementation of a fairly full set of the WebRTC protocol including video decoding. These exist, but not in PHP directly of course. This would handle getting realtime audio and video from a client, without needing a plugin on the client, including bandwidth adaptation and error correction.
Once the data is decoded on the server, you have a video+audio datastream you can feed to your live-streaming encoders to stream out.

Wowza does support what you need in order to become the other peer in your WebRTC scenario. From there you can redistribute the stream in whatever way media servers typically do.
This feature is still in "Preview" mode and has some limitations, but does function for most cases. You can request access to this via https://www.wowza.com/products/capabilities/webrtc-streaming-software

Related

Video streaming/recording solution ( Wowza Streaming Engine + Flash Media Live Encoder)

I am working on a php based web application where I need the end user to be able to record video response through the application using his webcam and then that video gets stored to my server. I have been looking into Wowza streaming Engine for sometime now and have been able to figure out that I need a streaming engine and an encoder to successfully stream a video . Using Adobe Flash media live encoder (thanks to my mate jolumg) I was able to stream live video on my locally installed Wowza streaming engine, which is cool if I want to broadcast live video, however I cannot expect my enduser to install the encoder on his device. If I am not mistaken, the end user will have access to some kind of recorder through my application. So I need to know few things:
How do I create such recorder which can capture the video using user's webcam?
Which programming language do I need to create the recorder?
Assuming the Adobe Flash media live encoder(FMLE) is installed on my server, what configuration changes do I need to make so that the recorder can send the video to FMLE which is connected to my Wowza streaming engine and can thus publish the stream.
After the incoming stream is published, how do I programmatically record it(rather than using the record button on the wowza engine manager)? Do I create an api? if yes in what language?
Finally in terms of storage, would a standard AWS instance would do or do I need something with larger space?
Any ideas?
Pardon me if I am lacking in my understanding of the entire video streaming/recording platform. I am a reletively young programmer and this is totally new for me. Thanks is advance.
I think that what you are looking for is not exactly called recorder. If what you want is live streaming you will need an encoder module. Same function than FMLE.
If you can not ask user to install FMLE you need same function embeded in the webpage.
and 2.- Usually this has been done with a flash plugin. There are samples in internet of that module. But this will not work in mobiles and with Flash being phased out soon it will not work in desktop browsers either.
If you target is mobile, check Wowza GoCoder, you have an SDK to create native applications and you also have a simple application that is ready to use (but user need to install it)
Since recently we have WebRTC technologies to use the webcam in the browser. (Wihtout depending of external plugins, or applications) Wowza already support an webRTC input. This seems to be the way for the future, but this is quite new and only will work in the latest browsers but it should work in desktop and in mobiles.
WebRTC samples:
https://webrtc.github.io/samples/
3- You do not need the FMLE in this scenario. End users is doing the encoding.
4- In Wowza configure you can set that all the streams in an application being recorded automatically. You can also have an http API to start/stop the recording at any moment, if you want fine control.
5- It will depend of your usage. This is is sometging you need evaluate,
Jolumag explained well.
FMLE, Wirecast, OBS are desktop based encoder. If you are looking for recording option from browser then its Flash component that support RTMP protocol.
You can set this rtmp://wowzaip:1935/wowzapp/streamname in your flash publisher component.
Flash is now being called "dead" so you can go for WebRTC if you want this recording support in mobile as well.
Chrome stopped support for Flash as primary technology for webcam access... your users will have to enable flash plugin in chrome.

How do a site detect if there is VLC/FFMPEG live streaming?

User(s) decide to start a stream toward my site, VLC and FFMPEG is able to do that. But how could a site detect that he is getting stream(s)?
Because I want it to then display on a page "current live videos". And what kind of streams should I need to use? HTTP? RTSP? UPD?
Thanx
You need some sort of media server for that, like Wowza, Red5 or Adobe Flash Media Server. The protocol depends on your media server choice.
To display that information you need to program the server to communicate with the site somehow. For Wowza probably the easiest is if it writes the available streams to a database. For Adobe FMS it's probably the best to use a gateway to do that via AMF. You need either Zend_AMF, or AMFPHP for the gateway code, if you use PHP for that.

How to record voice files using PHP, FLASH

I am developing an application where I need to record voice(for those who does not have a webcam so they can use only microphone to record voice) or video(those who have a a webcam - like laptop or external) files and save them on server, thereafter save the file name and logged in users id on database for later access.
I know I need to use some sort of flash app for this. But is there any free one which could server this purpose or even if there are paid ones which could serve this purpose that would be great. I tried google but may be I was not being able to go after the proper term or something, I could not succeed finding a proper solution for this.
Please, help me out!
You can do that simply using jRecorder, a jQuery plugin. You don't even need a Flash Media Server or RED server. JRecorder is same as jPlayer, you can use jQuery and HTML to design your recorder and you don't even need Flash or Action script knowledge for this.
jRecorder uses 1 pix hidden swf file which manages all the recording / previewing and sending the file data (wav file) to a URL you defined (Where you can write code in PHP or Java to receive a POST file)
It is quite simple and tidy.
You can download this Plugin from:
http://www.sajithmr.me/jrecorder-jquery
I have same feature in our latest project, the client want to have video recording from webcam and the video appear in the user's profile page.
For the server, we implement the RED5 server. It need a Java virtual machine in your hosting. You can read the detail requirement and installation instruction in the website.
To handle recording, we develop our own flash application, because the client request a custom interface to match with the overall website interface. I don't know the detail, since we outsource it to a fellow flash developer. Maybe you can see follow this thread, the development of flash recording by JeroenW.
To play recorded video, you can use any flash video player that support playing rtmp video source. You cannot play the recorded flv file in RED5 directly, since the file lack of metadata required by the player. Serving the recorded file as rtmp is done by RED5.
In addition to red5 there is Adobe's own Flash Media server that allows you to record audio/video straight to the server.
Or if you feel geeky you might be able to put together your own solution for this using a socket connection to the server and decoding the stream yourself on the server side. You should be able capture the audio/video locally into memory and then feed the byte stream up to your own server application.
There are Open Source solutions but you will need an own server to run them.
There is no way to run these things from shared hosting except if your provider is really nice, and ready to install the necessary software.
I asked the same question a few weeks back, check out the answers.
This question when googling "How to record audio php" comes up first so here for anyone from the future.
A simple way to record audio with flash and save it with PHP:
https://github.com/clouddueling/SimpleRecorder
Record audio, post audio data to your choice of url.
You could try recordmp3online.com which has an SDK. The nice thing about this one, is that it doesn't need a third party server(ala Red5), and supports mobile devices that don't have flash installed.

Flash Media Server/PHP Application

I need help finding resources that would help me or at least point me in the right direction in building a Flash media server/PHP application. I basically want to improve my current application by instead of progressive download using flash media server so that the videos will not only stream well but they can't be downloaded by the end user.
What the current application does is show a login form on the homepage and then when logged in the user can then navigate the site by choosing videos from a particular video category or video uploaded by a specific user. All this is done with PHP. The video page uses progressive download to display the video after the video ID has been passed using PHP.
I need to know how PHP and flash media server work together. Are there any resources out there where I can find a good application example (really simple) that demonstrates how PHP and flash media server can be used to stream videos dynamically such that PHP checks for the login, video ID, video channels, and video category information while the flash media server streams the video.
Really, PHP and FMS shouldn't be talking at all. It can be done within FMS, but a much easier approach is to let your Flash Player (which you'll have to have anyway) do the talking to FMS. Flash to FMS communication is well documented and very easy. Just have the PHP call forth a Flash video player with whatever info you need. It would probably be eaiser to have PHP authenticate and give the Flash some sort of authentication token if you're really worried about security.
Just so you know though, just because your media is streaming doesn't mean someone can't download it. There's several tools to rip streamed media out there. It is of course more secure, but it's not full-proof.
You may want to try Red5 instead of Flash Media Server. I've use Flash Media Server in the past and it can be a pain to take care of. With Red5 you at least have more flexibility and it is free. If you go down the Red5 path you will find more people customizing it like this one time ticket for Red5 post. I believe that is very close to what you are looking for.
The biggest problem with PHP and Flash (mediaserver) is the different "flow" of code.
PHP is straightforward:
Start request, do something, send response. Done.
Flashmedia only loads (compiles) your code when a client connects, and then only events are triggered. Most operations do not return, but need a callback.
Load application.. wait for something.. Event launched: do something, fire off another request together with a response handler object.. etc.
I have build an extensive chatservice with FlashMedia server and PHP as front and back-end.
The front-end is simple: just plain PHP/HTML-pages which will eventually create an <OBJECT>-tag loading some Flash applet.
That flash applet should connect to the Flash media server using information/credentials passed to it with the FlashVars-option or loaded (generated) XML-data from a separate URL.
From that point, the Flash applet (client) does it's thing with the Flashmedia server.
For this example, you want to verify credentials from the Mediaserver. You should use the AMFPHP framework for that.
AMFPHP is a replacement for Macromedia's "Flash Remoting" system where Flash [applets/servlets] can do asynchronious communications over HTTP.
For the AMFPHP-framework you write an interface class wrapping your credential-validation code. There is a test-page which validated the response of your wrapper.
(The AMFPHP Framework can also generate AS2 sample code so you have an idea how the Flashmedia server should send an request and handle responses.)
A warning: AMFPHP uses POSTs to send
and retrieve data. In the past,
there were problems when more than
2k of data was truncated. I now only
use it for relative short messages.
AMFPHP is very reliable. You can use it to do external logging for example.
Using flash media server so that the
videos will not only stream well but
they can't be downloaded by the end
user
This won't really work. It make make it "harder" for some people in the same way that not putting a big, huge "download here" button makes it "harder", but the content is still being downloaded to their computer, just in a different way. Anything that's downloaded can be saved to the disk.
I am doing similar thing. First, for authentication, you can use FMS's authentication plug-in. Of course, you can make your own stuff in PHP. Instead of adding PHP into FMS's original Apache, I decided to run XAMPP in parallel, with different port of course.
To start and stop the encoder, you can make use of FMLEcmd command.
My environment:
Flash Media Development Server 3.5
Flash Media Live Encoder 3.1
XAMPP (at port 8080)

Live Video Streaming with PHP

I have a PHP/AJAX/MYSQL chat application. I want to add video chatting to my application. How can I create live video streaming to be used for live video conferences/chatting in a PHP application. What are the key-terms I need to know if I wanted to build such a system? Is it a good idea in the first place to use PHP? Is there something I'm not thinking about? What other languages can I use, perhaps in conjunction with PHP?
I am not saying that you have to abandon PHP, but you need different technologies here.
Let's start off simple (without Akamai :-)) and think about the implications here. Video, chat, etc. - it's all client-side in the beginning. The user has a webcam, you want to grab the signal somehow and send it to the server. There is no PHP so far.
I know that Flash supports this though (check this tutorial on webcams and flash) so you could use Flash to transport the content to the server. I think if you'll stay with Flash, then Flex (flex and webcam tutorial) is probably a good idea to look into.
So those are just the basics, maybe it gives you an idea of where you need to research because obviously this won't give you a full video chat inside your app yet. For starters, you will need some sort of way to record the streams and re-publish them so others see other people from the chat, etc..
I'm also not sure how much traffic and bandwidth this is gonna consume though and generally, you will need way more than a Stackoverflow question to solve this issue. Best would be to do a full spec of your app and then hire some people to help you build it.
HTH!
Please note that the below described service is no longer available as
it was based on FLV media (Flash)
This project which utilizes the Red5, Flex and PHP for Live Video Streaming and Recording has many features
Stream Live video to the viewers
Record the streams from your cam or other video input devices to the server
Preview the recorded streams and files and thumbnail the frame which you would like to display for the video.
Upload the videos from your computer and convert them to FLV which can be streamed using Red5 .
Choose from any resolutions
Can be plugged to any script
Each website user can have a separate Directory for storing their videos and thumbnails use this link
http://code.google.com/p/red5-flex-streamer/
PHP will let you build the pages of your site that make up your video conferencing and chat applications, but it won't deliver or stream video for you - PHP runs on the server only and renders out HTML to a client browser.
For the video, the first thing you'll need is a live streaming account with someone like akamai or the numerous others in the field. Using this account gives you an ingress point for your video - ie: the server that you will stream your live video up to.
Next, you want to get your video out to the browsers - windows media player, flash or silverlight will let you achieve this - embedding the appropriate control for your chosen technology into your page (using PHP or whatever) and given the address of your live video feed.
PHP (or other scripting language) would be used to build the chat part of the application and bring the whole thing together (the chat and the embedded video player).
Hope this helps.
PHP/AJAX/MySQL will not be enough for creating the live video streaming application There is a similar thread here. It primarily suggests using Flex or Silverlight.
For live video conferencing you can't ignore the need of a streaming server.
Yes, flash will let you display video from a webcam within the local flash control, but that won't let you then send that video over the network - for that you need a streaming server to send it to.
If you're going to build something like this it's prudent to think about how you're going to host the video from a very early stage as it will influence how you build the application. Flash/Flex/Silverlight/Windows Media....etc....
There are a lot of "off-the-shelf" 'servers' that will run in your environment.
Most of these utilize the aforementioned Flex or Silverlight to implement the actual video itself but I'm pretty sure all will run under LAMP/PHP.
The challenges will picking the best software from everything that's available and getting your hosting-provider to let you stream video (it goes without saying that streaming is heavy on bandwidth).
You can easily build a website as per the requirements. PHP will be there to handle the website development part. All the hosting and normal website development will work just as it is. However, for the streaming part, you will have to choose a good streaming service. Whether it is Red5 or Adobe, you can choose from plenty of services.
Choose a service that provides a dedicated storage to get something done right. If you do not know how to configure the server properly, you can just choose a streaming service. Good services often give a CDN that helps broadcast the stream efficiently. Simply launch your website in PHP and embed the YouTube player in the said web page to get it working.
Same problem/answer here, quoted below
I'm assuming you mean that you want to run your own private video
calls, not simply link to Skype calls or similar. You really have 2
options here: host it yourself, or use a hosted solution and integrate
it into your product.
Self-Hosted
----------------- This is messy. This can all be accomplished with PHP, but that is probably not the most advisable solution, as it is
not the best tool for the job on all sides. Flash is much more
efficient at a/v capture and transport on the user end. You can try to
do this without flash, but you will have headaches. HTML5 may make
your life easier, but if you're shooting for maximum compatibility,
flash is the simplest way to go for creating the client. Then, as far
as the actual server side that will relay the audio/video, you could
write a chat server in php, but you're better off using an open source
project, like
janenz00's mention
of red5, that's already built and
interfacing with it through your client (if it doesn't already have
one). Or you could homebrew a flash client as mentioned before and
hook it up to a flash streaming server on both sides...either way it
gets complicated fast, and is beyond my expertise to help you with at
all.
Hosted Service
----------------- All in, my recommendation, unless you want to administer a ridiculous setup of many complex servers and failure
points is to use a hosted service like
UserPlane or similar and offload all the
processing and technical work to people who are good at that, and then
worry about interfacing with their api and getting their client well
integrated into your site. You will be a happier developer if you do.

Categories