Re: GSTREAMER to RTMFP, publish stream from gstreamer to Cumulus

1,050 views
Skip to first unread message
Message has been deleted

Mathieu Poux

unread,
Nov 15, 2013, 8:46:03 AM11/15/13
to openrtmf...@googlegroups.com
Following a very short server application to allow to receive a stream sending by gstreamer, and create a cumulus publication with (to be readen by RTMFP clients with NetStream::play of course):

socket = cumulus:createUDPSocket()
function socket:onReception(data, address)
-- consider just video and audio packets
if data:byte(1) ~= 0x09 and data:byte(1) ~= 0x08 then return end
-- compute time
local time = data:byte(5)*65536+data:byte(6)*256+data:byte(7)
if not starttime or starttime>time then starttime = time end
time = time-starttime
if not lasttime or time<lasttime then
-- start or restart publication
if testpublication then testpublication:close() end
testpublication = cumulus:publish("file")
if not testpublication then error("already published") end
end
lasttime = time

-- publish
if data:byte(1)==0x09 then
testpublication:pushVideoPacket(time, data,11) -- offset 11
else
testpublication:pushAudioPacket(time, data,11) -- offset 11
end
testpublication:flush()
end
err = socket:bind("0.0.0.0:6666") -- start the server
if err then error(err) else NOTE("Starting UDP socket on 6666 port") end

On gstreamer side, following three illiustrations of line-command which works:

-- audio AAC stream
gst-launch-0.10 audiotestsrc is-live=true ! faac ! audio/mpeg,mpegversion=4 ! flvmux ! udpsink port=6666

-- video H264 stream
gst-launch-0.10 videotestsrc is-live=true do-timestamp=true ! x264enc bitrate=128 tune=zerolatency profile=baseline ! flvmux ! udpsink port=6666

-- AAC + H264 stream
gst-launch-0.10 videotestsrc is-live=true do-timestamp=true ! x264enc bitrate=128 tune=zerolatency profile=baseline ! mux. audiotestsrc is-live=true ! faac ! audio/mpeg,mpegversion=4 ! mux. flvmux name=mux ! udpsink port=6666

Enjoy ;-) 

Patrick

unread,
Nov 25, 2013, 3:10:48 PM11/25/13
to openrtmf...@googlegroups.com
I haven't tried this yet but it looks like a very elegant integration. Thank you!

Misko Dzamba

unread,
Apr 27, 2014, 2:12:45 AM4/27/14
to openrtmf...@googlegroups.com
Hi Mathieu,
Thank you for taking the time and posting this. I am trying to get a video feed from my raspberry pi to webclient using RTMFP. Gstreamer connects and Cumulus is receiving the data but I am having trouble getting the video feed rendered in a browser. I am a little new in this area and I have tried to use flowplayer flash, more specifically its p2p example that uses a rtmfp url. I have so far had no luck. 


Is there any web player you can recommend for viewing the video feed from RTMFP? or any player at all?

Do you know what might be going wrong with flowplayer connected to the RTMFP feed? I see requests from flowplayer in Cumulus interleaved with data coming in from the PI, the time bar on flow player moves forward, but I see no video feed.

When using the same gstreamer pipeline and RTMP/nginx/flowplayer everything works, but has about 2 second latency. I was hoping to move this down using RTMFP.

Thank you for your time!


On Friday, November 15, 2013 8:46:03 AM UTC-5, Mathieu Poux wrote:

Janis Zemitis

unread,
May 3, 2014, 3:57:57 PM5/3/14
to openrtmf...@googlegroups.com
Hey Misko, 

let me know if you get it to work as I am also struggling with getting flowplayer to play the stream. 

In regards of nginx+RTMP , be sure to set flowplayer's bufferlength and buffer time to 0:

bufferLength: 0.0, 
bufferTime: 0.0, 

also keep in mind that these values are only supported from flowplayer 3.2.18 I think(http://releases.flowplayer.org/swf/flowplayer-3.2.18.swf). Read about this some while ago on flowplayer forums where someone requested such an option. I manage to get under 1 second delay with these options on, so if  you still end up with higher delay the bottleneck might be the RPi. 

My problem with RTMP is that whenever we drop packets they are resent by the server, increasing the delay over time. Thus hoping on rtmfp as it's UDP based. 

Thomas Jammet

unread,
May 15, 2014, 1:48:44 PM5/15/14
to openrtmf...@googlegroups.com
I'll try to help you Misko,

Can you tell me what is the command that you use?

I use the one below for testing sound and video and it works well :
gst-launch videotestsrc pattern=smpte is-live=true ! timeoverlay font-desc="Serif,Medium 40" color=4294901760 ! x264enc bitrate=128 tune=zerolatency ! queue ! mux. audiotestsrc wave=ticks ! audioconvert ! speexenc ! queue ! mux. flvmux name=mux ! udpsink port=6666 host=192.168.0.20

Don't forget to start the gst-launch command after Cumulus.

And for a very simple video player you can try this one :

Don't try the "Http progressive" part, it is only for MonaServer.
Address is the address of Cumulus application and Title will be "file" with the lua script from Mathieu.
The source code of the player is in http://jammetthomas.free.fr/VideoPlayer/

I hope it will help you!


--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "OpenRTMFP Cumulus".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse openrtmfp-cumu...@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Anton

unread,
Jul 15, 2014, 2:09:59 PM7/15/14
to openrtmf...@googlegroups.com
Hi Thomas and Mathieu,

thank you for all your hard work on this.

I've been trying to get this example to work. I'm very new to rtmfp/streaming video in general, but basically I'm trying to do exactly what this example describes (with a real stream instead of videotestsrc, but I know how to do that part). I downloaded the windows binaries, copied Mathieu's server script to www\main.lua, copied Thomas's gstreamer command exactly (minus the "host=" part), and tried to view the stream in the video player above (Address: "rtmfp://127.0.0.1", Title: "file").

I get:

NOTE  RTMFPServer[119] RTMFP server starts on 1935 port
NOTE  www/main.lua[26] Starting UDP socket on 6666 port
INFO  Sessions[122] 1 clients

So the player connects to the server, but I don't see any video.

I start CumulusServer first, then the gstreamer pipeline.
I made sure UDP ports 6666 and 1935 are open.

Is there anything I'm missing?

Thanks in advance!

Anton

Thomas Jammet

unread,
Jul 16, 2014, 4:34:56 AM7/16/14
to openrtmf...@googlegroups.com
Hello Anton,

I think that you must let the "host" parameter with the correct address of the Cumulus/Mona server.

Then you should run Cumulus with full log informations :
CumulusServer --log=7

And finally you must reload the gstreamer command and verify that you see the same logs that you can see here (in green) :

Tell us about your results!

Thomas

Anton

unread,
Jul 16, 2014, 5:43:43 PM7/16/14
to openrtmf...@googlegroups.com
Hi Thomas,

thanks for the reply!

I added "host=127.0.0.1" as a parameter for updsink (I think that's what it defaults to if you don't specify a host, no?)
I changed the port number to 1985 in CumulusServer.ini, making sure that that UDP port is also open. I also tried changing the buffer size to 65535 to match your screenshot, that didn't help.

Here's what I get with the "/log=7" option:

16/07 14:17:43.4  DEBUG    (7320)    Invoker.cpp[29]  4 threads available in the server poolthreads
16/07 14:17:43.5  DEBUG    (7320)    RTMFPServer.cpp[63]  Id of this RTMFP server : 9c27192df3103cc473eedb85378f3ebc861a977a5c009089a78676680f2e9d58
16/07 14:17:43.5  DEBUG    (7320)    Server.cpp[70]  Configuration scripting conversion: Not found: system.env
16/07 14:17:43.5  DEBUG    (7320)    RTMFPServer.cpp[104]  Socket buffer receving/sending size = 114688/114688
16/07 14:17:43.5  NOTE    RTMFPServer(7024)    RTMFPServer.cpp[119]  RTMFP server starts on 1985 port
16/07 14:17:43.5  NOTE    RTMFPServer(7024)    www/main.lua[26]  Starting UDP socket on 6666 port
16/07 14:18:27.4  DEBUG    RTMFPServer(7024)    RTMFPServer.cpp[198]  Handshaking
16/07 14:18:27.5  DEBUG    RTMFPServer(7024)    RTMFPServer.cpp[198]  Handshaking
16/07 14:18:27.7  DEBUG    PoolThread2(5772)    CookieComputing.cpp[52]  Shared Secret : fee8c65bd8d3d091d54e1faa4803a4f0cecda5fa6d820bac5df77ca2dcf6f8477825c26b
e168a6378db61970be7d0c2c00c62778b4078df897a5335d324483c46db9c7c04866d379
d39f5b63ca1a15cf0f364dfee8a749e5c67b259cc38d5eeabe36105a2c1dfdcd0776e928
beb412e9862cf02614937db16d5a1f8a9dba28e2
16/07 14:18:27.7  DEBUG    RTMFPServer(7024)    Sessions.cpp[59]  Session 1 created
16/07 14:18:27.7  DEBUG    RTMFPServer(7024)    ServerSession.cpp[563]  New flowWriter 2 on session 1
16/07 14:18:27.7  DEBUG    RTMFPServer(7024)    ServerSession.cpp[550]  New flow 2 on session 1
16/07 14:18:27.7  DEBUG    RTMFPServer(7024)    Streams.cpp[87]  New stream 1
16/07 14:18:27.7  DEBUG    RTMFPServer(7024)    ServerSession.cpp[563]  New flowWriter 3 on session 1
16/07 14:18:27.7  DEBUG    RTMFPServer(7024)    ServerSession.cpp[550]  New flow 3 on session 1
16/07 14:18:27.7  DEBUG    RTMFPServer(7024)    Publication.cpp[29]  New publication file
16/07 14:18:27.7  DEBUG    RTMFPServer(7024)    ServerSession.cpp[563]  New flowWriter 4 on session 1
16/07 14:18:27.7  DEBUG    RTMFPServer(7024)    ServerSession.cpp[563]  New flowWriter 5 on session 1
16/07 14:18:27.7  DEBUG    RTMFPServer(7024)    Listener.cpp[150]  Writing bound 0 on flow writer 5
16/07 14:18:27.8  DEBUG    RTMFPServer(7024)    Listener.cpp[150]  Writing bound 0 on flow writer 4
16/07 14:18:27.8  DEBUG    RTMFPServer(7024)    Listener.cpp[150]  Writing bound 0 on flow writer 3
16/07 14:18:29.5  INFO    RTMFPServer(7024)    Sessions.cpp[122]  1 clients

So that's quite a bit more than what's in your screenshot, but all the lines that are in the screenshot seems to be in my output as well.

And here's my gstreamer output:

C:\Users\sink301\Documents\gstreamer\0.10\x86_64\bin>gst-launch-0.10 videotestsr

c pattern=smpte is-live=true ! timeoverlay font-desc="Serif,Medium 40" color=429
4901760 ! x264enc bitrate=128 tune=zerolatency ! queue ! mux. audiotestsrc wave=
ticks ! audioconvert ! speexenc ! queue ! mux. flvmux name=mux ! udpsink port=66
66 host=127.0.0.1
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Redistribute latency...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

Any ideas?

Thanks again!

Anton

Pavel Lepeev

unread,
Sep 17, 2014, 10:08:20 PM9/17/14
to openrtmf...@googlegroups.com
Hello, Anton.
Have you fixed your issue?

четверг, 17 июля 2014 г., 1:43:43 UTC+4 пользователь Anton написал:

Thomas Jammet

unread,
Sep 23, 2014, 8:59:21 AM9/23/14
to openrtmf...@googlegroups.com
Hello Pavel,

I have no news from Anton. Do you have the same issue? Have you tried with "filesink location=file.flv"?

Thomas
Reply all
Reply to author
Forward
0 new messages