How to use RTMP for Video/Audio/Image capture? - actionscript-3

On video/audio/image capture we using net connection like
nc.connect("rtmp://localhost/vmspeak");
Can anyone explain what is this and its use. In new project how to use?

You need the Adobe Flash Media Server (FMS).
The development edition is free (even for commercial usage) and allows 10 simultaneous connections.

RTMP stands for Real Time Messaging Protocol.
Real Time Messaging Protocol (RTMP) was initially a proprietary protocol developed by Macromedia for streaming audio, video and data over the Internet, between a Flash player and a server. Macromedia is now owned by Adobe, which has released an incomplete version of the specification of the protocol for public use.

Related

HTML5 <video> tag: RTMP streaming without Flash?

I am building a video-site for long lecture recordings. So a streaming server is a must. We only have to support newest browsers, which support the HTML5 <video> tag. So when the stream is done via RTMP protocol (Red5 server for example), will clients have to have adobe flash installed or is a browser capable of the <video> tag enough?
I think that for a simple video streaming service (for VOD) you are not forced to use a streaming server (like AMS, Wowza, Red5, ...) just a HTTP server (like Apache, nginx, ...) with a good configuration and some special modules (like nginx ngx_http_mp4_module, H264 Streaming Module for Apache, ...) can do the job because it can provide a HTTP stream available for Flash Player and HTML5.
So for your question, you should know that to play an RTMP stream on a browser, you should have Flash Player, HTML5 can not play it. That's why you have to provide a HTTP stream for HTML5 based video player. After that, you can use a Flash to HTML5 fallback or the inverse.
Hope that can help.
In case anyone else ends up here looking for a non-Flash solution for a non-http-based protocol i.e. RTSP (beware that OP asks for RTMP) here's a solution https://github.com/Streamedian/html5_rtsp_player.

Display RTSP stream in Adobe AIR

I am working on a project that involves displaying video feed from an IP camera using Adobe AIR. I know that Flash does not have a native support of RTSP protocol and therefore I am evaluating all possible routes I can take to solve this issue:
Use Adobe Media Server to convert incoming RTSP stream to RTMP and then use Flash API (NetConnection & NetStream) directly.
Write a custom class to fetch, decode and display the stream in adobe AIR. [I am unable to confirm if this is possible due to insufficient info on the net]
Give up on RTSP and instead fetch JPEG/MJPEG sequence of images and display them in AIR relatively easily but with doubtful live performance. [due to JPEG/MJPEG refresh interval of IP camera and same interval separately in AIR]
Use DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras to process the JPEG/MJPEG stream, create a virtual Webcam device (the filter does this automatically) and then use Camera class to display the video feed in AIR.
Use webcam 7 - A software designed to handle RTSP, JPEG/MJPEG and other stream protocols for many camera brands/models. It installs a driver in system that creates a virtual camera, and that all the other applications can then use as a normal webcam.
Unfortunately this software is buggy and often becomes unstable (could be with my particular camera model only though) and might even crash.
Are there any better, easier options that might not require any third-party software?
EDIT:
In case anybody else bumps into same problem:
As suggested by Rudolfs Bundulis, I decided to write a NativeProcess (ANE) that uses FFMPEG to fetch the RTSP stream data, transcode it, and feed it to Flash player.
You might want to look at these for more specific steps:
http://www.purplesquirrels.com.au/2013/02/converting-video-with-ffmpeg-and-adobe-air/
https://www.youtube.com/watch?v=6N7eN9wvAGQ
Take the route described in option 2 - write a Adobe AIR native extension (ANE) that uses FFMpeg to handle the RTSP stream, decode it and pass the RGB data back to AIR for rendering. The hardest part would be compiling FFmpeg if you need cross platform functionality, however, since you mention DirectShow that is Windows only, then I assume you are bound to Windows. Zeranoe provides prebuild FFmpeg libraries for Windows, Stackoverflow has a lot of topics on decoding a stream using FFmpeg and then all you need is a callback to AIR and you're good.

Available Functions on FMS Server

I have a chat client that uses FMS server. I do not know how many more functions are on FSM that I can utilize. There is 0 documentation for the available FMS server. Is there a way to browse or query all the available features/functions of Adobe FMS server?
Also some of the chatters crashes my flash play remotely. I think, they are just overflowing the buffer? Is it the case? or how anyone can remotely crash my flash player? This only happens if I kick any of the specific user using the command /kick user.
FMS has pretty good doc at FMS API. But functions you want depend of who implemented server side for you.
Crash might be caused of your chat implementation. You need to find initial developer to fix that.

How to customize stream protocol to flash client

I need to create a custom communication between server and flash client. For example I want to write UDP protocol using error correction. It is much faster than TCP and does not suffer from routing problem. Unfortunately I absolutely cannot think of how to replace the existing way:
_stream = new NetStream(_connection);
_video.attachNetStream(_stream);
This encloses all communication and I do not have a control over it. I understand that I can use appendBytes, but not sure what exactly to pass to this function. I can do anything on the server side. My video is H.264 and audio is ACC.
Unless it's a AIR application, you can't. It's native API which already handling application layer (OSI model).
If you want make your own, using flash.net.DatagramSocket class (available in AIR 2+) for your application layer and NetStream.appendBytes for audio/video stream decoding & playback (feeded with FLV/F4V chunks)
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/DatagramSocket.html
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#appendBytes%28%29
I was betting on UDP, but never got it working in Flash. I'll explain it:
In your browser, there is really no way to make usage of UDP!!! Flash applications there run in a sandbox, which only talk TCP!
Air is used for desktop applications, which after compilation run in a desktop wrapper, which itself has direct access to the socket and other possibilities.
That's it! You have to use TCP.

whats the difference between stratus and flash media server 4

I want to create a simple video chat application using rtmfp the new p2p feature. It's available in flash media server 4 and using stratus, I've only been able to find tutorials on stratus. So my question is if I want to use the p2p feature in flash media server 4 do I have to signup for stratus and use its api or does fms 4 have its own api?
What is your goal? If you need to make just a videochat, you can use FMS only, without stratus. Just connect to server, perform connection accept on serverside, and then you can use publish and play methods of NetStream class. But if you want to perform videochat through p2p, than you do not need FMS (because the main idea of p2p - communication without server), but still you can use FMS for managing clients, and perform video streaming through stratus.