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:
ffmpeg
command and not just an excerpt, and also show the output ofv4l2-ctl --list-formats-ext
.v412-ctl
installed. I believe the key was to use themjpeg
codec - see my own answer below. After I found out how to record my webcam in VLC, I think I even prefer that.