How to force the use of TCP protocol when capturing RTSP protocol video streams?
yanest opened this issue · comments
The -rtsp_transport tcp
parameter in ffmpeg.
TRANS_BY_GPT3
Using the following format in ffmpeg, you can capture it, but I couldn't find the corresponding setting method in SRS2.0. The main concern is how to add double quotes and how to add the parameters to force TCP.
ffmpeg -rtsp_transport tcp -i "rtsp://admin:12345678@192.168.2.21:554/Streaming/Channels/501?transportmode=unicast" -vcodec copy -an -f flv rtmp://127.0.0.1:1935/live/mystream
TRANS_BY_GPT3
Double quotation marks are only necessary in the command line. In fact, SRS fork processes do not require double quotation marks.
TRANS_BY_GPT3
ingest {
enabled on;
input {
type stream;
url rtsp://admin:12345678@192.168.2.21:554/Streaming/Channels/501?transportmode=unicast;
}
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled on;
perfile {
rtsp_transport tcp;
}
vcodec copy;
acodec copy;
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
}
}
Added a profile that supports adding rtsp_transport in front of -i.
TRANS_BY_GPT3
Generated log:
[2017-01-06 10:38:51.105][trace][9604][105] fored process, pid=9605, bin=./objs/ffmpeg/bin/ffmpeg, stdout=./objs/ffmpeg-ingest-__defaultVhost__-live-livestream.log, stderr=./objs/ffmpeg-ingest-__defaultVhost__-live-livestream.log, argv=./objs/ffmpeg/bin/ffmpeg -rtsp_transport tcp -i rtsp://admin:12345678@192.168.2.21:554/Streaming/Channels/501?transportmode=unicast -vcodec copy -acodec copy -f flv -y rtmp://127.0.0.1:1935/live?vhost=__defaultVhost__/livestream
TRANS_BY_GPT3
Note that it is resolved by SRS3.
TRANS_BY_GPT3