cychiang / webcamstudio

Automatically exported from code.google.com/p/webcamstudio
GNU General Public License v3.0
1 stars 0 forks source link

rtmp source - feature request #106

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.this is a feature request
2.
3.

What is the expected output?

Use rtmp source as input
For instance use an application like BroadcastMe (available on Android). this 
application looks for an RTMP server (to be specified with the 
rtmp://IP_address_server/mystreamname)
It would be great if I could arrange for a custom input that accommodates this.
It may be already possible, with the custom file example provided, but I'm not 
sure

What do you see instead?

The Operating system you are using (Linux, Windows etc)?
Ubuntu Studio 10.13

What version of WebcamStudio are you using?
0.65

What version of Java are you using?
OpenJDK 7

What is your Webcamera vendor, model and version?
IP camera application on mobile phone

For *nix users please enter the output from "sudo lsusb"?
Not relevant as this is a feature request

Original issue reported on code.google.com by skickm...@gmail.com on 9 Mar 2014 at 11:38

GoogleCodeExporter commented 9 years ago
Hi, have you tried to add an URL-StreamPanel, change the back-end to Gstreamer, 
put the rtmp link in the text field and play it?
let me know.
Thanks.
karl.

Original comment by soylent...@gmail.com on 10 Mar 2014 at 4:03

GoogleCodeExporter commented 9 years ago
Hi Karl,

I tried this, but no luck..
I'm not sure what rtmp link to insert.
ffmpeg can act as the rtmp server, but what is the address/link I should use?

Best regards,
RJ

Original comment by skickm...@gmail.com on 11 Mar 2014 at 4:27

GoogleCodeExporter commented 9 years ago
Hi skickmail,
 I think you have to bring up an RTMP server but i don't know if IceCast2 or red5 can do that (you have to dig a bit ...).
Then you can send the stream from Android to the server via rtmp.
Finally you can get the source from RTMP server into WebcamStudio thought the 
URL-StreamPanel.
I search a little but i only found an FFmpeg command line that get RTMP as 
input and outputs few other streaming formats.

https://gist.github.com/bnerd/4069082

I really don't know if it acts like a server but I hope this can help, 
otherwise you have to study well streaming servers like Icecast red5 or nginx 
...
Let me know.
karl

Original comment by soylent...@gmail.com on 11 Mar 2014 at 5:28

GoogleCodeExporter commented 9 years ago
I forgot to ask you if you have tried to use WebcamStudio URL-StreamPanel 
changing the backend to Gstreamer, maybe it works ...
karl

Original comment by soylent...@gmail.com on 11 Mar 2014 at 5:53

GoogleCodeExporter commented 9 years ago
Hi Karl,

Sorry for the late reply. I was pulled into another project.
In the mean time I have installed nginx as this seems to be a very efficient 
server.
I configured it with the rtmp module.
I'm able to send rtmp streams to the server (with cameras you can get for 
Android phones) and convert the incoming stream to basically any video format I 
like.
VLC player is able to play back the resulting stream from the server.
For instance, I link VLC to rtmp://localhost/small/test and it will play the 
video from the nginx server.

So I wanted to point WebcamStudio to the same source to take this in as one of 
the video sources.
Unfortunately I was not able to.
I used URL-Streampanel and provided the same rtmp url as what I did with VLC

I've tried the various suggestions with different back-ends, but this did not 
offer a solution.
If you have any ideas, I'd welcome to hear them.

RJ

Original comment by skickm...@gmail.com on 27 Apr 2014 at 11:22

GoogleCodeExporter commented 9 years ago
Hi RJ,
 maybe i understand .. if you are using Ubuntu 14.04 the support for h264 in gstreamer 0.10 is broken ... WS uses gstreamer to get rtmp or rtsp, so i have to switch the commands to gstreamer 1.x ... I also think that the gst-launch command i used is not so well written ... and maybe WS can't open the link anyway ...
Thanks for the feedback, i'm working on it.
karl.

Original comment by soylent...@gmail.com on 28 Apr 2014 at 4:24

GoogleCodeExporter commented 9 years ago
Hi RJ,
 (Anyway I have added you to the About/Credits of WebcamStudio as "skickmail", is better "RJ" I think ?) :)
I have something you can test and hope it works ...
I rewrite all gst-launch rtmp related command in 1.x format. 
Can you try this jar:

https://drive.google.com/file/d/0BxkZ_wh6t7jbNFJsUGVBdUNra1k/edit?usp=sharing

Please let me know.
Thanks.
karl.

Original comment by soylent...@gmail.com on 28 Apr 2014 at 7:55

GoogleCodeExporter commented 9 years ago
Hi Karl,

Thanks for adding me to the about/credits. I'd prefer RJVisser if that is OK :-)

I downloaded the new jar but was not able to get it to accept the rtmp stream 
from the nginx server. 
Here's what I tried:
start nginx server
check video stream from the server with VideoLAN: worked
used the same rtmp link in 'Add URL stream' window - backend AVConv: did not 
work
stopped the attempt to play-back
changed the backend to GStreamer
tried to play-back: did not work...

as a reference, here's the conversion setting I used on the nginx server 
application:

exec /usr/bin/avconv -re -i rtmp://localhost:1935/$app/$name -vcodec libx264 
-preset veryfast -b:v 2000k -maxrate 2000k -bufsize 2000k -sws_flags lanczos -r 
30 -acodec copy -f flv rtmp://localhost:1935/small/${name};

the application on the Android phone is: Video Broadcaster + 1.03
I selected this as it offers good options to optimize the video stream to the 
nginx server. Even upto 60 frames per second.
- as a side-note: it would be great if WS could be set to allow 60 fps as well.

Let me know whether there is anything I may have done to the video stream 
(format) that makes it impossible for WS to display the contents. I can change 
the instructions on the server to accommodate a different output as well.

Cheers,

RJ Visser

Original comment by skickm...@gmail.com on 4 May 2014 at 10:45

GoogleCodeExporter commented 9 years ago
Karl, 

Here's the content shown when I start the WS application:

Welcome to WebcamStudio 0.65 build 538 ...
Overall Audio Output set to: 44100Hz
Distro: ubuntu
Init AudioOut ...
SinkAudio registered.
Port used is Video:0/Audio:51332
Command Out: gst-launch-1.0 tcpclientsrc port=51332 ! audio/x-raw, 
format=S16BE, channels=2, rate=44100 ! audioconvert ! alsasink
Output aborted...
V: 0
A: 0
AudioOut Audio Cleared ...
AudioOut Audio Cleared ...
AudioOut unregistered.
May 04, 2014 5:17:13 PM webcamstudio.media.renderer.Exporter$2 run
SEVERE: null
java.net.SocketException: Socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
    at java.net.ServerSocket.implAccept(ServerSocket.java:530)
    at java.net.ServerSocket.accept(ServerSocket.java:498)
    at webcamstudio.media.renderer.Exporter$2.run(Exporter.java:110)
    at java.lang.Thread.run(Thread.java:744)

Audio output stopped

then when I add the 'Add URL stream' and select play:
SourceURL registered.
CommandVideo: gst-launch-1.0 rtmpsrc location="rtmp://localhost/outp/test" ! 
decodebin ! videoconvert ! videoscale ! videorate ! video/x-raw, format=RGB, 
framerate=30/1, width=800, height=480 ! videoconvert ! tcpclientsink port=38068
CommandAudio: gst-launch-1.0 rtmpsrc location="rtmp://localhost/outp/test" ! 
decodebin ! audioresample ! audioconvert ! audio/x-raw, format=S16BE, 
channels=2, rate=44100 ! audioconvert ! tcpclientsink port=52363

hope this helps

Cheers,
RJ

Original comment by skickm...@gmail.com on 5 May 2014 at 12:23

GoogleCodeExporter commented 9 years ago
Hi RJ,
 thanks for the feedback :)
I will update your name in About/infos of WS, of course ;)
Can you please test this command from a terminal (While your streaming server 
is running):

First there is the video part:

$ gst-launch-1.0 -v rtmpsrc location="rtmp://Your-RTMP-Stream-Source" ! 
decodebin ! videoconvert ! videoscale ! videorate ! video/x-raw, format=RGB, 
framerate=25/1, width=720, height=480 ! videoconvert ! autovideosink

... and see if the video window pops up displaying your stream ... 
If not, please post any errors ...

Second, terminate the previous command with CTRL+C and fire the audio part:

$ gst-launch-1.0 -v rtmpsrc location="rtmp://Your-RTMP-Stream-Source" ! 
decodebin ! audioresample ! audioconvert ! audio/x-raw, format=S16BE, 
channels=2, rate=44100 ! audioconvert ! autoaudiosink

... and check if the audio start playing ...
If not, please post any errors ...

Thanks a lot !!!
karl.

Original comment by soylent...@gmail.com on 5 May 2014 at 3:41

GoogleCodeExporter commented 9 years ago
Hi RJ,
 in this testing jar i tried to implement avconv or ffmpeg backends to grab rtmp and rtsp:

https://drive.google.com/file/d/0BxkZ_wh6t7jbcFh6YVdwQ0JTMG8/edit?usp=sharing

Now if you switch between backends in the URL Stream-Panel, the command will 
follow the right choice.
Let me know.
thanks.
karl

Original comment by soylent...@gmail.com on 13 May 2014 at 7:37

GoogleCodeExporter commented 9 years ago
Hi Karl,

Thanks!
I did not have the time yet to try these out.
I'll be ablemto get to it this weekend and let you know.
I'm sure the option to use the different backends is going to be helpful.
Cheers,
RJ

Original comment by rjvis...@gmail.com on 14 May 2014 at 2:48

GoogleCodeExporter commented 9 years ago
Thanks RJ,
 there is no hurry ... :)
I'm the sick one .... :D
Leave this testing at the end of the list ... You already gave me a lot of very 
useful feedbacks.
Have a good day.
karl

Original comment by soylent...@gmail.com on 14 May 2014 at 3:39

GoogleCodeExporter commented 9 years ago
Hi Karl,

Great progress!
The ffmeg-launch (GStreamer backend) did not work on my system.
The AVConv does!

Here's the response when using the GStreamer backend starting the playback and 
stopping the playback after no video is visible:

SourceURL registered.
CommandVideo: gst-launch-1.0 rtmpsrc location="rtmp://localhost/outp/test" ! 
decodebin ! videoconvert ! videoscale ! videorate ! video/x-raw, format=RGB, 
framerate=30/1, width=800, height=480 ! videoconvert ! tcpclientsink port=49283
CommandAudio: gst-launch-1.0 rtmpsrc location="rtmp://localhost/outp/test" ! 
decodebin ! audioresample ! audioconvert ! audio/x-raw, format=S16BE, 
channels=2, rate=44100 ! audioconvert ! tcpclientsink port=47955
May 18, 2014 2:12:14 PM webcamstudio.media.renderer.Capturer$2 run
SEVERE: null
java.net.SocketException: Socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
    at java.net.ServerSocket.implAccept(ServerSocket.java:530)
    at java.net.ServerSocket.accept(ServerSocket.java:498)
    at webcamstudio.media.renderer.Capturer$2.run(Capturer.java:127)
    at java.lang.Thread.run(Thread.java:744)

May 18, 2014 2:12:14 PM webcamstudio.media.renderer.Capturer$1 run
SEVERE: null
java.net.SocketException: Socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
    at java.net.ServerSocket.implAccept(ServerSocket.java:530)
    at java.net.ServerSocket.accept(ServerSocket.java:498)
    at webcamstudio.media.renderer.Capturer$1.run(Capturer.java:78)
    at java.lang.Thread.run(Thread.java:744)

URL Video Cleared ...
URL Audio Cleared ...

I switched the backend to AVConv and got this (again starting video playback, 
getting video and stopping the video playback)

CommandVideo: avconv -v 0 -vsync cfr -i "rtmp://localhost/outp/test" -an -ss 0 
-s 800x480 -f rawvideo -vcodec rawvideo -pix_fmt rgb24 -r 30 
tcp://127.0.0.1:35085
CommandAudio: avconv -v 0 -i "rtmp://localhost/outp/test" -vn -ss 0 -ar 44100 
-ac 2 -f s16be tcp://127.0.0.1:34958
URL Video accepted...
URL Audio accepted...
Start Video ...
Start Audio ...
URL Video Cleared ...
URL Audio Cleared ...

So this totally worked.

Thanks!!

I'll do some more experiments with this set-up and let you know if I find any 
other interesting aspects.

Cheers,
RJ

Original comment by skickm...@gmail.com on 18 May 2014 at 9:26

GoogleCodeExporter commented 9 years ago
hi Karl,

one more update.
I looked into the Gstreamer setup.
first of all, my system does not have GStreamer 1.0. So that explains a first 
issue.
I tried:
$ sudo gst-launch-0.10 -v rtmpsrc location="rtmp://localhost/outp/test" ! 
decodebin ! videoconvert ! videoscale ! videorate ! video/x-raw, format=RGB, 
framerate=30/1, width=800, height=480 ! videoconvert ! autovideosink

the result:
WARNING: erroneous pipeline: no element "videoconvert"

hope this helps.

RJ

Original comment by skickm...@gmail.com on 18 May 2014 at 9:52

GoogleCodeExporter commented 9 years ago
Hi RJ,
 I'm happy that avconv did the work !!!
I Remember that I had the same gstreamer 1.0 issue in OpenSuse, but don't 
remember how I got rid of it ...
Maybe simply updating all gstreamer packages changing vendor to packman, but in 
ubuntu there isn't such repo ...
Have you check all gstreamer1.0-plugins installation?
Maybe a fresh install do the trick.
I will try to search for the solution i found that time, and i will let you 
konw.
Thanks. 
karl

Original comment by soylent...@gmail.com on 19 May 2014 at 6:48

GoogleCodeExporter commented 9 years ago

Original comment by soylent...@gmail.com on 28 Aug 2014 at 3:22

GoogleCodeExporter commented 9 years ago
rtmp://$OPT:rtmp-raw=rtmp://31.220.0.194:1935/live playpath=sskk1 
swfurl=http://www.flashtv.co/ePlayerr.swf token=%ZZri(nKa@#Z 
pageurl=http://www.flashtv.co/
 how can i play this type of url 

Original comment by H.imran....@gmail.com on 8 Sep 2014 at 11:17