Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert video Input Stream to RTMP

I want to stream video recording from my android phone to network media server.

The first problem is that when setting MediaRecorder output to socket, the stream is missing some mdat size headers. This can be fixed by preprocessing that stream locally and adding missing data to stream in order to produce valid output stream.

The question is how to proceed from there.

How can I go about output that stream as an RTMP stream?

like image 971
Marko Avatar asked Apr 12 '12 12:04

Marko


People also ask

Does VLC support RTMP?

Compatibility. VLC supports RTMP and rtmp:// URLs as of version 1.1, through the avio module via the libavformat library. In past versions, use of rtmpdump was required in conjunction with VLC, but that is no longer needed after VLC 1.1.

What is the difference between RTMP and RTSP?

Both RTMP and RTSP are designed for efficient and low-latency streaming of video files. While RTMP is widely used by broadcasters, RTSP is mainly used for localized streaming from IP cameras.


2 Answers

First, let's unwind your question. As you've surmised, RTMP isn't currently supported by Android. You can use a few side libraries to add support, but these may not be full implementations or have other undesirable side effects and bugs that cause them to fail to meet your needs.

The common alternative in this case is to use RTSP. It provides a comparable session format that has its own RFC, and its packet structure when combined with RTP is very similar (sans some details) to your desired protocol. You could perform the necessary fixups here to transmute RTP/RTSP into RTMP, but as mentioned, such effort is currently outside the development scope of your application.

So, let's assume you would like to use RTMP (invalidating this thread) and that the above-linked library does not meet your needs.

You could, for example, follow this tutorial for recording and playback using Livu, Wowza, and Adobe Flash Player, talking with the Livu developer(s) about licensing their client. Or, you could use this client library and its full Android recorder example to build your client.

To summarize:

RTSP

  • This thread, using Darwin Media Server, Windows Media Services, or VLC

RTMP

  • This library,
  • This thread and this tutorial, using Livu, Wowza, and Adobe Flash Player
  • This client library and this example recorder

Best of luck with your application. I admit that I have a less than comprehensive understanding of all of these libraries, but these appear to be the standard solutions in this space at the time of this writing.

Edit:

According to the OP, walking the RTMP library set:

  • This library: He couldn't make the library demos work. More importantly, RTMP functionality is incomplete.
  • This thread and this tutorial, using Livu, Wowza, and Adobe Flash Player: This has a long tutorial on how to consume video, but its tutorial on publication is potentially terse and insufficient.
  • This client library and this example recorder: The given example only covers audio publication. More work is needed to make this complete.

In short: more work is needed. Other answers, and improvements upon these examples, are what's needed here.

like image 72
MrGomez Avatar answered Oct 02 '22 08:10

MrGomez


If you are using a web-browser on Android device, you can use WebRTC for video capturing and server-side recording, i.e with Web Call Server 4

Thus the full path would be:

Android Chrome [WebRTC] > WCS4 > recording

So you don't need RTMP protocol here.

If you are using a standalone RTMP app, you can use any RTMP server for video recording. As i know Wowza supports H.264+Speex recording.

like image 32
eeKat88 Avatar answered Oct 02 '22 07:10

eeKat88