I'm trying to stream h264 video from my Logitech C920 webcam. I'm using such ffserver.conf:

Port 8099



RTSPPort 5004

MaxClients 10

MaxBandwidth 10000

CustomLog -

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

<Stream viewport1>
        Feed feed1.ffm
        Format rtp
        VideoCodec libx264
        VideoFrameRate 15
        VideoBufferSize 40
        VideoBitRate 3000
        VideoQMin 1
        VideoQMax 31
        VideoSize 640x480
        PreRoll 0
        Strict -1

<Stream stat.html>
        Format status

<Redirect index.html>
        URL http://ffmpeg.sourceforge.net/

And I'm starting ffmpeg like this:

./ffmpeg -f video4linux2 -s 640x480 -r 15 -re -i /dev/video0 -an -vcodec libx264  -bf 5  http://localhost:8099/feed1.ffm

But in the output there is:

[video4linux2,v4l2 @ 0xc0b5e0] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 2930.711051, bitrate: 73728 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 73728 kb/s, 15 tbr, 1000k tbn, 15 tbc
[libx264 @ 0xc183f0] using cpu capabilities: ARMv6 NEON
[libx264 @ 0xc183f0] VBV buffer size cannot be smaller than one frame, using 400 kbit
[libx264 @ 0xc183f0] profile High 4:2:2, level 2.2, 4:2:2 8-bit
[libx264 @ 0xc183f0] 264 - core 120 r2151 a3f4407 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=5 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=1 weightp=2 keyint=50 keyint_min=5 scenecut=0 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=3000 ratetol=1.0 qcomp=0.50 qpmin=10 qpmax=51 qpstep=4 vbv_maxrate=6000 vbv_bufsize=400 nal_hrd=none ip_ratio=1.40 aq=1:1.00
Output #0, ffm, to 'http://localhost:8099/feed1.ffm':
    creation_time   : now
    encoder         : Lavf54.44.100
    Stream #0:0: Video: h264, yuv422p, 640x480, q=10-51, 3000 kb/s, 1000k tbn, 15 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> libx264)
Press [q] to stop, [?] for help
[libx264 @ 0xc183f0] VBV buffer size cannot be smaller than one frame, using 400 kbit
frame=   12 fps=0.0 q=0.0 size=       4kB time=00:00:00.00 bitrate=   0.0kbits/sframe=   22 fps= 20 q=0.0 size=       4kB time=00:00:00.00 bitrate=   0.0kbits/sframe=   30 fps= 19 q=0.0 size=       4kB time=00:00:00.00 bitrate=   0.0kbits/sframe=   38 fps= 18 q=0.0 size=       4kB time=00:00:00.00 bitrate=   0.0kbits/s

Any suggestion how not to do transcoding and stream the video directly?

  • Your question seems to contradicts itself. "I'm trying to stream h264 video" with "Any suggestion how not to do transcoding". What is it you want?
    – gertvdijk
    Dec 17, 2012 at 14:23
  • 1
    Apparently, this webcam should be able to output h264 directly, so there should be no transcoding needed... I suppose that's the gist of the question
    – sr_
    Dec 17, 2012 at 14:54
  • Yeah, sr_ understands correctly. I'm sorry for my poor English, if it's a reason of this misunderstanding.
    – Val
    Dec 17, 2012 at 14:59
  • Random guess, can you specify a video codec of copy? That works with other ffmpeg stuff, but I've never used ffserver.
    – derobert
    Dec 17, 2012 at 17:14
  • 1
    I'm successfully streaming video in MJPEG directly from camera. With H264 there is a problem in ffmpeg itself as far as I understand. ffmpeg.org/trac/ffmpeg/ticket/1387
    – Val
    Dec 18, 2012 at 14:14

2 Answers 2


Actually I've succeed with streaming of h264 video with ffmpeg. I was able to do this with help from ffmpeg-user list, especially from Carl Eugen Hoyos, author of this patch:

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c 
index cd6aeb2..c3f813d 100644 
--- a/libavdevice/v4l2.c 
+++ b/libavdevice/v4l2.c 
@@ -150,6 +150,7 @@ static struct fmt_map fmt_conversion_table[] = { 
 #ifdef V4L2_PIX_FMT_CPIA1 

Actual command I've used:

./ffmpeg -f video4linux2 -s 640x480 -r 15 -vcodec h264 -i /dev/video0 -an http://localhost:8099/feed1.ffm

But I wasn't able to get rid of transcoding, so I switched to vlc (and succeed).


Try the copy option on the output stream -codec copy:

./ffmpeg -f video4linux2 -s 640x480 -r 15 -vcodec h264 -i /dev/video0 -codec copy -an http://localhost:8099/feed1.ffm

This works with mixed results. I am able to copy with vcodec set to mjpeg but not h264 even though the Logitech HD920 supports both. The copy option greatly reduces CPU utilization.

PS. Use the latest build as copy may have been broken in earlier versions.

  • 2
    I'm doing something similar,the problem I have is that I cannot stream the result, I entered the URL in VLC it seems try connecting but it doesn't show anything, any idea what could be wrong? Jan 18, 2020 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .