RTSP Stream Freezing

About encoding, codec settings, muxers and filter usage
vocm88
Blank Cone
Blank Cone
Posts: 11
Joined: 05 May 2011 08:33

RTSP Stream Freezing

Postby vocm88 » 11 May 2011 01:35

Hi forum!

I am using VLC (ver 1.1.9) to connect to video streaming from a camera connected to a network IP device/encoder. When the encoder is configured to encode video at 25 [fps], I can successfully connect to the video using VLC and it works fantastically. However if I configure the encoder to display at frame rates lower than 25 such as 20, 12, 5 or 3 [fps] I can successfully connect, but the video freezes after a period of time (which varies). This is followed by intermittent bursts of distorted video alternating with frozen frames. I have found several similar posts on this forum, but they regard playing local .avi files, which freeze when seeking. Notwithstanding, I have tried the suggestions on those posts to no avail (for example the skip loop filter trick). Below is the log which is generated when the stream freezes:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- logger module started --
main debug: using interface module "logger"
main debug: TIMER module_need() : 60.000 ms - Total 60.000 ms / 1 intvls (Avg 60.000 ms)
main debug: looking for interface module: 1 candidate
main debug: using interface module "hotkeys"
main debug: TIMER module_need() : 8.000 ms - Total 8.000 ms / 1 intvls (Avg 8.000 ms)
main error: option syslog does not exist
main debug: Creating an input for 'rtsp://192.168.1.104/moxa-cgi/udpstream_ch1_stream1_h264'
main debug: thread started
main debug: thread (input) created at priority 1 (../.././src/input/input.c:220)
main debug: using timeshift granularity of 50 MiB
main debug: using timeshift path 'C:\Users\VICTOR~1\AppData\Local\Temp'
main debug: `rtsp://192.168.1.104/moxa-cgi/udpstream_ch1_stream1_h264' gives access `rtsp' demux `' path `192.168.1.104/moxa-cgi/udpstream_ch1_stream1_h264'
main debug: creating demux: access='rtsp' demux='' path='192.168.1.104/moxa-cgi/udpstream_ch1_stream1_h264'
main debug: looking for access_demux module: 1 candidate
live555 debug: RTP subsession 'video/H264'
main debug: selecting program id=0
live555 debug: RTP subsession 'audio/PCMU'
live555 debug: setup start: 0.000000 stop:0.000000
live555 debug: play start: 0.000000 stop:0.000000
main debug: using access_demux module "live555"
main debug: TIMER module_need() : 709.000 ms - Total 709.000 ms / 1 intvls (Avg 709.000 ms)
main debug: looking for decoder module: 34 candidates
avcodec debug: libavcodec initialized (interface 0x347700)
avcodec debug: trying to use direct rendering
avcodec debug: ffmpeg codec (H264 - MPEG-4 AVC (part 10)) started
main debug: using decoder module "avcodec"
main debug: TIMER module_need() : 118.000 ms - Total 118.000 ms / 1 intvls (Avg 118.000 ms)
main debug: looking for packetizer module: 21 candidates
packetizer_h264 debug: found NAL_SPS (sps_id=0)
packetizer_h264 debug: found NAL_PPS (pps_id=0 sps_id=0)
main debug: using packetizer module "packetizer_h264"
main debug: TIMER module_need() : 32.000 ms - Total 32.000 ms / 1 intvls (Avg 32.000 ms)
main debug: thread started
main debug: thread (decoder) created at priority 0 (../.././src/input/decoder.c:301)
main debug: looking for decoder module: 34 candidates
araw debug: samplerate:8000Hz channels:1 bits/sample:0
main debug: using decoder module "araw"
main debug: TIMER module_need() : 2.000 ms - Total 2.000 ms / 1 intvls (Avg 2.000 ms)
main debug: thread started
main debug: thread (decoder) created at priority 2 (../.././src/input/decoder.c:301)
main debug: looking for meta reader module: 2 candidates
lua debug: Trying Lua scripts in C:\Users\Voc\AppData\Roaming\vlc\lua\meta\reader
lua debug: Trying Lua scripts in C:\DATA\CODE\Projects\lua\meta\reader
main debug: no meta reader module matching "any" could be loaded
main debug: TIMER module_need() : 2.000 ms - Total 2.000 ms / 1 intvls (Avg 2.000 ms)
main debug: `rtsp://192.168.1.104/moxa-cgi/udpstream_ch1_stream1_h264' successfully opened
main debug: creating aout
main debug: Buffering 0%
main debug: Buffering 0%
main debug: looking for audio output module: 4 candidates
main debug: Buffering 16%
aout_directx debug: Opening DirectSound Audio Output
main debug: Buffering 16%
main debug: Buffering 32%
main debug: Buffering 32%
main debug: Buffering 48%
aout_directx debug: found device: Primary Sound Driver
aout_directx debug: found device: Realtek Digital Output (Realtek High Definition Audio)
aout_directx debug: device supports 2 channels (DEFAULT!)
aout_directx debug: device supports 1 channel
aout_directx debug: Windows says your SpeakerConfig is stereo
aout_directx debug: creating DirectSoundThread
main debug: thread started
main debug: thread (DirectSound Notification Thread) created at priority 15 (../../.././modules/audio_output/directx.c:321)
aout_directx debug: DirectSoundThread ready
main debug: using audio output module "aout_directx"
main debug: TIMER module_need() : 53.000 ms - Total 53.000 ms / 1 intvls (Avg 53.000 ms)
main debug: output 's16l' 8000 Hz Stereo/Mono frame=1 samples/4 bytes
main debug: mixer 'f32l' 8000 Hz Stereo/Mono frame=1 samples/8 bytes
main debug: filter(s) 'f32l'->'s16l' 8000 Hz->8000 Hz Stereo/Mono->Stereo/Mono
main debug: looking for audio filter module: 14 candidates
main debug: Buffering 64%
main debug: Buffering 80%
main debug: Buffering 80%
main debug: no usable vout present, spawning one
main debug: looking for text renderer module: 2 candidates
audio_format debug: f32l->s16l, bits per sample: 32->16
main debug: using audio filter module "audio_format"
main debug: TIMER module_need() : 85.000 ms - Total 85.000 ms / 1 intvls (Avg 85.000 ms)
main debug: found a filter for the whole conversion
freetype debug: Building font databases.
main debug: looking for audio mixer module: 3 candidates
main debug: using audio mixer module "float32_mixer"
freetype debug: Took 5000 microseconds
main debug: TIMER module_need() : 5.000 ms - Total 5.000 ms / 1 intvls (Avg 5.000 ms)
main debug: input 's16l' 8000 Hz Mono frame=1 samples/2 bytes
freetype debug: Using Arial as font from file C:/Windows/fonts/arial.ttf
main debug: looking for audio filter module: 1 candidate
freetype debug: using fontsize: 2
main debug: using text renderer module "freetype"
scaletempo debug: format: 8000 rate, 2 nch, 4 bps, fl32
main debug: TIMER module_need() : 18.000 ms - Total 18.000 ms / 1 intvls (Avg 18.000 ms)
scaletempo debug: params: 30 stride, 0.200 overlap, 14 search
main debug: Buffering 80%
scaletempo debug: 1.000 scale, 240.000 stride_in, 240 stride_out, 192 standing, 48 overlap, 112 search, 400 queue, fl32 mode
main debug: looking for video filter2 module: 18 candidates
main debug: using audio filter module "scaletempo"
main debug: TIMER module_need() : 7.000 ms - Total 7.000 ms / 1 intvls (Avg 7.000 ms)
main debug: filter(s) 's16l'->'f32l' 8000 Hz->8000 Hz Mono->Stereo/Mono
main debug: looking for audio filter module: 14 candidates
main debug: no audio filter module matching "any" could be loaded
main debug: TIMER module_need() : 8.000 ms - Total 8.000 ms / 1 intvls (Avg 8.000 ms)
main debug: looking for audio filter module: 14 candidates
audio_format debug: s16l->f32l, bits per sample: 16->32
swscale debug: 32x32 chroma: YUVA -> 16x16 chroma: YUVA with scaling using Bicubic (good quality)
main debug: using audio filter module "audio_format"
main debug: using video filter2 module "swscale"
main debug: TIMER module_need() : 1.000 ms - Total 1.000 ms / 1 intvls (Avg 1.000 ms)
main debug: TIMER module_need() : 17.000 ms - Total 17.000 ms / 1 intvls (Avg 17.000 ms)
main debug: looking for audio filter module: 14 candidates
main debug: looking for video filter2 module: 18 candidates
main debug: using audio filter module "trivial_channel_mixer"
main debug: TIMER module_need() : 1.000 ms - Total 1.000 ms / 1 intvls (Avg 1.000 ms)
main debug: found 2 filters for the whole conversion
main debug: filter(s) 'f32l'->'f32l' 8800 Hz->8000 Hz Stereo/Mono->Stereo/Mono
main debug: looking for audio filter module: 14 candidates
bandlimited_resampler debug: f32l/8800KHz/2->f32l/8000KHz/2
main debug: using audio filter module "bandlimited_resampler"
main debug: TIMER module_need() : 8.000 ms - Total 8.000 ms / 1 intvls (Avg 8.000 ms)
main debug: found a filter for the whole conversion
main debug: End of audio preroll
main debug: Buffering 96%
yuvp debug: YUVP to YUVA converter
main debug: using video filter2 module "yuvp"
main debug: TIMER module_need() : 54.000 ms - Total 54.000 ms / 1 intvls (Avg 54.000 ms)
main debug: window size: 720x576
main debug: Deinterlacing available
main debug: deinterlace 0, mode blend, is_needed 0
main debug: looking for video output module: 1 candidate
vout_wrapper debug: Opening vout display wrapper
main debug: looking for vout display module: 1 candidate
main debug: VoutDisplayEvent 'fullscreen' 0
main debug: VoutDisplayEvent 'resize' 720x576 window
main debug: using vout display module "vmem"
main debug: TIMER module_need() : 7.000 ms - Total 7.000 ms / 1 intvls (Avg 7.000 ms)
main debug: A filter to adapt decoder to display is needed
main debug: looking for video filter2 module: 18 candidates
swscale debug: 720x576 chroma: I420 -> 720x576 chroma: RV24 with scaling using Bicubic (good quality)
main debug: using video filter2 module "swscale"
main debug: TIMER module_need() : 1.000 ms - Total 1.000 ms / 1 intvls (Avg 1.000 ms)
main debug: Filter 'Swscale' (084ca8c8) appended to chain
main debug: using video output module "vout_wrapper"
main debug: TIMER module_need() : 14.000 ms - Total 14.000 ms / 1 intvls (Avg 14.000 ms)
main debug: got 1 direct buffer(s)
main debug: pic render sz 720x576, of (0,0), vsz 720x576, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0
main debug: pic in sz 720x576, of (0,0), vsz 720x576, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0
main debug: pic out sz 720x576, of (0,0), vsz 720x576, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0
main debug: direct render, mapping render pictures 0-23 to system pictures 1-24
avcodec debug: using direct rendering
main debug: End of video preroll
main debug: Received first picture
freetype debug: using fontsize: 36
main debug: looking for video blending module: 1 candidate
blend debug: chroma: YUVA -> I420
main debug: using video blending module "blend"
main debug: TIMER module_need() : 6.000 ms - Total 6.000 ms / 1 intvls (Avg 6.000 ms)
main debug: Stream buffering done (448 ms in 288 ms)
main debug: Decoder buffering done in 1 ms
main warning: PTS is out of range (-10000), dropping buffer
main warning: buffer is 65000 late, triggering upsampling
main debug: Post-processing available
main warning: vlc_object_find_name(postproc) is not safe!
main warning: output date isn't PTS date, requesting resampling (42875)
main warning: timing screwed, stopping resampling
main warning: buffer is 105963 late, triggering upsampling
main warning: audio drift is too big (131899), dropping buffer
main warning: resampling stopped after 516000 usec (drift: -37231)
main warning: buffer is 65345 late, triggering upsampling
main warning: resampling stopped after 1343000 usec (drift: -38366)
main warning: buffer is 55235 late, triggering upsampling
live555 debug: lost 993 bytes
live555 debug: increasing buffer size to 131072
main warning: late picture skipped (245276 > -980)
live555 debug: lost 349 bytes
live555 debug: increasing buffer size to 262144
main warning: resampling stopped after 3263000 usec (drift: -14786)
main warning: late picture skipped (4461356 > -526)
main warning: late picture skipped (6047982 > -592)
main warning: late picture skipped (6669051 > -598)
main warning: late picture skipped (582154 > -579)
main warning: late picture skipped (906911 > -573)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
main warning: late picture skipped (932858 > -609)
main warning: late picture skipped (906983 > -734)
main warning: late picture skipped (1253087 > -622)
main warning: late picture skipped (609079 > -609)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
main warning: late picture skipped (923461 > -360)
main warning: late picture skipped (584575 > -547)
main warning: late picture skipped (918375 > -500)
main warning: late picture skipped (612565 > -778)
main warning: late picture skipped (609513 > -538)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
main warning: late picture skipped (258599 > -963)
main warning: late picture skipped (281314 > -694)
main warning: late picture skipped (294792 > -656)
main warning: late picture skipped (263729 > -453)
main warning: late picture skipped (261876 > -471)
main debug: control type=0
main debug: control: stopping input
main debug: thread times: real 0m46.257645s, kernel 0m0.046800s, user 0m0.546003s
avcodec debug: ffmpeg codec (H264 - MPEG-4 AVC (part 10)) stopped
main debug: removing module "avcodec"
main debug: killing decoder fourcc `h264', 0 PES in FIFO
main debug: [0] 4 0
main debug: [1] 0 0
main debug: [2] 0 0
main debug: [3] 0 0
main debug: [4] 0 0
main debug: [5] 0 0
main debug: [6] 0 0
main debug: [7] 0 0
main debug: [8] 0 0
main debug: [9] 0 0
main debug: [10] 0 0
main debug: [11] 4 0
main debug: [12] 4 0
main debug: [13] 4 0
main debug: [14] 2 0
main debug: [15] 0 0
main debug: [16] 0 0
main debug: [17] 0 0
main debug: [18] 0 0
main debug: [19] 0 0
main debug: [20] 0 0
main debug: [21] 0 0
main debug: [22] 0 0
main debug: [23] 0 0
main debug: saving a free vout
main debug: removing module "packetizer_h264"
main debug: thread times: real 0m46.261646s, kernel 0m0.015600s, user 0m0.140400s
main debug: removing module "araw"
main debug: killing decoder fourcc `mlaw', 0 PES in FIFO
main debug: removing module "audio_format"
main debug: removing module "trivial_channel_mixer"
main debug: removing module "scaletempo"
main debug: removing module "bandlimited_resampler"
aout_directx debug: closing audio device
aout_directx debug: DirectSoundThread exiting
main debug: thread ended
main debug: thread times: real 0m46.289647s, kernel 0m0.000000s, user 0m0.218401s
main debug: removing module "aout_directx"
main debug: removing module "audio_format"
main debug: removing module "float32_mixer"
main debug: releasing aout
main debug: removing module "live555"
main debug: Program doesn't contain anymore ES
main debug: thread ended
main debug: thread times: real 0m47.469715s, kernel 0m0.156001s, user 0m0.140400s
main debug: Destroying the input for 'rtsp://192.168.1.104/moxa-cgi/udpstream_ch1_stream1_h264'
main debug: TIMER input launching for 'rtsp://192.168.1.104/moxa-cgi/udpstream_ch1_stream1_h264' : 877.000 ms - Total 877.000 ms / 1 intvls (Avg 877.000 ms)
main debug: destroying useless vout
main debug: Filter 084ca8c8 removed from chain
main debug: removing module "swscale"
main debug: removing module "vmem"
main debug: removing module "vout_wrapper"
main debug: removing module "blend"
main debug: removing module "freetype"
main debug: removing module "yuvp"
main debug: removing module "swscale"
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I am using VLC ver 1.1.9 on a Windows 7 machine (i7 2.80 GHz processor with 4 GB RAM). This, and the fact that it works fine at 25 [fps] leads me to believe the "avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)" line is not due to a slow computer. Does anyone know what the freezing could be related to? Is it a codec issue?

Any help would be greatly appreciated,
Voc.

vocm88
Blank Cone
Blank Cone
Posts: 11
Joined: 05 May 2011 08:33

Re: RTSP Stream Freezing

Postby vocm88 » 12 May 2011 03:05

After some further investigation, I've noted two things:

1. Audio continues when video freezes. More importantly...
2. When set at 25 [fps] I have the RTSP caching set at 48 [ms] so as to minimise the video delay (and this works fine). However, I change the RTSP cache dynamically with frame rate.
For 3 [fps], I have the RTSP cache set at 400 [ms]. I use the following formula to determine RTSP caching:

RTSP cache = ( 1000 [ms] / fps ) * 1.2 where 1.2 is a safety factor.

When I set the RTSP caching to the default 1200 [ms], the video seems to work fine at the lower frame rates but the video is delayed, which I am trying to avoid.
Is my understanding of the RTSP cache factor, and my theory of changing it incorrect? Could changing the RTSP cache factor as such cause the freezing?

Again, any help would be greatly appreciated.
Kind regards,
Voc

kajla
New Cone
New Cone
Posts: 1
Joined: 24 May 2011 12:44

Re: RTSP Stream Freezing

Postby kajla » 24 May 2011 12:53

Hello,

I have the same effect with version 1.1.7, Pixord IP camera with RTSP streaming configured, either in MPEG4 or MJPEG mode, under any framerate, and it isn't affected by the framerate either. I'm testing it under win XP.

I'm using libvlc with delphi, for creating my own program, and I've noticed that also the lib and the vlc.exe executable produces this effect.

Although, if I configure VLC to output into a file instead of the screen, the recorded video doesn't freeze at all, and the file can be played with vlc without problems, it's running continuously.

I suppose this could be a bug within the vlc lib, I will test it under linux soon, and will report the results here.

Does anyone have some suggestions? It would be important to solve this, beause I use vlc in one of my work projects.


Regards, Peter

LogainStark
New Cone
New Cone
Posts: 6
Joined: 12 Nov 2010 15:37

Re: RTSP Stream Freezing

Postby LogainStark » 27 Sep 2011 09:29

Hello,

I post also on this thread since I experiment something similar with VLC 1.1.11 (directly or through a C# wrapper) and nobody seems to respond to this one
I am connecting VLC to an ACTi RSTP encoder (MPEG4), it works fine for a various amount of time before its freeze.
If I close and restart VLC, it reconnects fine and the streaming is OK (until it freezes again)
If I launch the media player given with the encoder, It does not freeze
If I launch our own basic RTSP Grabber (made with Live555 and FFMpeg !!!!) and that I recreate a RTSP stream on localhost, VLC does not freeze on this one

With rtsp-caching=10ms and every other options to default value, I get

main warning: clock gap, unexpected stream discontinuity
main warning: feeding synchro with a new reference point trying to recover from clock gap
main warning: early picture skipped
main warning: early picture skipped
main warning: early picture skipped
main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 179 ms)
main debug: ES_OUT_RESET_PCR called
main warning: early picture skipped
main debug: Buffering 0%
main debug: End of video preroll
main debug: Received first picture
main debug: Buffering 0%
main debug: Buffering 0%
main debug: Buffering 0%

--> this last message continues forever


I have tried many VLC options mentionned in other threads to overcome this problem (each option alone or in combinations with others), such as :
--rtsp-session-timeout=-1
--clock-synchro=0
--cr-average=10000
--clock-jitter=0
--rtsp-wmserver

So, my question is : Is there a set of vlc options that can fix this issue, or at least a way to detect this frozen state using libvlc API?
Because I have made a watchdog which asks periodically VLC state (using libvlc_media_player_get_state or libvlc_media_player_is_playing), and even when it is frozen, VLC replies "Playing", which does not help me much

Any help would be appreciated

Thanks in advance


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 8 guests