Force FFMPEG to use TCP protocol when reading a RTSP Stream
47,110
Just put the -rtsp_transport tcp
right after ffmpeg
to apply it on the input stream. Like this:
ffmpeg -rtsp_transport tcp -i "rtsp://x.x.x.x:554/user=x&password=x&channel=2&stream=0.sdp" -y video.jpg
Related videos on Youtube
Author by
gary_star
Updated on July 30, 2022Comments
-
gary_star almost 2 years
I'm running
ffmpeg
(Windows 7, 64bit) from command line to get a frame from a RTSP stream (second channel from my DVR):ffmpeg -i "rtsp://xxx.xxx.xxx.xxx:554/user=xxxx&password=xxxx&channel=2&stream=0.sdp" -rtsp_transport tcp -y video.jpg
After running, it waits for about 10 seconds and then i get:
[rtsp @ 026fd840] UDP timeout, retrying with TCP
After another long wait (2 minutes or so), i get:
[rtsp @ 028dd840] Could not find codec parameters for stream 0 (Video: h264): unspecified size
I read somewhere that I have to force using TCP, because changing from UDP to TCP will not work.
I don't understand why
-rtsp_transport tcp
is not working.I'm using
ffmpeg version N-62509-g97751e1 built on Apr 17 2014 22:01:31 with gcc 4.8.2 (GCC)
.Please help me. Thank you.
-
Teocci almost 6 yearsTry this: ffplay -fflags nobuffer -flags low_delay -framedrop -strict experimental -rtsp_transport tcp rtsp://ip_address:port
-
-
Notinlist about 8 yearsWhy do you have
-rtsp_transport tcp
twice? -
Fotios Basagiannis about 8 years@Notinlist just forgot to remove it from the original answer :) Edited!
-
ttous over 4 yearsThe " right after
ffmpeg
" part is important. It didn't work for me otherwise. -
Dave Sims over 3 yearsWhen I try this I get "Option rtps_transport not found". I know this is an old one, but any advice would be really appreciated.
-
cmxl almost 3 years@DaveSims looks like a typo:
rtsp
notrtps