Copy link to clipboard
Copied
Hi everybody,
I'm using Amazon Cloud & Flash MMedia Server 4.5.
I would like to take one of my exits videos (a static file), and turn it into a live stream. People can view this video (synchronous). I'm using Flash Media Live Encoder 3.2, but it only capture video from devices as camera...
How I can do it?
Cheers.
Hi Huy,
Please find the zip attached where I have written the scripts for you to deploy on your local FMS server, in context of option 2:
You may like to follow these steps:
1. unzip the folder.
2. deploy FLVpublishonLoad (in case your recorded file is a FLV use case) on your lcoal server
3. deploy toPublish on your remote aws server
4. make sure to correct the path for aws in FLVPublishonLoad application @ line#19:
// Please mention your aws instance hostname instead of localhost , and application nam |
Copy link to clipboard
Copied
Hi Huy,
For your issue there are several routes availiable:
1. You can provide input to FMLE using a DVD player and a sound card and then your FMLE will publish this stream from DVD player to FMS like a live stream.
2. Alternatively, you can install the Development Edition of FMS on your local machine, write a Server-Side Action Script cpde that can publish this stream to your FMS hosted on your cloud.
3. Alternatively, put the tatic file as VoD, but am not sure if that is your valid use case.
4. Alternatively, you can use tools like manycam to get the video stream, and a sound card to capture the audio and publish it to FMS using FMLE, but I believe it will run into synchronization issues.
Please see if any of these options are viable and then probably we can help you more if you run into some other issues while using these alternative methods.
Regards,
Shiraz Anwar
Copy link to clipboard
Copied
Hi zarihs,
Thanks your reply, now I'm interested case 1 & 2. Because case 3 is not valid my use case. And case 4 is inconvenience to share my screen.
Can you specific description for me about:
1. I need a "DVD player device" (example here) and sound card for PC, then plug "DVD player device" to PC, and run video on "DVD player device", FMLE can capture it? Can you give me some name of popular "DVD player" ?
2. About write Server-side action script, do you have tutorial or document about streaming ? I don't have more knowledge about streaming. It too difficult ?
Regard,
Mai Huy
Copy link to clipboard
Copied
Hi Huy,
Please find the zip attached where I have written the scripts for you to deploy on your local FMS server, in context of option 2:
You may like to follow these steps:
1. unzip the folder.
2. deploy FLVpublishonLoad (in case your recorded file is a FLV use case) on your lcoal server
3. deploy toPublish on your remote aws server
4. make sure to correct the path for aws in FLVPublishonLoad application @ line#19:
// Please mention your aws instance hostname instead of localhost , and application name .... | |
nc.connect("rtmp://localhost/toPublish"); |
5. go to admin console of your local development server and load the instance of FLVPublishonLoad as shown in the howtoLoadfromAdminConsole.png image attached for refrence purpose.
6. it will automatically connect to the "toPublish" app on your remote server and start publishing your local vod file as a live stream to your aws instance
7. start your subscriber app and subscribe to the stream you have used in FLVPublishonLoad app for Stream.get() method, see line#29 and the subscriberScreenExample.png file attached for the illustration purpose.
few points to note here:
1. I have removed the sample.flv and "sample1_1500kbps.f4v" for keeping the zip size lower.
2. You need to put your stream name at line#55 where you call mystream.play()
3. The stream name that you specify in Stream.get() will be used by subscribers.
4. if your use case is mp4, then please use "MP4PublishonLoad" instead of "FLVPublishonLoad" application.
=============
As I am unable to attach the files here therefore copy-pasting the code for you and others to be re-used:
=======
main.asc code for FLVPublishonLoad:
--------------------------------------
var nc;
var ns;
application.onAppStart = function()
{
trace("hello client: ");
publishIt();
}
function publishIt()
{
trace("publishing");
nc = new NetConnection();
// Please mention your aws instance hostname instead of localhost , and application name ....
nc.connect("rtmp://localhost/toPublish");
nc.onStatus = function(info)
{
trace(info.code);
}
ns = new NetStream(nc);
// Exact stream name available for subscribers .....
mystream = Stream.get("myvodfile");
mystream.onStatus = function(sinfo)
{
trace("mystream.onStatus: "+sinfo.code);
if(sinfo.code == "NetStream.Publish.Start")
{
attach_retVal = ns.attach(mystream);
if(attach_retVal==true)
{
trace("stream attach was successful ...");
startPublish();
}
else
{
trace("The attempt to attach stream source to NetStream failed");
}
}
}
// Please put the stream name here inside double-quotes that you want to publish and is available there in streams/_definst_ folder ......
mystream.play("sample",0,-1,true);
}
function startPublish()
{
ns.publish(mystream.name,"live");
}
--------------------------------------
main.asc code for MP4PublishonLoad:
--------------------------------------
var nc;
var ns;
application.onAppStart = function()
{
trace("hello client ");
publishIt();
}
function publishIt()
{
trace("publishing");
nc = new NetConnection();
// Please mention your aws instance hostname instead of localhost , and application name ....
nc.connect("rtmp://localhost/toPublish");
nc.onStatus = function(info)
{
trace(info.code);
}
ns = new NetStream(nc);
// Exact stream name available for subscribers .....
mystream = Stream.get("mp4:myvodfile.f4v");
mystream.onStatus = function(sinfo)
{
trace("mystream.onStatus: "+sinfo.code);
if(sinfo.code == "NetStream.Publish.Start")
{
attach_retVal = ns.attach(mystream);
if(attach_retVal==true)
{
trace("stream attach was successful ...");
startPublish();
}
else
{
trace("The attempt to attach stream source to NetStream failed");
}
}
}
// Please put the stream name that you want to publish and is available there in streams/_definst_ folder ......
mystream.play("mp4:sample1_1500kbps.f4v",0,-1,true);
}
function startPublish()
{
trace("#### " + mystream.name);
ns.publish("mp4:" + mystream.name,"live");
}
--------------------------------------
main.asc code for "toPublish" app
=====================
application.onPublish = function(clientObj, streamObj)
{
trace("published: " + streamObj.name);
}
=====================
Please revert back to me in case of further query.
Regards,
Shiraz Anwar
Copy link to clipboard
Copied
and for case 1, here must be your answer:
http://www.adobe.com/products/flashmediaserver/flashmediaencoder/devicematrix.html
Copy link to clipboard
Copied
Hi Shiarz (or zarihs before )
I busy another work in past 2 days, I can't reply to you, now I can continue research live streaming from recorded video. I had received your file zip. But I don't understand clearly your intruction. I have some problem:
1. Because my system is only server : Amazon EC2 (include FMS), I don't have FMS in my computer (local server).
2. In step 7, I don't understand subscriber app. Can client (end-user) use it, input URL (ex: rtmp://myhost/toPublish), and the stream name (take it from source Stream.get). And then, press Start, client can view live streaming from AWS Server? I don't see source code of subscriber app, can you send to me ? Or can I paste link (ex: rtmp://myhost/toPublish/streamname) to "osmf", and view live streaming by osmf ?
3. I need play a playlist video, Can I do (#row 55 of FLVPublishonLoad)
mystream.play("sample",0,-1,true);
mystream.play("sample1",0,-1,false);
mystream.play("sample2",0,-1,false);
Thanks,
Mai Huy
Copy link to clipboard
Copied
Hi Huy.
Please find your answers below:
1. You can put "FLVPublishonLoad" or "MP4PublishonLoad" on your AWS and make sure they connect with "toPublish" as localhost. Also, streams that you want to publish should be there in respective streams folder.
2. Subscriber app is a client application where you can view the published streams, you are correct, it may be an osmf player, you need to paste the link as rtmp://myhost/toPublish/streamname, streamname should be same as you have used in Stream.get() method e.g. in my case it is myvodfile
3. if you are using a playlist, and playing all the streams in a single streamobject, they all will be recorded in a single file e.g. myvodfile in above case. If you are recording all of the different streams in single stream object, you need to make sure these all different files are encoded similarly, e.g. bitrate, framerate, filesize dimensions should be similar, otherwsie resulting myvodfile may be unpredicatable.
Regards,
Shiraz Anwar
Copy link to clipboard
Copied
Hi Shiraz,
Haha, perfect, very thank you. I have done by following your way.
Cheers!
Mai Huy
Copy link to clipboard
Copied
Thanks for the confirmation Huy,
Good to know that these steps solved your problem ....
Copy link to clipboard
Copied
Hi Shiraz,
I trying to do the same thing as Huy Mai, publishing videos on the server as a live stream. i don't see and attached files in this thread. Could you also please provide me more information on how i manage the playlist and how to install the files you provided.
Copy link to clipboard
Copied
Hi Ravi,
You can look at the correct answer above, it has all the necessary code for yuor purpose. Just in case, if you want to have zip file, pelase send me your mail id as a private msg and I will forward it to you.
Regards,
Shiraz Anwar
Copy link to clipboard
Copied
Hi Shiraz,
I want expand my system (with your code). In your code, have 2 apps FLVpublishonLoad (or MP4publishonLoad) and toPublish.
FLVpublishonLoad/MP4publishonLoad play streams and send signal to toPublish, and client using RMTP connect toPublish app and view video, right ?
But when live streaming, maybe video segments has bad content. I need when I start another apps (example Advertising app, live streaming from advertising video), this app connect to toPublish, and FLVpublishonLoad app not connect toPublish (althought it still play stream video files). When Advertising app finish live streaming, toPublish connect back automatic to FLVpublishonLoad to live streaming.
Is this possible ?
sr my English not good.
Mai Huy