Opened 5 years ago

Last modified 3 years ago

#2294 reopened defect

timeout option does not work for rtsp streaming

Reported by: chinshou Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: rtsp
Cc: jbvsmo Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

after setting timeout option, I can not playback the correct rtsp url

C:\Conversion>ffplay -v 999 -timeout 10 rtsp://xxx.com:554/live
.sdp
ffplay version N-45279-g1a104bf Copyright (c) 2003-2012 the FFmpeg developers

built on Oct 10 2012 19:19:16 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runt

ime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass -
-enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-l
ibfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenj
peg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheo
ra --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --ena
ble-zlib

libavutil 51. 74.100 / 51. 74.100
libavcodec 54. 65.100 / 54. 65.100
libavformat 54. 31.100 / 54. 31.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.102 / 3. 19.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100

[rtsp @ 041030e0] Unable to open RTSP for listening
rtsp://vpn.sincerasolutions.com:554/live.sdp: Unknown error

if I remove the timeout option , it will playback correctly.

but by default ffmpeg will hangup when the server down if without timeout option.

for example executing following command to playback non-exists url will hangup the ffplay client.

C:\Conversion>ffplay -v 999 rtsp://192.168.222.222/adfakf
ffplay version N-45279-g1a104bf Copyright (c) 2003-2012 the FFmpeg developers

built on Oct 10 2012 19:19:16 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runt

ime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass -
-enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-l
ibfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenj
peg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheo
ra --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --ena
ble-zlib

libavutil 51. 74.100 / 51. 74.100
libavcodec 54. 65.100 / 54. 65.100
libavformat 54. 31.100 / 54. 31.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.102 / 3. 19.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100

Change History (7)

comment:1 Changed 5 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Keywords rtsp added
  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from unspecified to git-master

Fixed by Michael in 0678c38

comment:2 Changed 4 years ago by sporn

This hasn't been fixed

  • it will hang on a non-existant rtsp url
  • specifying a timeout breaks rtsp playback entirely

comment:3 Changed 3 years ago by jbvsmo

  • Resolution fixed deleted
  • Status changed from closed to reopened

The problem persists as reported!

Using the -timeout option will show an error message:

[rtsp @ 0x7fa6bc0008c0] Unable to open RTSP for listening
rtsp://******: Cannot assign requested address

Without this option, the process will hang forever.

comment:4 Changed 3 years ago by cehoyos

  • Cc jbvsmo added

How can I reproduce this problem?

comment:5 Changed 3 years ago by jbvsmo

Use any url that exists (doesn't need to be a real rtsp server)

ffmpeg -i rtsp://example.com/test test.avi

It will hang forever because there is no rtsp server (this is simulating the case where the server is down for maintenance).

Now try adding -timeout 10 as input option. Instead of waiting for 10 seconds and finishing the process, the error above will show instantly.

It may be an error on the code setting the socket timeout. It looks like it wants to bind an IP but the address is used

comment:6 Changed 3 years ago by smvv

I've submitted a patch that will address this issue: https://github.com/FFmpeg/FFmpeg/pull/91

comment:7 Changed 3 years ago by cehoyos

Please send patches to the ffmpeg-devel mailing list where they can be reviewed.

Note: See TracTickets for help on using tickets.