Does anybody have a glue why I can't get ffmpeg to record my webcam higher than 8 fps, with ffmpeg? I've tried Cheese and GUVCView, under various settings, but all I get is a still picture. I'm obviously doing this in Linux.

I've tried to force the framerate to 30fps, but then the resulting recording is at the wrong speed, too fast, like in a slapstick movie from the twenties.

My ffmpeg command:

ffmpeg -f alsa -i default -f v4l2 -s 1280x720 -r 30 -i /dev/video0 -c:a copy -b:v 2000k output.mkv

I thought I might record a video in the Web Camera application in Windows 10 - which works - examine the resulting video in ffmpeg, and try to mimick the codecs somehow. However I'm lost at how I can do that.

This is how ffmpeg describes the Windows recording:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'prufaLenCam_160223.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp41isom creation_time : 2016-02-23 07:56:11 Duration: 00:00:28.50, start: 0.000000, bitrate: 8116 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], 7949 kb/s, 29.69 fps, 30 tbr, 30k tbn, 60 tbc (default) Metadata: creation_time : 2016-02-23 07:56:11 handler_name : VideoHandler encoder : AVC Coding Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default) Metadata: creation_time : 2016-02-23 07:56:11 handler_name : SoundHandler No pixel format specified, yuvj420p for H.264 encoding chosen. Use -pix_fmt yuv420p for compatibility with outdated media players.

Output from the Linux ffmpeg command tried:


  • Please show the complete console output from your ffmpeg command and not just an excerpt, and also show the output of v4l2-ctl --list-formats-ext.
    – llogan
    Feb 24 '16 at 3:03
  • Just edited my question to include the output. I don't have v412-ctl installed. I believe the key was to use the mjpeg codec - see my own answer below. After I found out how to record my webcam in VLC, I think I even prefer that.
    – theodorn
    Feb 24 '16 at 6:24

Did some more research, and believe I've solved the issue with this command:

ffmpeg -f alsa -i default -f v4l2 -c:v mjpeg -s 1280x720 -i /dev/video0 -t 30 -b:v 2000k test.mp4

Based on the information here - the last comment from the author of the question, but adapted for my own system and preferences.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.