[FFmpeg-user] Webcam RTMP stream - video problems

Wuttke, Nikolai Nikolai.Wuttke at student.hpi.uni-potsdam.de
Mon Nov 25 12:52:24 CET 2013

I'm trying to capture audio and video from a webcam and stream it via RTMP to a Red5 media server, where others can then view the live stream.
When I do it from a Flash applet (Publisher Demo from the Red5 distribution), it works without problems.
When I use ffmpeg, trying to stream *both* audio and video causes stuttering and delayed video playback.
The video stream will be lagging behind what I do in front of the camera by approximately half a second, and it doesn't look "fluid".
My command line and environment:
OS: Windows 7 x64
FFmpeg version: N-58308-ge502783

Command line:
ffmpeg -f dshow -video_size 640x480 -framerate 15 -i "video=USB Video Device:audio=Microphone (4- USB Audio Device"^
    -r 15/1 -s 640x480^
    -acodec nellymoser -ac 1 -ar 22050^
    -aq 30^
    -q 28^
    -threads 0^
    -f flv rtmp://my-server-url/oflaDemo/test
I'm using the Nellymoser codec because that's what the Flash applet uses - I also tried MP3 but then the delay is even worse.
I've played around with the quality settings quite a bit, and some seem to result in a little less delay, but I couldn't find a convincing setting yet.
If instead of streaming I write to a local flv file, it works great. If I disable the audio stream, it also works without problems.
I don't think network bandwidth is an issue, as the server is connected via LAN.
Do you have any suggestions regarding parameters/configuration, or what I could look into? Are other codecs more likely to work without problems?
Best Regards,
Console output:
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, dshow, from 'video=USB Video Device:audio=Microphone (4- USB Audio Device':
  Duration: N/A, start: 26089.932000, bitrate: 1411 kb/s
    Stream #0:0: Video: mjpeg, yuvj422p(pc), 640x480, 15 tbr, 10000k tbn, 15 tbc
    Stream #0:1: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
[swscaler @ 0000000000301600] deprecated pixel format used, make sure you did set range correctly
Output #0, flv, to 'rtmp://fb10dtools-dev/oflaDemo/test':
    encoder         : Lavf55.21.100
    Stream #0:0: Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p, 640x480, q=2-31, 200 kb/s, 1k tbn, 15 tbc
    Stream #0:1: Audio: nellymoser ([6][0][0][0] / 0x0006), 22050 Hz, mono, flt, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> flv)
  Stream #0:1 -> #0:1 (pcm_s16le -> nellymoser)
Press [q] to stop, [?] for help
[nellymoser @ 0000000000370280] Queue input is backward in time

More information about the ffmpeg-user mailing list