node-rtmpapi icon indicating copy to clipboard operation
node-rtmpapi copied to clipboard

Full server sample code?

Open BhaaLseN opened this issue 10 years ago • 10 comments

Not really worth to be called an issue; but just like the other one in here, I was wondering if you could add a full server sample that actually streams something.

Just like you wrote in your blog post, most other libraries not just plain suck, but they don't have any either. They provide a server implementation, but barely anything on how to use it. To me, the spec was clear enough about how to build all the infrastructure packets, but the most important part seemed to be either missing or too obscure for me to grasp: actually delivering audio/video to the client.

The brief server sample code seems to have commands "audio" and "video", but no real reference as to how send stuff (how it is encoded, whether it needs any comtainer/framing, who determines the format, and especially who triggers the send - does the client poll for each frame or do we just keep sending?) Actually, some hints on where to find info about that would probably be enough for me; but I'm a sucker for projects that aren't just libraries, but also code that shows them in action and lets the user just dive in to see how it works.

BhaaLseN avatar Oct 04 '14 13:10 BhaaLseN

The problem for me is that I have no good way to test it in the moment. Can you propose me how to test it? The server side implementation with the given example has been tested and works well for me (basically replacing a MIST Server). I had few issues, but they were nodejs issues (lost events) that I cannot fix myself. I think they are not there anymore. The client part is essentially very similar (with the reverse logic) but I haven't being tested it and it may have some small bugs here and there. I will try to think of how to implement a simple test case and then I will write you an example

delian avatar Oct 04 '14 13:10 delian

I wrote some MJPEG streaming the other day as first step before going to RTMP, and VLC was quite happy with it. I'm pretty sure it also speaks RTMP (since its based on librtmp iirc). Or do you mean something else about testing it?

BhaaLseN avatar Oct 04 '14 14:10 BhaaLseN

I meant mostly that I have to think of combination of RTMP server and restreamer, client that I can use to verify the "user" side of the streams to try to write an RTMP client who pushes content. But now I realize I am not sure I understand what exactly you are planning to do? Are you thinking about client connected to a RTMP server expecting to receive data from the RTMP server, or you think about client to an RTMP server who pushes data to the RTMP server?

delian avatar Oct 04 '14 14:10 delian

I'm trying to tie audio/video being rendered as part of a game to a stream where others can connect to with any media client (such as VLC, MPlayer or XBMC). So basically just the server part with direct streaming, no publishing from another client.

So, pretty much: (av source) <---[RTMP]--- (client)

BhaaLseN avatar Oct 04 '14 14:10 BhaaLseN

So you just need a RTMP Server where a client as VLC connects to you and retrieve Video?

Delian

On Sat, Oct 4, 2014 at 2:23 PM, BhaaL [email protected] wrote:

I'm trying to tie audio/video being rendered as part of a game to a stream where others can connect to with any media client (such as VLC, MPlayer or XBMC). So basically just the server part with direct streaming, no publishing from another client.

— Reply to this email directly or view it on GitHub https://github.com/delian/node-rtmpapi/issues/2#issuecomment-57907000.

delian avatar Oct 04 '14 14:10 delian

Thats the idea basically. But since theres no decent C++ libraries around (that don't take gazillions of files and stuff; or have incompatible licenses), I'm ever trying to find simple and straight-forward libraries such as yours - and so far it looks great to base my port on.

I thought of doing the publishing part and just implementing a RTMP client that publishes the video to another RTMP server/restreamer, but that felt kinda odd later on (like why would we need an extra server just to do that?)

BhaaLseN avatar Oct 04 '14 14:10 BhaaLseN

Ok, My library implements just the encoding part of the RTMP protocol. It does not implement the application layer, which you have to implement yourself (the given example essentially shows how to create a server implementation pushing data to clients implementing application layer control), but that should be close to what you are looking for. VLC uses librtmp, which is a nice (but buggy) RTMP library, which also implements only the transport and the encoding layer, but not really the upper layer. So you are looking for something high level and free, that could be a problem. And the issue for all of us is named Adobe :) If you check the RTMP specs, they focus only on the transport and the encoding layer. The application control layer is not defined and the only way to do it is trough a reverse engineering. This is why it is not very easy for me to make you an RTMP client example - I am not an RTMP specialist and I have no wide knowledge on the application layer for it. Basically, one should create a test bed and then sniff it with wireshark and copy the command flow with its API. My library allows that to copy something in a relatively easy way but it does not implement the upper layer protocol on itself. However, you are now giving me an idea. If I can find a way to implement a robust client and robust server side on a upper layer, I can publish them as a separate NPM modules that just depend on those I have published.

Delian

On Sat, Oct 4, 2014 at 2:32 PM, BhaaL [email protected] wrote:

Thats the idea basically. But since theres no decent C++ libraries around (that don't take gazillions of files and stuff; or have incompatible licenses), I'm ever trying to find simple and straight-forward libraries such as yours - and so far it looks great to base my port on.

I thought of doing the publishing part and just implementing a RTMP client that publishes the video to another RTMP server/restreamer, but that felt kinda odd later on (like why would we need an extra server just to do that?)

— Reply to this email directly or view it on GitHub https://github.com/delian/node-rtmpapi/issues/2#issuecomment-57907263.

delian avatar Oct 04 '14 14:10 delian

Ok, now that explains why I didn't really find anything about that in the RTMP spec directly. And now all the other code makes a lot more sense too. Thanks for taking the time to reply, I think we can close this issue then (why doesn't GitHub offer private messages or something similar instead?) - unless you want to keep it open as reminder for the new ideas.

BhaaLseN avatar Oct 04 '14 14:10 BhaaLseN

Lets keep it open for now. I really like to implement examples but for that I need to make myself a working test system with other software, so if something does not work as I expect, I could be able to do a little reverse engineering there and just copy the command flow

Delian

On Sat, Oct 4, 2014 at 2:45 PM, BhaaL [email protected] wrote:

Ok, now that explains why I didn't really find anything about that in the RTMP spec directly. And now all the other code makes a lot more sense too. Thanks for taking the time to reply, I think we can close this issue then (why doesn't GitHub offer private messages or something similar instead?) - unless you want to keep it open as reminder for the new ideas.

— Reply to this email directly or view it on GitHub https://github.com/delian/node-rtmpapi/issues/2#issuecomment-57907629.

delian avatar Oct 04 '14 14:10 delian

Just leaving a comment here so I'm subscribed to this.

My basic requirements would be to take a audio stream and publish it. Being node based it I'm guessing once someone has got a basic server going it'll be easy to use events to authenticate users. I currently only need Speex.

virtualfunction avatar Nov 09 '14 04:11 virtualfunction