PDA

View Full Version : How to use rtmpdump with rtmpsrv in Mac OS X


any ANONYMOUS forum user
10-28-2010, 01:29 AM
rtmpsrv allows you to get all parameters that are required by rtmpdump (http://all-streaming-media.com/record-video-stream/rtmpdump-freeware-console-RTMP-downloading-application.htm). You don't need packet sniffers or complex analysis to use rtmpdump when using rtmpsrv. The only problem you may have is when a video consists of several segments (chapters). In such cases just skip to the next chapter.

First of all you need compile rtmpdump, rtmpsrv for Mac. Or you can download a binary filed (which is compiled already).

How to use rtmpsrv in Mac OS X:
Configure your firewall to redirect RTMP traffic through a local port:
sudo ipfw add 40 fwd 127.0.0.1,1935 tcp from any to any 1935
sudo ipfw add 40 fwd 127.0.0.1,1935 tcp from any to any 1935 not uid RTMP
Note that you need to create the RTMP user before using redirecting traffic to it

Then just start rtmpsrv:
./rtmpsrv
rtmpsrv will be analyzing data from your local port. It will output an rtmpdump command that can be used to download videos.

When you get the rtmpdump command, press CTRL+C. This will stop rtmpsrv.

You may also delete the firewall redirect created above.

Since rtmpsrv produces rtmpdump command, the only thing you need to do is copy-paste it to download the video. Simple as it is :D

Skeeve
10-30-2010, 03:53 PM
Okay... I tried that.

First question: What is the purpose of the "RTMP" user?

Second Question: Why do I get a "Bus error" as soon as the film starts?

jcj2002
12-25-2010, 04:50 PM
Three questions:

- what signify creating a rtmp user?

- what is the syntaxis for deleting these two firewall rules?

- Are necesary all two rules or might work with only the second?

Thank you in advance

jcj2002
01-04-2011, 06:56 PM
Okay... I tried that.

First question: What is the purpose of the "RTMP" user?

Second Question: Why do I get a "Bus error" as soon as the film starts?
I also obtain a bus error with rtmpe (mac osx 10.6.5), but using other method for redirecting instead of changing firewall ipfw rules, by with terminal editing the hosts file as follows:

Terminal
$ sudo nano etc/hosts
change in window to:
#127.0.0.1 local host
127.0.0.1 <domain of your stream-server URL, e.g. sss.aaa.com, in my example rt.fms.visionip.tv>
Ctrl O + enter (save); Ctrl X (go out of editor)

Then run: $./rtmpsuck

After this editing, rtmpsuck (v. 2.3) works well when re-open the stream-video. I used a trick: in firefox one tab I left the video always running from before hosts file editing, in a second tab with same URL, I test with play and pause and rtmpsuck or rtmpsrv listening). In these conditions, rtmpsuck works well, but rtmprv give the bus error same of you.

I have tested as example with http://actualidad.rt.com/mas/envivo/?gclid=COfbgf7UkqYCFUkhfAodF0HskQ). RTMPSUCK gives all information you can need in rtmpdump

e.g. rtmpdump -r "rtmp://rt.fms.visionip.tv/live/" -a "live/" -f "WIN 10,2,151,49" -W "http://actualidad.rt.com/swf/player.swf" -p "http://actualidad.rt.com/mas/envivo/?gclid=COfbgf7UkqYCPUkhfAodF0HskQ" -y "RT_Spanish_3" -o RT_Spanish_3.flv)

Note that after running rtmpsuck (or rtmpsrv), you must edit the hosts file to its original values (127.0.0.1 localhost without #) before running downloader rtmpdump.

Hope this help

jcj2002
01-04-2011, 07:02 PM
Okay... I tried that.

First question: What is the purpose of the "RTMP" user?

Second Question: Why do I get a "Bus error" as soon as the film starts?
I also obtain a bus error with rtmpsrv (mac osx 10.6.5), but using other method for redirecting instead of changing firewall ipfw rules, using terminal for editing the hosts file as follows:

Terminal
$ sudo nano /etc/hosts
change in window to:
#127.0.0.1 local host
127.0.0.1 <domain of your stream-server URL, e.g. sss.aaa.com, in my example rt.fms.visionip.tv>
Ctrl O + enter (save); Ctrl X (go out of editor)

Then run: $./rtmpsuck

After this editing, rtmpsuck (v. 2.3) works well when re-open the stream-video. I used a trick: in firefox one tab I left the video always running from before hosts file editing, in a second tab with same URL, I test with play and pause and rtmpsuck or rtmpsrv listening). In these conditions, rtmpsuck works well, but rtmprv give the bus error same of you.

I have tested as example with http://actualidad.rt.com/mas/envivo/?gclid=COfbgf7UkqYCFUkhfAodF0HskQ). RTMPSUCK gives all information you can need in rtmpdump

e.g. rtmpdump -r "rtmp://rt.fms.visionip.tv/live/" -a "live/" -f "WIN 10,2,151,49" -W "http://actualidad.rt.com/swf/player.swf" -p "http://actualidad.rt.com/mas/envivo/?gclid=COfbgf7UkqYCPUkhfAodF0HskQ" -y "RT_Spanish_3" -o RT_Spanish_3.flv)

Note that after running rtmpsuck (or rtmpsrv), you must edit the hosts file to its original values (127.0.0.1 localhost without #) before running downloader rtmpdump.

Hope this help

jcj2002
01-05-2011, 08:37 PM
rtmpsrv allows you to get all parameters that are required by rtmpdump (http://all-streaming-media.com/record-video-stream/rtmpdump-freeware-console-RTMP-downloading-application.htm). You don't need packet sniffers or complex analysis to use rtmpdump when using rtmpsrv. The only problem you may have is when a video consists of several segments (chapters). In such cases just skip to the next chapter.

First of all you need compile rtmpdump, rtmpsrv for Mac. Or you can download a binary filed (which is compiled already).

How to use rtmpsrv in Mac OS X:
Configure your firewall to redirect RTMP traffic through a local port:
sudo ipfw add 40 fwd 127.0.0.1,1935 tcp from any to any 1935
sudo ipfw add 40 fwd 127.0.0.1,1935 tcp from any to any 1935 not uid RTMP
Note that you need to create the RTMP user before using redirecting traffic to it

Then just start rtmpsrv:
./rtmpsrv
rtmpsrv will be analyzing data from your local port. It will output an rtmpdump command that can be used to download videos.

When you get the rtmpdump command, press CTRL+C. This will stop rtmpsrv.

You may also delete the firewall redirect created above.

Since rtmpsrv produces rtmpdump command, the only thing you need to do is copy-paste it to download the video. Simple as it is :D

Three questions from your procedure:

1) Is it necessary only the second redirecting (sudo ipfw ... not uid RTMP") or are necessary both the two sudo´s of ipfw add´s?

2) From what of the two users (original-user OR RTMP-user) the command ./rtmpsrv is run?

3) From what of the two users the video (explorer, firefox, ....) is run?

I would appreciate very much the answers.

I have tryed with two terminal windows your procedure of rtmpsrv (one for each user) but the system hangs (Mac OSX 10.6.5). (Notes: ipfw configurations can be seen with: sudo /sbin/ipfw list; they are deleted with rebooting, or manually changing add by delete. Question: What signify the number 40 in this sudo?).

I have also tryed redirecting by editing /etc/host, as explained in my previous post in this thread, but only I get information from ./rtmpsuck (rtmpsrv gaves me a bus error).

Thanks in advance for answers.

Stream Recorder
01-06-2011, 01:22 AM
2) From what of the two users (original-user OR RTMP-user) the command ./rtmpsrv is run?

3) From what of the two users the video (explorer, firefox, ....) is run?
In Linux rtmpsrv and rtmpsuck are run from the RTMP user. And web-browser is run from a regular user. Everything should be identical in Mac OS

jcj2002
01-07-2011, 03:16 PM
In Linux rtmpsrv and rtmpsuck are run from the RTMP user. And web-browser is run from a regular user. Everything should be identical in Mac OS

Thanks stream recorder for your info. I think linux and unix (mac osx - terminal) will not significantly differ for this task.

I am trying, but after sudo´s ipfw changes (and listening rtmpsrv from the second user), system hangs when reloading video from the main first user. I am working with two different terminal windows, in one the main user (ipfw configurations and browser), and a second window from the second user (listening rtmpsrv). What is wrong?.

I have also one doubt: the two sudo´s of ipfw´s are quite similar, the only difference is "... not uid second-user" at final. Are both necesary or only the second?

I would appreciate very much your answers. Perhaps explaining all the steps you make for succesful rtmpsrv listening in linux.

Many thanks in advance. Regards.

Stream Recorder
01-08-2011, 07:00 AM
Perhaps explaining all the steps you make for succesful rtmpsrv listening in linux.
The following works just fine for me in Ubuntu 10.04 and 10.10:
How to use rtmpdump with rtmpsrv in Linux
How to use rtmpsuck in Ubuntu 10.04 Lucid Lynx

cyberscott
05-19-2011, 09:07 AM
Greetings,

What an excellent resource stream-recorder.com is! I've already learnt quite a large bit of info from here! Thanks to the administrators/moderators for helping spread the knowledge here!

After first following this thread:

http://stream-recorder.com/forum/use-rtmpdump-rtmpsrv-mac-os-x-t7662.html

and setting up a separate user (named RMTP as explained in the first post). Then configuring the OS X firewall with these ipfw commands:

sudo ipfw add 40 fwd 127.0.0.1,1935 tcp from any to any 1935
sudo ipfw add 40 fwd 127.0.0.1,1935 tcp from any to any 1935 not uid RTMP

Then logging into the RTMP account via:
sudo -u RTMP -s


and starting the rtmpsrv server:

./rtmpsrv


I see this:

RTMP Server v2.3
(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL

Streaming on rtmp://0.0.0.0:1935


I surf to the page with the video that I want to capture and watch the rtmpsrv output. Nothing happens but when I ctrl^c the server to stop it I see a bunch of lines like this:

ERROR: serverThread: accept failed
ERROR: serverThread: accept failed
ERROR: serverThread: accept failed
ERROR: serverThread: accept failed


Which inclines me to think I've misconfigured it.

Does any of this look familiar to anyone else who might have encountered this issue and solved it?

Thanks,

Scott

magichandz
03-21-2013, 10:27 PM
yes. i have the same problem cyberscott has. any ideas?

toxiclabs
11-02-2014, 04:30 PM
I am using rtmpdump for my mac however I was looking at these two commands

sudo ipfw add 40 fwd 127.0.0.1,1935 tcp from any to any 1935
sudo ipfw add 40 fwd 127.0.0.1,1935 tcp from any to any 1935 not uid RTMP
I read the man page for pfctl since ipfw is no longer supported in Yosemite. If anyone can help convert the two commands on top to pfctl syntax.

Thank you

eagle_fly
01-27-2015, 04:53 AM
I have exactly the same problem as magichandz and cyberscott,
on Mac OS 10.9.5?
ERROR: serverThread: accept failed
Any ideas? Did anyone solve it?
Thanks

miroman4o
04-22-2015, 01:19 PM
Here are the correct port forwarding rules for Mac OS X Yosemite:

enable internal port forwarding:
sudo sysctl -w net.inet.ip.forwarding=1

apply the pf rules:
echo '
rdr pass log on lo0 proto tcp from en1 to any port 1935 -> 127.0.0.1
pass out on en1 route-to lo0 inet proto tcp from en1 to any port 1935 keep state
' | sudo pfctl -ef -

check the pf rules:
sudo pfctl -s all

clear the pf rules:
sudo pfctl -F all -f /etc/pf.conf

Thanks to http://serverfault.com/questions/421261/os-x-10-8-redirecting-locally-initiated-ssh-connections-to-localhost22

I want to capture the stream urls from http://www.drakulastream.eu/tennis-live-streaming-video.html, unfortunately the rtmpsrv crashed with Bus error: 10

At the end I used Linux rtmpsrv with the IPTables example and captured the following:
rtmpdump -r "rtmpe://46.246.124.71:1935/live/" -a "live/" -f "LNX 11,2,202,457" -W "http://www.lshstream.com/jw/jwplayer.flash.swf/[[DYNAMIC]]/2/[[DYNAMIC]]/3" -p "http://www.lshstream.com/embed.php?u=bucharest1&vw=640&vh=360&domain=live.drakulastream.eu" -y "bucharest1" -o bucharest1.flv

Does anybody knows anything about the dynamic flashplayer parameters?

iamsumit
12-15-2015, 06:54 AM
Here are the correct port forwarding rules for Mac OS X Yosemite:

enable internal port forwarding:
sudo sysctl -w net.inet.ip.forwarding=1

apply the pf rules:
echo '
rdr pass log on lo0 proto tcp from en1 to any port 1935 -> 127.0.0.1
pass out on en1 route-to lo0 inet proto tcp from en1 to any port 1935 keep state
' | sudo pfctl -ef -

check the pf rules:
sudo pfctl -s all

clear the pf rules:
sudo pfctl -F all -f /etc/pf.conf

Thanks to http://serverfault.com/questions/421261/os-x-10-8-redirecting-locally-initiated-ssh-connections-to-localhost22

I want to capture the stream urls from http://www.drakulastream.eu/tennis-live-streaming-video.html, unfortunately the rtmpsrv crashed with Bus error: 10

At the end I used Linux rtmpsrv with the IPTables example and captured the following:
rtmpdump -r "rtmpe://46.246.124.71:1935/live/" -a "live/" -f "LNX 11,2,202,457" -W "http://www.lshstream.com/jw/jwplayer.flash.swf/[[DYNAMIC]]/2/[[DYNAMIC]]/3" -p "http://www.lshstream.com/embed.php?u=bucharest1&vw=640&vh=360&domain=live.drakulastream.eu" -y "bucharest1" -o bucharest1.flv

Does anybody knows anything about the dynamic flashplayer parameters?

I ran the above port forward command. The pf rule has been added and enabled. And then i started rtmpsuck.
Now
1. Some (almost all) of the rtmp streams don't run with this pf enabled.
2. rtmpsuck doesn't return any output in the terminal window. It just keeps on showing Streaming on rtmp://0.0.0.0:1935.

Seems like many other also before me faced this issue, can anyone help me here and update what was the solution that fixed it for them?
Thanks!

iamsumit
12-15-2015, 10:46 PM
Anyone please? Been stuck for more than a day on this. Anyone done this previously for mac?

Edit: Ok so here are my findings.
Port 1935 is closed for me.
So, i guess thats why the streams doesn't load when i port forward rtmp protocols to port 1935.
And as a result the rtmpsuck/rtmpsrv keep on waiting for something to read on port 1935, which of course never happens.

With no port forwarding, i notice that my machine uses random ports such as 49686/43585 for rtmp protocols.

Does anybody here has any workaround for me or has faced a similar scenario? Can rtmpsuck be modified to listen instead on some other port?


Edit 2 - my ports are all fine. The port tester service says its closed but i can receive packets on it. Seems like i have Stateful-firewall (https://en.wikipedia.org/wiki/Stateful_firewall).
But the bottom line is rtmpsuck still sits idle like a lazy old bum... any ideas?

kikuyan
03-13-2016, 08:20 PM
Thanks to miroman4o, rtmpsrv and rtmpsuck have worked successfully on 10.11 El Capitan.

PF rules:
rdr pass on lo0 proto tcp from en1 to any port 1935 -> 127.0.0.1
pass out route-to lo0 inet proto tcp from en1 to any port 1935 user != 2NDUSER

where 2NDUSER is another user than you play streams.

Start rtmpsrv (or rtmpsuck) on 2NDUSER, like:
su - 2NDUSER
rtmpsrv

P.S.
net.inet.ip.forwarding isn't needed to be set to 1.
PF rules can also be written simpler by using tag:
rdr pass inet tagged TAGNAME -> lo0
pass out route-to lo0 inet proto tcp from en1 to any port 1935 user != 2NDUSER tag TAGNAME

ehurdler
03-14-2016, 01:56 PM
If you wouldn't mind, even if in a direct message. Would you please be able to explain to me how to use rtmpdump with some good detailed steps on a Macintosh. I have rtmpdump, rtmpsrv, rtmpsuck installed on OS X El Capitan 10.11.2 machine. I have just never been able to figure out how to use it. I had found this posting months ago, and now with your new post I thought I would ask for help.

For Example, I would like to get things from Crackle.com
http://www.crackle.com/powers/2494883

Any and all help you may be able to provide would be great and much appreciated! Thank you!

streamers
03-16-2016, 05:53 PM
Thanks to miroman4o, rtmpsrv and rtmpsuck have worked successfully on 10.11 El Capitan.


I have added these lines to the end of my /etc/pf.conf and changed the 2NDUSER to another user, then su to that user and run rtmpsrv.

still nothing happens. is there another step i am missing? thanks

kikuyan
03-16-2016, 10:13 PM
streamers,

Did you reload /etc/pf.conf or reboot the OS? Do you see the rules in the output of pfctl if you do "sudo pfctl -s nat", "sudo pfctl -s rules", or just "sudo pfctl -s all"?

Please try with the first stream "LIVE STREAMING – SIMULATED LIVE BROADCAST" on this page:
http://www.netromedia.com/video/video-streaming-examples/
This should be easy.

streamers
03-16-2016, 11:50 PM
thank you for your reply. i appreciate the help.

i have reloaded and the rules appear. sudo pfctl -s natgivesrdr pass on lo0 inet proto tcp from 192.168.1.123 to any port = 1935 -> 127.0.0.1andsudo pfctl -s allgives this output: paste (http://paste.pound-python.org/show/qh2iiXLRK0H5CPkcJ2wQ/)

and my pf.conf is here (http://paste.pound-python.org/show/JMlKM5vaAvRKqqSGgVXt/)

the example video has the same effect. nothing. any ideas on what i can change?

edit:
i had to create an anchor file and then everything went smooth. This link (http://softwareblog.morlok.net/2015/10/15/setting-up-port-forwarding-on-mac-os-x-el-capitan-for-google-app-engine-local-development/) prompted me.

thanks for your help!