[FFmpeg-user] RTMP handshaking behind a proxy
Verachten Bruno
gounthar at gmail.com
Tue Dec 10 19:47:16 EET 2019
Hi there,
I unfortunately have to stream from behind a proxy. It works on one of my
machines thanks to redsocks. The RTMP handshake goes well, and I can stream
to twitch or youtube.
On another machine, with the same redsocks configuration, the handshake
never finishes, be it with youtube or twitch. The ffmpeg command is just a
copy of an already h.264 encoded stream from rtmp to rtmp.
My question is: is there a random port opened for the negotiation? Where
should I look for the blocking of the handshake?
Here is the command I have and the output:
ffmpeg -i "$SOURCE" -c:v copy -c:a copy -f flv "$YOUTUBE_URL/$KEY"
-loglevel debug
[...]
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'rtmp://
192.168.1.217:1935/live/stream15'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument
'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument
'copy'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'flv'.
Reading option 'rtmp://live-cdg.twitch.tv/app/live_of_myself' ... matched
as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtmp://
192.168.1.217:1935/live/stream15.
Successfully parsed a group of options.
Opening an input file: rtmp://192.168.1.217:1935/live/stream15.
[NULL @ 0xc401d0] Opening 'rtmp://192.168.1.217:1935/live/stream15' for
reading
[rtmp @ 0xc40990] No default whitelist set
[tcp @ 0xc41010] No default whitelist set
[tcp @ 0xc41010] Original list of addresses:
[tcp @ 0xc41010] Address 192.168.1.217 port 1935
[tcp @ 0xc41010] Interleaved list of addresses:
[tcp @ 0xc41010] Address 192.168.1.217 port 1935
[tcp @ 0xc41010] Starting connection attempt to 192.168.1.217 port 1935
[tcp @ 0xc41010] Successfully connected to 192.168.1.217 port 1935
[rtmp @ 0xc40990] Handshaking...
[rtmp @ 0xc40990] Type answer 3
[rtmp @ 0xc40990] Server version 13.14.10.13
[rtmp @ 0xc40990] Proto = rtmp, path = /live/stream15, app = live, fname =
stream15
[rtmp @ 0xc40990] Window acknowledgement size = 5000000
[rtmp @ 0xc40990] Max sent, unacked = 5000000
[rtmp @ 0xc40990] New incoming chunk size = 20480
[rtmp @ 0xc40990] Creating stream...
[rtmp @ 0xc40990] Sending play command for 'stream15'
[flv @ 0xc401d0] Format flv probed with size=2048 and score=100
[flv @ 0xc401d0] Before avformat_find_stream_info() pos: 13 bytes
read:32868 seeks:0 nb_streams:0
[flv @ 0xc401d0] Unknown type |RtmpSampleAccess
[NULL @ 0xc432a0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[NULL @ 0xc432a0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[NULL @ 0xc432a0] unknown SEI type 229
[h264 @ 0xc432a0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0xc432a0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0xc432a0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0xc432a0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0xc432a0] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0xc432a0] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0xc432a0] unknown SEI type 229
[h264 @ 0xc432a0] Format yuv420p chosen by get_format().
[h264 @ 0xc432a0] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0xc432a0] nal_unit_type: 1(Coded slice of a non-IDR picture),
nal_ref_idc: 3
Last message repeated 5 times
[flv @ 0xc401d0] All info found
[flv @ 0xc401d0] rfps: 29.750000 0.015408
[flv @ 0xc401d0] rfps: 29.833333 0.010802
[flv @ 0xc401d0] rfps: 29.916667 0.008256
[flv @ 0xc401d0] rfps: 30.000000 0.007768
Last message repeated 1 times
[flv @ 0xc401d0] rfps: 29.970030 0.007707
Last message repeated 1 times
[flv @ 0xc401d0] Setting avg frame rate based on r frame rate
[flv @ 0xc401d0] After avformat_find_stream_info() pos: 66491 bytes
read:66491 seeks:0 frames:105
Input #0, flv, from 'rtmp://192.168.1.217:1935/live/stream15':
Duration: N/A, start: 9159.905000, bitrate: N/A
Stream #0:0, 41, 1/1000: Video: h264 (High), 1 reference frame,
yuv420p(progressive, left), 1920x1080 (1920x1088), 0/1, 29.97 fps, 29.97
tbr, 1k tbn
Stream #0:1, 64, 1/1000: Audio: aac (LC), 48000 Hz, stereo, fltp
Successfully opened the file.
Parsing a group of options: output url rtmp://
live-cdg.twitch.tv/app/live_of_myself.
Applying option c:v (codec name) with argument copy.
Applying option c:a (codec name) with argument copy.
Applying option f (force format) with argument flv.
Successfully parsed a group of options.
Opening an output file: rtmp://live-cdg.twitch.tv/app/live_of_myself.
[rtmp @ 0xc528c0] No default whitelist set
[tcp @ 0xcacff0] No default whitelist set
[tcp @ 0xcacff0] Original list of addresses:
[tcp @ 0xcacff0] Address 52.223.195.16 port 1935
[tcp @ 0xcacff0] Address 52.223.195.119 port 1935
[tcp @ 0xcacff0] Address 52.223.195.169 port 1935
[tcp @ 0xcacff0] Address 52.223.195.205 port 1935
[tcp @ 0xcacff0] Address 52.223.195.9 port 1935
[tcp @ 0xcacff0] Interleaved list of addresses:
[tcp @ 0xcacff0] Address 52.223.195.16 port 1935
[tcp @ 0xcacff0] Address 52.223.195.119 port 1935
[tcp @ 0xcacff0] Address 52.223.195.169 port 1935
[tcp @ 0xcacff0] Address 52.223.195.205 port 1935
[tcp @ 0xcacff0] Address 52.223.195.9 port 1935
[tcp @ 0xcacff0] Starting connection attempt to 52.223.195.16 port 1935
[tcp @ 0xcacff0] Successfully connected to 52.223.195.16 port 1935
[rtmp @ 0xc528c0] Handshaking...
and I never get any other information, until CTRL+C.
[rtmp @ 0xc528c0] Cannot read RTMP handshake response
rtmp://live-cdg.twitch.tv/app/live_of_myself: Immediate exit requested
[AVIOContext @ 0xc42a50] Statistics: 66491 bytes read, 0 seeks
[rtmp @ 0xc40990] Deleting stream...
Exiting normally, received signal 2.
On the other machine, I go until the end of the handshaking:
Opening an output file: rtmp://live-cdg.twitch.tv/app/live_of_myself.
[rtmp @ 0x55a25d70e880] No default whitelist set
[tcp @ 0x55a25d5ce220] No default whitelist set
[rtmp @ 0x55a25d70e880] Handshaking...
[rtmp @ 0x55a25d70e880] Type answer 3
[rtmp @ 0x55a25d70e880] Server version 1.2.3.4
[rtmp @ 0x55a25d70e880] Proto = rtmp, path = /app/ live_of_myself , app =
app, fname = live_of_myself
[rtmp @ 0x55a25d70e880] Window acknowledgement size = 2500000
[rtmp @ 0x55a25d70e880] Max sent, unacked = 2500000
[rtmp @ 0x55a25d70e880] New incoming chunk size = 4096
[rtmp @ 0x55a25d70e880] Releasing stream...
[rtmp @ 0x55a25d70e880] FCPublish stream...
[rtmp @ 0x55a25d70e880] Creating stream...
[rtmp @ 0x55a25d70e880] Sending publish command for ' live_of_myself '
Successfully opened the file.
Thanks.
--
Bruno Verachten
More information about the ffmpeg-user
mailing list