Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   rtmpdump (http://stream-recorder.com/forum/forumdisplay.php?f=54)
-   -  

RTMPDump query to ffmpeg query? (nginx rtmp module)

(http://stream-recorder.com/forum/showthread.php?t=22747)

sinanksu 03-13-2017 05:28 AM

RTMPDump query to ffmpeg query? (nginx rtmp module)


 
Hi,

I want to reflect a live broadcast from rtmp in the same way as "nginx rtmp module".

I ran that live broadcast with the following rtmpdump query. I installed an Ubuntu server. Then I installed the nginx rtmp module. This module has ffmpeg in the examples.

How do I write the rtmpdump question on fmmeg?

Successful rtmpdump query:

Quote:

rtmpdump -r "rtmpe://xx.xx.xx.xx/xlive" -a "xlive" -f "WIN 23,0,0,162" -s "http://xxxx.com/Player.swf" -w "5aaaa32059cba7xxxxxxxxxxx" -x "585534" -p "http://xxxxxxxxxxxx.com/viewer?game=1" -C S:client -C S:3.1.0.10 -C S:en --live -y "raw:472237" -o "2017blablabla.flv"

Quote:


rtmp {
server {
listen 1935;
chunk_size 4096;

application live {
live on;
record off;
exec ffmpeg -i "rtmpe://xx.xx.xx.xx/xlive" -a "xlive" -f "WIN 23,0,0,162" -s "http://xxxx.com/Player.swf" -w "5aaaa32059cba7xxxxxxxxxxx" -x "585534" -p "http://xxxxxxxxxxxx.com/viewer?game=1" -C S:client -C S:3.1.0.10 -C S:en --live -y "raw:472237";
}
application live360p {
live on;
record off;
}
}
}

Thank you

j_cool 03-13-2017 05:38 AM

Re: RTMPDump query to ffmpeg query? (nginx rtmp module)


 
Use librtmp parameters with ffmpeg.

https://rtmpdump.mplayerhq.hu/librtmp.3.html

sinanksu 03-13-2017 05:47 AM

Re: RTMPDump query to ffmpeg query? (nginx rtmp module)


 
Quote:

Originally Posted by j_cool (Post 90244)
Use librtmp parameters with ffmpeg.

https://rtmpdump.mplayerhq.hu/librtmp.3.html



Hi j_cool,

I tried but I could not get it working.

j_cool 03-13-2017 05:50 AM

Re: RTMPDump query to ffmpeg query? (nginx rtmp module)


 
C:\>rtmpdump -h
RTMPDump v2.4 GIT-2015-12-14 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL

rtmpdump: This program dumps the media content streamed over RTMP.

--help|-h Prints this help screen.
--url|-i url URL with options included (e.g. rtmp://host[:port]/path swfUrl=url tcUrl=url)
--rtmp|-r url URL (e.g. rtmp://host[:port]/path)
--host|-n hostname Overrides the hostname in the rtmp url
--port|-c port Overrides the port in the rtmp url
--socks|-S host:port Use the specified SOCKS proxy
--protocol|-l num Overrides the protocol in the rtmp url (0 - RTMP, 2 - RTMPE)
--playpath|-y path Overrides the playpath parsed from rtmp url
--playlist|-Y Set playlist before playing
--swfUrl|-s url URL to player swf file
--tcUrl|-t url URL to played stream (default: "rtmp://host[:port]/app")
--pageUrl|-p url Web URL of played programme
--app|-a app Name of target app on server
--swfhash|-w hexstring SHA256 hash of the decompressed SWF file (32 bytes)
--swfsize|-x num Size of the decompressed SWF file, required for SWFVerification
--swfVfy|-W url URL to player swf file, compute hash/size automatically
--swfAge|-X days Number of days to use cached SWF hash before refreshing
--auth|-u string Authentication string to be appended to the connect string
--conn|-C type:data Arbitrary AMF data to be appended to the connect string
B:boolean(0|1), S:string, N:number, O:object-flag(0|1),
Z:(null), NB:name:boolean, NS:name:string, NN:name:number
--flashVer|-f string Flash version string (default: "WIN 10,0,32,18")
--live|-v Save a live stream, no --resume (seeking) of live streams possible
--subscribe|-d string Stream name to subscribe to (otherwise defaults to playpath if live is specifed)
--realtime|-R Don't attempt to speed up download via the Pause/Unpause BUFX hack
--flv|-o string FLV output file name, if the file name is - print stream to stdout
--resume|-e Resume a partial RTMP download
--timeout|-m num Timeout connection num seconds (default: 30)
--start|-A num Start at num seconds into stream (not valid when using --live)
--stop|-B num Stop at num seconds into stream
--token|-T key Key for SecureToken response
--ccommand|-K key Send custom command before play
--jtv|-j JSON Authentication token for Justin.tv legacy servers
--weeb|-J string Authentication token for weeb.tv servers
--hashes|-# Display progress with hashes, not with the byte counter
--buffer|-b Buffer time in milliseconds (default: 36000000)
--skip|-k num Skip num keyframes when looking for last keyframe to resume from. Useful if resume fails (default: 0)
--quiet|-q Suppresses all command output.
--verbose|-V Verbose command output.
--debug|-z Debug level command output.
If you don't pass parameters for swfUrl, pageUrl, or auth these properties will not be included in the connect packet.

confused.com 03-13-2017 06:06 AM

Re: RTMPDump query to ffmpeg query? (nginx rtmp module)


 
http://stream-recorder.com/forum/ple...ng-t22585.html

j_cool 03-13-2017 08:50 AM

Re: RTMPDump query to ffmpeg query? (nginx rtmp module)


 
ffmpeg -i "rtmpe://xx.xx.xx.xx/xlive app=xlive flashVer=WIN%%2023,0,0,162 swfUrl=http://xxxx.com/Player.swf swfhash=5aaaa32059cba7xxxxxxxxxxx swfsize=58553 pageUrl=http://xxxxxxxxxxxx.com/viewer?game=1 conn=S:client conn=S:3.1.0.10 conn=S:en live=1 playpath=raw:472237" -c copy "2017blablabla.flv"

sinanksu 03-13-2017 09:08 AM

Re: RTMPDump query to ffmpeg query? (nginx rtmp module)


 
Quote:

Originally Posted by j_cool (Post 90253)
ffmpeg -i "rtmpe://xx.xx.xx.xx/xlive app=xlive flashVer=WIN%%2023,0,0,162 swfUrl=http://xxxx.com/Player.swf swfhash=5aaaa32059cba7xxxxxxxxxxx swfsize=58553 pageUrl=http://xxxxxxxxxxxx.com/viewer?game=1 conn=S:client conn=S:3.1.0.10 conn=S:en live=1 playpath=raw:472237" -c copy "2017blablabla.flv"

Hi j_cool,

Thank you for your reply.

I tried it like this. But I have not been successful. It works with RTMPDump but it does not work with ffmpeg. Also I could not send you the swf in ffmpeg. This swf size parameter does not exist.


Quote:

C:\f>ffmpeg -i "rtmpe://93.189.57.254/xlive app=xlive flashVer=WIN%%24,0,0,221 swfUrl=http://sportstream365.com/swf/VideoPlayer.swf swfAge=5aaaa32059cba732636c28519b2ce34a3568f1058a8 bd02d6a932643554ccbb4 swfVfy=1 pageUrl=http://sportstream365.com/viewer?game=107954793 conn=S:client conn=S:3.1.0.10 conn=S:en live=1 playpath=raw:478576" -c copy "2017blablabla.flv"
ffmpeg version N-83882-g58f0bbc Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 48.100 / 55. 48.100
libavcodec 57. 83.100 / 57. 83.100
libavformat 57. 66.104 / 57. 66.104
libavdevice 57. 3.100 / 57. 3.100
libavfilter 6. 76.100 / 6. 76.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
RTMP_ReadPacket, failed to read RTMP packet header
rtmpe://93.189.57.254/xlive app=xlive flashVer=WIN%%24,0,0,221 swfUrl=http://sportstream365.com/swf/VideoPlayer.swf swfAge=5aaaa32059cba732636c28519b2ce34a3568f1058a8 bd02d6a932643554ccbb4 swfVfy=1 pageUrl=http://sportstream365.com/viewer?game=107954793 conn=S:client conn=S:3.1.0.10 conn=S:en live=1 playpath=raw:478576: Unknown error occurred


j_cool 03-13-2017 09:35 AM

Re: RTMPDump query to ffmpeg query? (nginx rtmp module)


 
This is not right:

flashVer=WIN%%24,0,0,221

It is about handling empty space within parameter.
From beginning to the end of parameter no empty space is allowed.
It is replaced with %%20 in batch file, with %20 on command line.

You can see real life example in my old post,

http://stream-recorder.com/forum/sho...57&postcount=3

and here it says it right.

http://www.robvanderwoude.com/escapechars.php

Your progress is good, it is troubleshooting little bits from here now on.

One more to "escape":

? with \?

pageUrl=http://sportstream365.com/viewer?game=107954793

pageUrl=http://sportstream365.com/viewer\?game=107954793

sinanksu 03-13-2017 01:20 PM

Re: RTMPDump query to ffmpeg query? (nginx rtmp module)


 
Quote:

Originally Posted by j_cool (Post 90256)
...

Hi j_cool, thanks for the answer.

But I did not. Unable to verify SWF.

When I used rtmpdump in the past, I could not verify the swf. Then I added the swf size to the query. And rtmpdump worked.

Now, there is no parameter needed to add swf size to ffmpeg.

How will I do.




Quote:


C:\f>ffmpeg -i "rtmpe://93.189.57.254/xlive app=xlive swfUrl=http://streamsport365.com/swf/VideoPlayer.swf swfAge=5aaaa32059cba732636c28519b2ce34a3568f1058a8 bd02d6a932643554ccbb4 swfVfy=0 pageUrl=http://streamsport365.com/viewer\?game=107954793 conn=S:client conn=S:3.1.0.10 conn=S:en live=1 playpath=raw:478879" -c copy "2017blablabla.flv"
ffmpeg version N-83882-g58f0bbc Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 48.100 / 55. 48.100
libavcodec 57. 83.100 / 57. 83.100
libavformat 57. 66.104 / 57. 66.104
libavdevice 57. 3.100 / 57. 3.100
libavfilter 6. 76.100 / 6. 76.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
HandleCtrl: Ignoring SWFVerification request, use --swfVfy!
rtmp server sent error

Metadata:
width 720.00
height 400.00
Input #0, flv, from 'rtmpe://93.189.57.254/xlive app=xlive swfUrl=http://streamsport365.com/swf/VideoPlayer.swf swfAge=5aaaa32059cba732636c28519b2ce34a3568f1058a8 bd02d6a932643554ccbb4 swfVfy=0 pageUrl=http://streamsport365.com/viewer\?game=107954793 conn=S:client conn=S:3.1.0.10 conn=S:en live=1 playpath=raw:478879':
Duration: N/A, start: 0.021000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 720x400 [SAR 80:81 DAR 16:9], 25 fps, 47 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
File '2017blablabla.flv' already exists. Overwrite ? [y/N] y
Output #0, flv, to '2017blablabla.flv':
Metadata:
encoder : Lavf57.66.104
Stream #0:0: Video: h264 (High) ([7][0][0][0] / 0x0007), yuv420p(progressive), 720x400 [SAR 80:81 DAR 16:9], q=2-31, 25 fps, 47 tbr, 1k tbn, 1k tbc
Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
RTMP_ReadPacket, failed to read RTMP packet body. len: 4597902
frame= 120 fps=0.0 q=-1.0 Lsize= 265kB time=00:00:01.98 bitrate=1095.8kbits/s speed=8.57x
video:229kB audio:32kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.654435%



j_cool 03-13-2017 03:53 PM

Re: RTMPDump query to ffmpeg query? (nginx rtmp module)


 
Your question is complicated, but the answer can be simple.

If something worked well with rtmpdump, it must work with ffmpeg as well. FFmpeg and Rtmpdump are both based on librtmp.

It is just matter of "translating" rtmpdump command to ffmpeg command.

There is one simple example of that, here.

http://stream-recorder.com/forum/ple...ng-t22585.html

escaping ? with \? appears not to be necessary in this case, so this is error here,
( Required only inside the regex pattern of FINDSTR ).
I noticed it is an error when I saw it showing on command line when you executed the command, on command line
you should see it all "as is", and purpose of escaping in batch file is to see it "as is" on command line.

Appart from that, I cannot see other syntax error in your last ffmpeg command so I suspect parameters themselves.
To solve that I would try to replicate parameters identically from old rtmpdump command that worked.


All times are GMT -6. The time now is 09:00 AM.