[FFmpeg-user] ffmpeg/ffserver setup with webcam

Jean Paul Talledo Vilela JTalledoVilela at vtti.vt.edu
Wed Jul 23 14:19:12 CEST 2014


Hello

I am trying to stream a webcam video using ffmpeg and ffserver. I am new on this and that's why I am asking for some help.

Webcam Model is Logitech C920. It supports the following:

[video4linux2,v4l2 @ 0x9cbc1c0] Raw       :   yuyv422 :     YUV 4:2:2 (YUYV) : 640x480 160x90 160x120 176x144 320x180 320x240 352x288 432x240 640x360 800x448 800x600 864x480 960x720 1024x576 1280x720 1600x896 1920x1080 2304x1296 2304x1536

[video4linux2,v4l2 @ 0x9cbc1c0] Compressed:      h264 :                H.264 : 640x480 160x90 160x120 176x144 320x180 320x240 352x288 432x240 640x360 800x448 800x600 864x480 960x720 1024x576 1280x720 1600x896 1920x1080

[video4linux2,v4l2 @ 0x9cbc1c0] Compressed:     mjpeg :                MJPEG : 640x480 160x90 160x120 176x144 320x180 320x240 352x288 432x240 640x360 800x448 800x600 864x480 960x720 1024x576 1280x720 1600x896 1920x1080

I run the following command to stream video to the server:

ffmpeg -v verbose -s 640x480 -r 30 -f video4linux2 -i /dev/video0  http://serverip/feed1.ffm

On the server side, ffserver.conf looks like this:


Port 8090
# bind to all IPs aliased or not
BindAddress 0.0.0.0
# max number of simultaneous clients
MaxClients 1000
# max bandwidth per-client (kb/s)
MaxBandwidth 1000000
# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

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

<Stream test1.mpg>
Feed feed1.ffm
Format mpeg
VideoBitRate 500
VideoFrameRate 30
VideoSize 320x240
Noaudio
</Stream>

<Stream test1.mjpeg>
Feed feed1.ffm
Format mjpeg
VideoBitRate 4000
VideoFrameRate 30
VideoSize 320x240
Noaudio
</Stream>

<Stream stat.html>
Format status
</Stream>


When I use VLC to play the mjpeg stream using a computer on the same Server network, it works really good.  But when I connect externally from another IP, I am able to see few frames and then it gets frozen.

I run ffserver stats and it shows:

Connection Status
Number of connections: 5 / 1000
Bandwidth in use: 12000k / 1000000k
#

File

IP

Proto

State

Target bits/sec

Actual bits/sec

Bytes transferred

1

stat.html

128.173.193.43

HTTP/1.1

HTTP_WAIT_REQUEST

0

0

0

2

test1.mjpeg

70.208.149.23

HTTP/1.1

WAIT_FEED

4000k

110k

613k

3

test1.mjpeg

128.173.193.43

HTTP/1.1

WAIT_FEED

4000k

3285k

351M

4

test1.mjpeg

128.173.193.43

HTTP/1.1

WAIT_FEED

4000k

3283k

355M

5

feed1.ffm(input)

198.82.196.151

HTTP/1.1

RECEIVE_DATA

1000k

3937k

427M


Number 2 is the external IP, and the bit rate was different than the other one.

What does this mean? Should I decrease the bitrate to allow external IP's  get a better quality/frame rate from the server?

Also, what format/codec should I use for better performance/quality?

Thanks

JP

__________________________________
Jean Paul Talledo Vilela
Embedded Hardware Team Leader
Center for Technology Development
Virginia Tech Transportation Institute<https://mail.vtti.vt.edu/owa/redir.aspx?C=tSCEP4qYxEWdcgiClwiP9fcov7Fk7dAIPUBUCV03qYkK04ihuGQLdqYSpoGFcrTxhn97o8nr9ys.&URL=http%3a%2f%2fwww.vtti.vt.edu%2f>
(540) 231-1081



More information about the ffmpeg-user mailing list