How do I post parameters to stream with ffmpeg

513 views
Skip to first unread message

Piotr Kuzminski

unread,
Jan 23, 2015, 4:40:20 PM1/23/15
to red5in...@googlegroups.com
Hi,

Is is possible to post any parameters to RED5 using ffmpeg?
FFFMPEG says that:
https://www.ffmpeg.org/ffmpeg-protocols.html#toc-rtmp

1. So this shouldn’t be valid?
ffmpeg -i input_file -f flv "rtmp://user:pass...@127.0.0.1/oflaDemo/video"

But it does not working.

2. Or maybe additional parameters:
ffmpeg -i input_file -f flv "rtmp://127.0.0.1/oflaDemo/video?arg1=val1&arg2=val2"

Is there any way to send parameters with ffmpeg? I have tried may options but nothing seems to work.

Piotr Kuzminski

unread,
Jan 23, 2015, 4:51:08 PM1/23/15
to red5in...@googlegroups.com
My bad!
I was using string:

And that gave me error:
rtmp server sent error

But when I added value to argument it is working properly, so do like this:

Hope this will help someone.

Piotr Kuzminski

unread,
Jan 24, 2015, 7:14:41 AM1/24/15
to red5in...@googlegroups.com
So my next question is how and when do I read those parameters?
Do I read them at streamPublishStart form IBroadcastStream object?
Or do I read them appConnect from IConnection object?


W dniu piątek, 23 stycznia 2015 22:40:20 UTC+1 użytkownik Piotr Kuzminski napisał:

MJ

unread,
Jan 25, 2015, 8:53:48 PM1/25/15
to red5in...@googlegroups.com

Yes , it is possible. 
and check this documentation : 

if you're using the latest ffmpeg , you should keep the rule of parameter. 

check rtmp_conn

.

Rajdeep Rath

unread,
Jan 25, 2015, 9:42:02 PM1/25/15
to red5in...@googlegroups.com
Parameters are passed on the connection object not stream object. Although you can read connection anywhere using red5 getconnectionlocal but it's best to read it in connect or appconnect methods. 

Check: conn.getConnectParams().get("queryString") 
--  

---
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.

Piotr Kuzminski

unread,
Jan 26, 2015, 4:32:06 AM1/26/15
to red5in...@googlegroups.com
Thank you Rajdeep Rath!
Thanks to your answer I found and followed this topic:
https://groups.google.com/forum/#!msg/red5interest/2lZuuZX4iMc/sAT0u1ffAfQJ

But when I do this:
    public boolean appConnect(IConnection conn, Object[] params) {
       
String parameters = String.valueOf(conn.getConnectParams().get("queryString"));
       
        log
.info("connected with parameters: "+parameters);
        log
.info("total clients  "+conn.getScope().getStatistics().getTotalClients());
   
}

And than I post:
ffmpeg -f x11grab -s 640x480 -r 24 -i :0.0+600,120 -c:v libx264 -fflags nobuffer -preset fast -pix_fmt yuv420p -minrate 50k -maxrate 100k -bufsize 200k -s 640x480 -threads 0 -f flv "rtmp://127.0.0.1/test/glosno?are=yousure&not=4sure"

And here's what I got:
[INFO] [RTMPConnectionExecutor#5W56JWZSNQLWL-1] org.red5.demos.test.Application - connected with parameters: null
[INFO] [RTMPConnectionExecutor#5W56JWZSNQLWL-1] org.red5.demos.test.Application - total clients  0


Seems it does not working. I'm using 1.0.4 red5 version.

Am I doing something wrong?




W dniu piątek, 23 stycznia 2015 22:40:20 UTC+1 użytkownik Piotr Kuzminski napisał:
Reply all
Reply to author
Forward
0 new messages