PDA

View Full Version : change the code of of rtmpsrv, rtmpdump to run with the --live parameter by default


chap
05-22-2011, 05:29 PM
Can you change the code of of rtmpsrv, rtmpdump to run with the --live parameter by default.

KSV
05-23-2011, 01:00 AM
Can you change the code of rtmpsrv, rtmpdump to run with the --live parameter by default.

it will be easy to do but i can't understand the purpose of adding --live switch to every command executed by rtmpsrv :confused:

chap
05-23-2011, 01:46 AM
it will be easy to do but i can't understand the purpose of adding --live switch to every command executed by rtmpsrv :confused:

To download from sites such as http://www.bloomberg.com/tv/.
RTMP Server v2.3 r569 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL

Streaming on rtmp://0.0.0.0:1935
WARNING: Trying different position for client digest!

rtmpdump -r "rtmp://cp87869.live.edgefcs.net/live" -a "live" -f "WIN 10,3,181,14
" -W "http://player.ooyala.com/static/cacheable/0261332be7c05b71a1386fd805d97228
/player_v2.swf/[[DYNAMIC]]/4" -p "http://www.bloomberg.com/tv/" -C B:0 -y "us_30
0@21006" -o us_300@21006.flv

Closing connection... done!

RTMPDump v2.3 r569 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
ERROR: RTMP_HashSWF: couldn't contact swfurl http://player.ooyala.com/static/cac
heable/0261332be7c05b71a1386fd805d97228/player_v2.swf/[[DYNAMIC]]/4 (HTTP error
403)
Connecting ...
INFO: Connected...
ERROR: Closing connection: NetStream.Play.StreamNotFound


with parameter --live

C:\Documents and Settings\Администратор\Мои документы\STREAM\rtmpdump-2.3-window
s\rtmpdump-2.3\rtmpexplorer\Server>rtmpdump -r "rtmp://cp87869.live.edgefcs.net/
live" -a "live" -f "WIN 10,3,181,14" -W "http://player.ooyala.com/static/cacheab
le/0261332be7c05b71a1386fd805d97228/player_v2.swf/[[DYNAMIC]]/2" -p "http://www.
bloomberg.com/tv/" -C B:0 -y "us_300@21006" -o us_300@21006.flv -v
RTMPDump v2.3 r569 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
ERROR: RTMP_HashSWF: couldn't contact swfurl http://player.ooyala.com/static/cac
heable/0261332be7c05b71a1386fd805d97228/player_v2.swf/[[DYNAMIC]]/2 (HTTP error
403)
Connecting ...
INFO: Connected...
Starting Live Stream
INFO: Metadata:
INFO: width 640.00
INFO: height 360.00
INFO: framerate 25.00
INFO: videodatarate 1000.00
INFO: videocodecid avc1
INFO: audiodatarate 64.00
INFO: audiocodecid mp4a
916.835 kB / 4.09 sec


not to add the setting manually.
If is not difficult for you, could you please do it? Thanks.

KSV
05-23-2011, 12:33 PM
rtmpsrv was not even checking for the live flag. i have added the code to check for live flag in play packet and if present add it to the command line.

http://i.imgur.com/kYDlz.jpg

http://www.mediafire.com/file/wwo4h14x5qzg24y/rtmpdump-2.3.zip

svnpenn
05-23-2011, 12:52 PM
can you upload to dropbox or something? mediafire link is not working

bat999
05-23-2011, 01:30 PM
rtmpsrv was not even checking for the live flag. i have added the code to check for live flag in play packet and if present add it to the command line.


Hi
Can you explain how to do that when compiling for Linux?
Or will you submit it as a patch?

KSV
05-23-2011, 10:32 PM
Hi
Can you explain how to do that when compiling for Linux?
Or will you submit it as a patch?

Here is the diff file.
http://pastebin.com/TuD9UgpZ

Stream Recorder
05-23-2011, 10:45 PM
can you upload to dropbox or something? mediafire link is not working
The mediafire link works just fine. If you have problem with it on your computer, try to use fetch.io

bat999
05-24-2011, 05:55 AM
Here is the diff file.
http://pastebin.com/TuD9UgpZ

Thanks for that.
It's working now with Ubuntu Linux.:)
ron@ubuntu:~$ sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT && rtmpsrv
[sudo] password for ron:
RTMP Server v2.3 r569a
(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL

Streaming on rtmp://0.0.0.0:1935
WARNING: Trying different position for client digest!
INFO: Live Flag : -1000

rtmpdump -r "rtmp://cp87869.live.edgefcs.net/live" -a "live" -f "LNX 10,1,102,64" -W "http://player.ooyala.com/static/cacheable/b8ee4b1861a67da6040e06a1498a9f7d/player_v2.swf/[[DYNAMIC]]/3" -p "http://www.bloomberg.com/tv/" --live -C B:0 -y "us_300@21006" -o us_300@21006.flv

Closing connection... done!

^CCaught signal: 2, cleaning up, just a second...
ron@ubuntu:~$ sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT
ron@ubuntu:~$ rtmpdump -r "rtmp://cp87869.live.edgefcs.net/live" -a "live" -f "LNX 10,1,102,64" -W "http://player.ooyala.com/static/cacheable/b8ee4b1861a67da6040e06a1498a9f7d/player_v2.swf/[[DYNAMIC]]/3" -p "http://www.bloomberg.com/tv/" --live -C B:0 -y "us_300@21006" -o us_300@21006.flv
RTMPDump v2.3 r569a
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
ERROR: RTMP_HashSWF: couldn't contact swfurl http://player.ooyala.com/static/cacheable/b8ee4b1861a67da6040e06a1498a9f7d/player_v2.swf/[[DYNAMIC]]/3 (HTTP error 403)
Connecting ...
INFO: Connected...
Starting Live Stream
INFO: Metadata:
INFO: width 640.00
INFO: height 360.00
INFO: framerate 25.00
INFO: videodatarate 1000.00
INFO: videocodecid avc1
INFO: audiodatarate 64.00
INFO: audiocodecid mp4a
1679.916 kB / 8.17 sec^C

chap
05-24-2011, 08:10 AM
KSV
rtmpsrv was not even checking for the live flag. i have added the code to check for live flag in play packet and if present add it to the command line.Thanks for that.:cool:


I want to ask if you can somehow pass parameters from rtmpsusk to rtmpdump. It it real?
For example at this link _http://www.ustream.tv/sfshiba RTMPexplorer (http://all-streaming-media.com/record-video-stream/RTMPExplorer-freeware-GUI-for-rtmpsrv-Windows.htm) can not download, but rtmpsusk can.

But rtmpdump (http://all-streaming-media.com/record-video-stream/rtmpdump-freeware-console-RTMP-downloading-application.htm) can download. Parameters were taken from rtmpsusk.
Microsoft Windows XP [Версия 5.1.2600]
(С) Корпорация Майкрософт, 1985-2001.

C:\Documents and Settings\Администратор\Мои документы\STREAM\rtmpdump-2.3-window
s\rtmpdump-2.3>"C:\Documents and Settings\Администратор\Мои документы\STREAM\rtm
pdump-2.3-windows\rtmpdump-2.3\rtmpdump569.exe" -r "rtmp://ustream.fc.llnwd.net:
1935/ustream/test" -a "ustream/test" -W "http://cdn1.ustream.tv/swf/4/viewer.rsl
.650.swf" -p "http://www.ustream.tv/sfshiba" -y "ustream@llnw_1_317016_live_1"
-o ustream.flv -v
RTMPDump v2.3 r569 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
Starting Live Stream
INFO: Metadata:
INFO: framerate 30.00
INFO: width 640.00
INFO: height 480.00
INFO: videocodecid avc1
INFO: videodatarate 600.00
INFO: videokeyframe_frequency125.00
INFO: audiocodecid mp4a
INFO: audiosamplerate 44100.00
INFO: audiochannels 2.00
INFO: audiodatarate 96.00
2130.252 kB / 17.07 sec

chap
05-24-2011, 04:45 PM
here http://www.105.net/sezioni/inradio/radio/index.php?ch=6&webradio=105%20Latino not working correctly rtmpsrv (does not transmit a command --live)
RTMP Server v2.3 r569 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL

Streaming on rtmp://0.0.0.0:1935
WARNING: Trying different position for client digest!
INFO: Live Flag : 0

rtmpdump -r "rtmp://fms.105.net:1935/live" -a "live" -f "WIN 10,3,181,14" -W "ht
tp://www.105.net/swf/player_instant_reply.swf?cnnl=6&streamRadio=105Latino&titol
oRadio=105 Latino&buffertime=2&logo=32x32_105latino.png&spiega=0&autoplay=1/[[DY
NAMIC]]/3" -p "http://www.105.net/sezioni/inradio/radio/index.php?ch=6&webradio=
105%20Latino" -y "105Latino" -o 105Latino.flv

Closing connection... done!

RTMPDump v2.3 r569 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
ERROR: Closing connection: NetStream.Play.StreamNotFound


after adding --live


C:\Documents and Settings\Администратор\Мои документы\STREAM\rtmpdump-2.3-window
s\rtmpdump-2.3\rtmpexplorer\Server>rtmpdump -r "rtmp://fms.105.net:1935/live" -a
"live" -f "WIN 10,3,181,14" -W "http://www.105.net/swf/player_instant_reply.swf
?cnnl=6&streamRadio=105Latino&titoloRadio=105 Latino&buffertime=2&logo=32x32_105
latino.png&spiega=0&autoplay=1/[[DYNAMIC]]/3" -p "http://www.105.net/sezioni/inr
adio/radio/index.php?ch=6&webradio=105atino" -y "105Latino" -o 105Latino.flv -v

RTMPDump v2.3 r569 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
ERROR: rtmp server sent error
Starting Live Stream
INFO: Metadata:
INFO: author
INFO: copyright
INFO: description
INFO: keywords
INFO: rating
INFO: title
INFO: presetname Custom
INFO: creationdate Thu May 19 16:06:33 2011
INFO: audiodevice Axia Wave09
INFO: audiosamplerate 48000.00
INFO: audiochannels 2.00
INFO: audioinputvolume 75.00
INFO: audiocodecid mp4a
INFO: audiodatarate 48.00
60.389 kB / 8.53 sec

KSV
05-29-2011, 01:20 AM
here http://www.105.net/sezioni/inradio/radio/index.php?ch=6&webradio=105%20Latino not working correctly rtmpsrv (does not transmit a command --live)

Live switch can only be detected when it is sent by client. but in case of these two streams they are not sending any live flag.

so how does their streams play in flash client but not in rtmpdump?

because rtmpdump was always sending the optional start flag in play packet and their servers refuses to play when start flag is non negative. i have modified this behavior and now start and duration flags will only be sent when explicitly defined. this will let these types of streams play without specifying --live flag. however there is another problem due to a hack used by rtmpdump for faster downloading of recorded (nonlive) files. whenever it receives a BufferEmpty message it sends Pause Unpause packets to force sending next buffer. this may create some anomalies in recorded files when stream is live and --live switch is not specified because live stream can only be received in realtime. if we disable this hack, everything will be fine for live streams but download speed for nonlive streams may be slow so i haven't disabled it.

in short if you know that stream is live and rtmpsrv or rtmpsuck can't detect live flag, it would be better to specify --live flag though rtmpdump can download without it now.


I want to ask if you can somehow pass parameters from rtmpsuck to rtmpdump.

it took some time to figure out. i have added some code to rtmpsuck and copied one function from rtmpsrv. now it willl save the commands in Command.bat just like rtmpsrv.

but why didn't rtmpsrv works with ustream?

because their client sends a channel parameter in connect packet and server responds with original url to connect with. rtmpsrv is faking the connect response so client is not able to connect to stream.

i will post the updated package and diff file later.

chap
05-29-2011, 02:21 PM
KSV
i will post the updated package and diff file later.

We will wait, thanks a lot for your work,and detailed explanations.:cool:

chap
05-29-2011, 02:55 PM
http://stream-recorder.com/forum/showpost.php?p=27192&postcount=13
You'll have to wait for a new version of rtmpdump that can handle flash 10 handshakes.

Can you enlighten on this issue.

I do not want to be intrusive, if we can make a fully transparent rtmpsusk (as someone said of the sponsors of this program).
Maybe then can be downloaded using rtmpsusk, this and similar video
http://www.youtube.com/watch?v=EW3x0TWAEfU&hd=1

KSV
05-30-2011, 02:54 AM
rtmpdump r569 mod

http://www.mediafire.com/file/rnkld73d6ajbf9g/rtmpdump-2.3.zip

Patch file
http://pastebin.com/CKFyhGRv

chap
05-30-2011, 12:16 PM
rtmpdump r569 mod
http://www.mediafire.com/file/rnkld73d6ajbf9g/rtmpdump-2.3.zip

Works fine.:cool:

KSV
05-31-2011, 12:04 PM
I found a problem with my previous patch and now fixed it. use the following package and patch instead of the previous one.

rtmpdump r569 mod
http://www.mediafire.com/file/3xen8pvudz3uukj/rtmpdump-2.3.zip

Patch:
http://pastebin.com/ZKNbfid6

placebo
05-31-2011, 12:21 PM
the common user doesnt need the patch, or do we need it? it's for information purposes only, isnt it?

looks nice. thanks for the great work!

chap
05-31-2011, 02:03 PM
KSV
I found a problem with my previous patch and now fixed it. use the following package and patch instead of the previous one.

Yes, now rtmpdump not interrupted by injection without parameter --live (sometimes it was). Now we do not need to install(-- live). And the output parameters rtmpsusk, more informative, super simple.:cool: Thanks again.

chap
06-01-2011, 02:07 AM
http://www.cbs.com/primetime/how_i_met_your_mother/video/?pid=Iw6UfcYTmf_i0j62MwONCjncCJCI7yF1&vs=Default&play=true

rtmpsrv569 (mod) gives an error (for some reason adds a parameter - live)
RTMP Server v2.3 r569 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL

Streaming on rtmp://0.0.0.0:1935
WARNING: Trying different position for client digest!
Live : Yes
rtmpdump -r "rtmp://cp48590.edgefcs.net:1935/ondemand?ovpfv=1.1&?auth=dbEbPdGdea
tb3b7dBdXdpcmaJbZd8cxaUdb-bn5E_a-h0-buy-FcyPgUse&aifp=v001&slist=video%2
Ftemp_hd_gallery_video%2FCBS_Production%2F814%2F31 1%2F" -a "ondemand?ovpfv=1.1&?
auth=dbEbPdGdeatb3b7dBdXdpcmaJbZd8cxaUdb-bn5E_a-h0-buy-FcyPgUse&aifp=v001&am
p;slist=video%2Ftemp_hd_gallery_video%2FCBS_Produc tion%2F814%2F311%2F" -f "WIN 1
0,3,181,14" -W "http://www.cbs.com/[[IMPORT]]/vidtech.cbsinteractive.com/player/
2_8_0/CBSI_PLAYER.swf" -p "http://www.cbs.com/primetime/how_i_met_your_mother/vi
deo/?pid=Iw6UfcYTmf_i0j62MwONCjncCJCI7yF1&vs=Default&p lay=true" --live -C Z: -y
"mp4:video/temp_hd_gallery_video/CBS_Production/814/311/CBS_HIMYM_623_CONTENT_CI
AN__326440.mp4" -o CBS_HIMYM_623_CONTENT_CIAN__326440.flv

Closing connection... done!

RTMPDump v2.3 r569 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
ERROR: RTMP_HashSWF: swfurl http://www.cbs.com/[[IMPORT]]/vidtech.cbsinteractive
.com/player/2_8_0/CBSI_PLAYER.swf not found
Connecting ...
WARNING: HandShake: client signature does not match!
INFO: Connected...
ERROR: rtmp server sent error
Starting Live Stream
ERROR: RTMP_ReadPacket, failed to read RTMP packet header
0.000 kB / 0.00 sec
Download may be incomplete (downloaded about 0.00%), try resuming

without parameter - live

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

Streaming on rtmp://0.0.0.0:1935
WARNING: Trying different position for client digest!

rtmpdump -r "rtmp://cp48590.edgefcs.net:1935/ondemand?ovpfv=1.1&?auth=dbEaubadFd
mc0b2c3bOaVcwdCdkbiaqc6df-bn5E4p-h0-buy-EawPdXlf&aifp=v001&slist=video%2
Ftemp_hd_gallery_video%2FCBS_Production%2F814%2F31 1%2F" -a "ondemand?ovpfv=1.1&?
auth=dbEaubadFdmc0b2c3bOaVcwdCdkbiaqc6df-bn5E4p-h0-buy-EawPdXlf&aifp=v001&am
p;slist=video%2Ftemp_hd_gallery_video%2FCBS_Produc tion%2F814%2F311%2F" -f "WIN 1
0,3,181,14" -W "http://www.cbs.com/[[IMPORT]]/vidtech.cbsinteractive.com/player/
2_8_0/CBSI_PLAYER.swf" -p "http://www.cbs.com/primetime/how_i_met_your_mother/vi
deo/?pid=Iw6UfcYTmf_i0j62MwONCjncCJCI7yF1&vs=Default&p lay=true" -C Z: -y "mp4:vi
deo/temp_hd_gallery_video/CBS_Production/814/311/CBS_HIMYM_623_CONTENT_CIAN__326
440.mp4" -o CBS_HIMYM_623_CONTENT_CIAN__326440.flv

Closing connection... done!

RTMPDump v2.3 r569 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
ERROR: RTMP_HashSWF: swfurl http://www.cbs.com/[[IMPORT]]/vidtech.cbsinteractive
.com/player/2_8_0/CBSI_PLAYER.swf not found
Connecting ...
INFO: Connected...
Starting download at: 0.000 kB
INFO: Metadata:
INFO: duration 1292.70
INFO: moovPosition 28.00
INFO: width 640.00
INFO: height 360.00
INFO: videocodecid avc1
INFO: audiocodecid mp4a
INFO: avcprofile 100.00
INFO: avclevel 40.00
INFO: aacaot 2.00
INFO: videoframerate 24.00
INFO: audiosamplerate 22050.00
INFO: audiochannels 2.00
INFO: trackinfo:
INFO: length 31023000.00
INFO: timescale 24000.00
INFO: language eng
INFO: sampledescription:
INFO: sampletype avc1
INFO: length 28504063.00
INFO: timescale 22050.00
INFO: language eng
INFO: sampledescription:
INFO: sampletype mp4a
5027.453 kB / 45.29 sec (3.5%)
Only one error,no longer met.

bat999
06-01-2011, 07:41 PM
@ KSV
As with the CBS website in the previous post (from chap Location: Ukraine).
This 60 Minutes clip also gives a 'false positive' live flag.
__http://www.cbsnews.com/video/watch/?id=7316962n


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

Streaming on rtmp://0.0.0.0:1935
WARNING: Trying different position for client digest!
INFO: Live Flag : -2000

rtmpdump -r "rtmp://cnetmedia.fcod.llnwd.net:1935/a3706/d1?ovpfv=1.1" -a "a3706/d1?ovpfv=1.1" -f "LNX 10,1,102,64" -W "http://cnettv.cnet.com/[[IMPORT]]/vidtech.cbsinteractive.com/player/2_8_0/CBSI_PLAYER.swf" -p "http://www.cbsnews.com/video/watch/?id=7316962n" --live -C Z: -y "mp4:media/2011/02/03/60_sadatrewind_0203_598.m4v" -o 60_sadatrewind_0203_598.flv

It downloads OK only if I run the command without the --live switch.

KSV
06-02-2011, 09:57 AM
the common user doesnt need the patch, or do we need it? it's for information purposes only, isnt it?

patch is not required for windows users because package binaries are already compiled with it.

i have fixed detection of live flag. I also fixed another problem when batch file is directly used and rtmpdump parameters contain % symbol e.g %2F %2D etc.. in that case window was replacing % symbols resulting in non working batch file. now i am escaping these symbols with %, means %2F will be stored as %%2F so it can be used from within batch file. if you are copying batch file command to use on console you should replace %% with % or command may not work properly.

Package
http://www.mediafire.com/file/k0srlw30jn2ttvc/rtmpdump-2.3.zip

Patch:
http://pastebin.com/E7W8vKqB

for patch users, if you have applied any of my previous patch it would be better to revert to r569 and then apply this patch.

bat999
06-02-2011, 11:20 AM
for patch users, if you have applied any of my previous patch it would be better to revert to r569 and then apply this patch.

@ KSV
Hi
I've modified the rtmpsrv.c file by changing the 4 lines from your latest patch that deal with the live flag.
Then re-compiled.
It seems to have cured the 'false positive' issue for that 60 Minutes clip.
Thanks.

RTMPDump v2.3 SVN-r569b
(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL

Streaming on rtmp://0.0.0.0:1935
WARNING: Trying different position for client digest!
Live : No
rtmpdump -r "rtmp://cnetmedia.fcod.llnwd.net:1935/a3706/d1?ovpfv=1.1" -a "a3706/d1?ovpfv=1.1" -f "LNX 10,1,102,64" -W "http://cnettv.cnet.com/[[IMPORT]]/vidtech.cbsinteractive.com/player/2_8_0/CBSI_PLAYER.swf" -p "http://www.cbsnews.com/video/watch/?id=7316962n" -C Z: -y "mp4:media/2011/02/03/60_sadatrewind_0203_598.m4v" -o 60_sadatrewind_0203_598.flv