PDA

View Full Version : How to use rtmpsrv in Windows


srpenn82
01-26-2011, 01:10 AM
How to use rtmpsrv in Windows (http://srpenn82.blogspot.com/2011/02/rtmpsrv.html)

put grep.exe (http://gnuwin32.sourceforge.net/packages/grep.htm) and sed.exe (http://gnuwin32.sourceforge.net/packages/sed.htm) into the same folder as rtmpdump.exe
Find the Host

Windows Task Manager
right click plugin-container.exe > Create Dump File

get host
grep -Pao rtmp.{40} plugin-container.DMP | sort -u


start monitoring
rtmpsrv > rtmpsrv.txt
edit hosts file
cd C:\Windows\System32\drivers\etc & sed s/#// hosts > tmp & mv tmp hosts
start the audio/video stream
after rtmpsrv captures the parameters kill the processes
taskkill /im plugin-container.exe /im rtmpsrv.exe /f
restore hosts file
cd C:\Windows\System32\drivers\etc & sed "s/^/#/" hosts > tmp & mv tmp hosts
the command to download the video will be in the text file
rtmpdump --verbose --flv output.flv
--swfVfy http://www.hulu.com/player.swf --rtmp
rtmpe://hulufs.fplive.net --app
"hulu/593/50111593?sessionid=0BFAD9DD35D19ED8B6CB274534A8BFE 3&token=c3RhcnRfdGltZT0yMDExMDEyNjA3NTEzMCZlbmRfdGlt ZT0yMDExMDEyNjA3NTQzMCZkaWdlc3Q9NDllOWMwNWQzODlhN2 E0M2ZmMTZjNzM4ZGFjMTY4YTY=&mbr=1&hgt=OZU7Pvs7j27-nhteNno7wh2rW2KI7E9RRATmcsvy_NF5xCHAoM7C8u_J91OZBx BR9DnvqD7raxmXD1j6B_Vd8D0KoHAe6m0_yAr8olsIPsaw9xk7 56zhNlD5YwyJ2Sp_1zr6BoZJszElO98gvx-Fiaas94sNlr65RihN6nJmzBAJKF6_xuXsDvJlBGskVLT5pKYys 4g8MS46syG8YG_N81peD_6dR_Y1YdXHPWg6q6fT7Tt8ycDp7og Mw0xHWRwTRQcpP6y_lXKjoQYOXIYIrg==&hgt_ver=331370278"
--playpath mp4:agave50111593_4261809_H264_1000.mp4

rtmpdump might not work if BitTorrent is running. with Hulu you have 3 minutes to make a connection with rtmpdump after the video has started

Stream Recorder
04-14-2011, 01:50 AM
I don't really understand how it works. May be that's because I know nothing about grep and sed.

Why do we need to get a host with grep from the plugin_container if we use rtmpsrv > rtmpsrv.txt? And where do we use the host value?

Also I don't understand how the following works for changing the hosts file.
cd C:\Windows\System32\drivers\etc & sed s/#// hosts > tmp & mv tmp hosts
cd C:\Windows\System32\drivers\etc & sed "s/^/#/" hosts > tmp & mv tmp hosts
Where are the values that are added into the hosts file and how they are removed?

placebo
04-14-2011, 02:27 AM
rtmpsrv is an integral part of rtmpexplorer. and RTMPexplorer is even easier to use than the instructions here.

So if someone wants to use rtmpsrv in Windows, i would suggest taking rtmpexplorer for that purpose OR do it in the original way: manually editing the hosts file.

Stream Recorder
04-14-2011, 03:35 AM
rtmpsrv is an integral part of rtmpexplorer. and RTMPexplorer is even easier to use than the instructions here.

So if someone wants to use rtmpsrv in Windows, i would suggest taking rtmpexplorer for that purpose OR do it in the original way: manually editing the hosts file.
This is absolutely true, but I'm interested in learning how to use sed, grep, regular expressions, ...

placebo
04-14-2011, 06:35 AM
ok, i see. you want to learn. learning new things is always good, i guess. ok then. i want to learn it too.

so where is Steven? :confused:

srpenn82
04-14-2011, 09:47 AM
on windows you cannot just use rtmpsrv by itself. you have to:
1. modify the hosts file
2. start rtmpsrv
3. start video
4. restore host file
5. download video with rtmpdump

steps 1 and 4 can be done many different ways.

method 1
modify:
open hosts in notepad and set it to something like this
127.0.0.1 cp27886.edgefcs.net

restore:
open hosts in notepad and just delete everything

method 2
uncomment the hosts file, for use with running rtmpsrv and getting rtmpdump parameters
cd C:\Windows\System32\drivers\etc & sed s/#// hosts > tmp & mv tmp hosts

this command opens the hosts file, replace comment symbol "#" with nothing, saves to a temp file, then replaces the original host file with the temp file

comment the hosts file, for use with actually downloading the file with rtmpdump
cd C:\Windows\System32\drivers\etc & sed "s/^/#/" hosts > tmp & mv tmp hosts

this command opens the hosts file, adds a comment symbol (#) to every line, saves to a temp file, then replaces the original host file with the temp file

method 3
probably the easiest of all would be do something similar to method 2, but just wrap it in a batch file. i would go ahead and make that, but i have neglected that blog post because currently rtmpdump does not work with hulu, the only reason i used it

srpenn82
04-14-2011, 09:57 AM
Why do we need to get a host with grep from the plugin_container if we use rtmpsrv > rtmpsrv.txt? And where do we use the host value?

the problem with using rtmpsrv on windows is that in windows cannot do a transparent redirect like on linux. basically that means that before you can use rtmpsrv you have to tell it the server that you are trying to download from. at first this seems impossible because you are relying on rtmpsrv to get you that information!

the workaround is to pull the server (--host) directly from your RAM. with firefox the process for adobe is plugin-container.exe. so the idea is to create a dump file of that process after the video has loaded, then search through that file and find the server (--host) information. grep is the easiest tool to do that. once you have the (--host), modify the hosts file and boom, rtmpsrv working. the fact is you can actually find all the rtmpdump parameters in the dump file, and you do not even need to use rtmpsrv. i choose to use it because it seems easier to find the host then to sift through and try to figure out all the other rtmpdump parameters.

Stream Recorder
04-14-2011, 11:38 AM
Thanks a lot, Steven!!! This was really helpful and educational!

KSV
04-14-2011, 11:54 AM
This procedure seems incomplete. where does it pushes the detected host to hosts file.

cd C:\Windows\System32\drivers\etc & sed s/#// hosts > tmp & mv tmp hosts
cd C:\Windows\System32\drivers\etc & sed "s/^/#/" hosts > tmp & mv tmp hosts

These two lines just comment and uncomment all hosts in the file.

placebo
04-14-2011, 12:04 PM
Thanks a lot, Steven!!! This was really helpful and educational!

Yes, thanks a lot Steven. Too difficult for me pumpkin. I go now.. back to my lego bricks :D

And when there's some actual download task to do, call me. I'll then take out my GetFLV (http://all-streaming-media.com/record-video-stream/GetFLV-Download-and-convert-flash-video-streaming.htm) and download the stream, no prob. :p

srpenn82
04-14-2011, 01:28 PM
"This procedure seems incomplete. where does it pushes the detected host to hosts file."

the procedure is incomplete. there is a step missing where you need to add the found host into the file in this format

127.0.0.1 cp27886.edgefcs.net

the procedure on my blog is the procedure i use, i have not really worked on improving it since hulu support was lost

sam4037
05-06-2011, 12:49 AM
just wanted to let people know that Steven's blog continues and that the complete instructions can be found here: http://svnpenn.blogspot.com/2011/02/rtmpsrv.html