Unwanted delay in webcam streaming

Hi all,

I am doing some experiments with webcam streaming in FreeBSD-11.1, I got it working but there is a little issue, there is always a delay when I view my stream, I don't find what is wrog in the configuration.

These are my configurations and commmands; which I stole here and there from the Internet and adapted just a bit.

-] With pwcview I can see well the output of my webcam, not problems here.

-] File ffserver.conf is
Code:
HttpPort 9000
RtspPort 9001 
# bind to all IPs aliased or not 
HttpBindAddress 0.0.0.0 
# max number of simultaneous clients 
MaxClients 1000 
# max bandwidth per-client (kb/s) 
MaxBandwidth 10000 
# Suppress that if you want to launch ffserver as a daemon. 
NoDaemon 

<Feed feed1.ffm> 
File /tmp/feed1.ffm 
FileMaxSize 5M 
</Feed> 

<Stream test.mpeg4>
Feed feed1.ffm
Format rtp
VideoCodec mpeg4
VideoFrameRate 15
# VideoBufferSize 80000
VideoBufferSize 10
VideoBitRate 100
VideoQMin 1
VideoQMax 5
VideoSize 352x288
PreRoll 0
Noaudio
</Stream>

-] I run the streaming server as : ffserver -f ffserver.conf

-] I feed ffserver with ffmpeg -r 25 -s 352x288 -i /dev/video0 http://localhost:9000/feed1.ffm

-] I see the stream with mplayer rtsp://localhost:9001/test.mpeg4
 

SirDice

Administrator
Staff member
Administrator
Moderator
There will always be some delay (latency) because ffmpeg has to receive the stream, buffer it, analyze it, (re)encode it and then send it out. And all this processing takes time.
 
There will always be some delay (latency) because ffmpeg has to receive the stream, buffer it, analyze it, (re)encode it and then send it out. And all this processing takes time.

Well, ok, my fault, I did not say the delay is around 10-30 seconds.
I guess it can not be related to computations, too large IMO.
 
I restarted webcamd with the -B option (for background execution),
it seems this solved the issue, now the delay seems about 1-2 seconds;
acceptable.
 
I found another thing that maybe was contributing to delay.
in ffserver.conf I set now VideoFrameRate 35 ,
, VideoBufferSize 80000 and finally I feed ffserver with a congruent frame rate:
ffmpeg -r 35 -s 352x288 -i /dev/video0 http://localhost:9000/feed1.ffm

At the moment the delay seems to be under the second, almost un-noticeable.

I will try again later, if things keep working I will mark the thread solved,
thank you for assistance SirDice !
 
Top