Opened 9 years ago

Closed 15 months ago

Last modified 15 months ago

#2294 closed defect (fixed)

timeout option does not work for rtsp streaming

Reported by: chinshou Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: rtsp
Cc: Bernardo 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 (8)

comment:1 by Carl Eugen Hoyos, 9 years ago

Component: undeterminedavformat
Keywords: rtsp added
Resolution: fixed
Status: newclosed
Version: unspecifiedgit-master

Fixed by Michael in 0678c38

comment:2 by sean tearney, 9 years ago

This hasn't been fixed

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

comment:3 by Bernardo, 8 years ago

Resolution: fixed
Status: closedreopened

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 by Carl Eugen Hoyos, 8 years ago

Cc: Bernardo added

How can I reproduce this problem?

comment:5 by Bernardo, 8 years ago

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 by Sander Mathijs van Veen, 8 years ago

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

comment:7 by Carl Eugen Hoyos, 8 years ago

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

comment:8 by Andriy Gelman, 15 months ago

Resolution: fixed
Status: reopenedclosed

The option from 0678c38 is -stimeout, which works. But note the units are microseconds.

Currently -timeout infers a listen mode. But this behavior will change after the version bump, after which it will be the same as -stimeout option.

Last edited 15 months ago by Andriy Gelman (previous) (diff)
Note: See TracTickets for help on using tickets.