User data within RTMP/RTMPT live stream

427 views
Skip to first unread message

Mikhail Yaropolov

unread,
Oct 21, 2014, 3:08:48 AM10/21/14
to red5in...@googlegroups.com
Hi! I will appreciate any help on my issue!

Say, I have an RTMP live stream sent to Red5 from ffmpeg. Flash client is a custom player which uses AS3 NetStream API. And I want to put some additional data to that stream on the server side, like momentary loudness. This data has to be well synced with video. And I should be able to extract that data on the Flash client side, to immediately show that data to a user.

Please, provide some tips or tutorials of how can I achieve this.

I know, FLV is not the type of container you can add extra data to. MP4 seems to be appropriate, according to wiki page. Using custom player, I tried to play an MP4 video with subtitles embedded, but on the client side NetStream client didn't receive onTextData.

My question on stackoverflow

Thanks

Chris Allen

unread,
Oct 21, 2014, 11:49:41 AM10/21/14
to red5in...@googlegroups.com
Take a look at NetStream.send() in AS 3. You should be able to send out messages on the stream that all subscribers will receive. No need to write anything in the server side. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html

Sent from my iPhone
--

---
You received this message because you are subscribed to the Google Groups "red5" group.
To unsubscribe from this group and stop receiving emails from it, send an email to red5interest...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mikhail Yaropolov

unread,
Oct 22, 2014, 6:43:47 AM10/22/14
to red5in...@googlegroups.com
Thanks for your reply, Chris.
Since I have to use server side as a source of extra data (either stored in Red5 or somehow embedded directly into video container), rephrasing your suggestion, should I stick to sending messages from Red5 to a stream so subscribers of the stream could receive those messages?
Is that what you mean?

Chris Allen

unread,
Oct 22, 2014, 11:08:52 AM10/22/14
to red5in...@googlegroups.com
I'm a tad bit confused as to what you mean by "I have to use server side as a source of extra data". However, maybe you are confused about the way the NetStream.send method works. Basically it allows you to inject data into the stream live and it persists the data on the server if you choose to record the file. OR you can use something called Cue Points.

Are you dealing with prerecorded video instead of live though? If that's the case you should be able to generate FLVs with these data points stored in them that you can gain access to in Flash from the NetStream events. The term Adobe used for this is Cue Points. Here's an example of accessing the cue points via ActionScript: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d3f.html. And here's how you can add Cue Points to your FLV video: http://www.mediacollege.com/adobe/flash/video/cuepoints.html.

I hope that helps. Good luck!

-Chris

Rajdeep Rath

unread,
Oct 22, 2014, 2:39:57 PM10/22/14
to red5in...@googlegroups.com

Mikhail first thing, do you want to do this in live stream session or vod session ?

What I think is you want to push metadata to live stream from the server. Is that so ?

Mikhail Yaropolov

unread,
Oct 23, 2014, 6:54:39 AM10/23/14
to red5in...@googlegroups.com
The stream is live. It goes to ffmpeg, ffmpeg encodes it with h264 codec, packs into flv container, and sends output to Red5 over rtmp like so rtmp://localhost/app/stream_name.

What I want to achive is that I could inject extra data into the stream (subtitle, frame description, any text) at some frames/points. And I want to show this text while user plays this live stream with Flash player.

Chris, thanks for pointing to cue points. But I couldn't find info about injectiong them live.

Mikhail Yaropolov

unread,
Oct 23, 2014, 6:59:42 AM10/23/14
to red5in...@googlegroups.com

The stream is live. It goes to ffmpeg, ffmpeg encodes it with h264 codec, packs into flv container, and sends output to Red5 over rtmp like so rtmp://localhost/app/stream_name.

What I want to achive is that I could inject extra data into the stream (subtitle, frame description, any text) at some frames/points. And I want to show this text while user plays this live stream with Flash player.


Rajdeep Rath

unread,
Oct 23, 2014, 10:41:48 AM10/23/14
to red5in...@googlegroups.com

Hmm,

I have seen this in wowza but not much idea on how to do this using red5. It's server side continuous metadata injection problem.

In flash there can be 3-4 types of metadata methods on the netstream client. You can find it in as3 api for netstream client.

However if you want you can invoke methods on connection client of the flash netconnection from red5.

See this https://red5.googlecode.com/svn/java/example/trunk/fitcDemo/src/org/red5/demos/fitc/Application.java

For ServiceCapableConnection. You can then invoke methods on netconnection client of flash.

Another way would be to have a sharedobject created via red5 that the clients subscribe to. Then you can push the data to client over the sharedobject quiet possibly in realtime timeframes.

On flash side receieve data and do what you want with it.

The perfect method would be do send message over the stream object from server side. But I don't know how to do that in red5.

Regards
Rajdeep Rath

Mikhail Yaropolov

unread,
Oct 24, 2014, 4:39:34 AM10/24/14
to red5in...@googlegroups.com
Thanks, Rajdeep

Sending messages manually from Red5 to the stream subscribers seems to be the only opportunity to get extra data along live stream.
Such an approach will require additional logic for syncing video and custom data.
I'm going to try that.

Regards

Rajdeep Rath

unread,
Oct 24, 2014, 5:42:35 AM10/24/14
to red5in...@googlegroups.com
All the best :)
Reply all
Reply to author
Forward
0 new messages