I want to record the best possible video file (in terms of resolution/framerate/colors) from my webcam.
Right now I am using this command:
ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 output.mkv
My webcam seems to support this:
$ ffmpeg -f v4l2 -list_formats all -i /dev/video0
…
[video4linux2,v4l2 @ 0xf07d80] Raw : yuyv422 : YUV 4:2:2 (YUYV) : 640x480 160x120 176x144 320x176 320x240 352x288 432x240 544x288 640x360
[video4linux2,v4l2 @ 0xf07d80] Compressed: mjpeg : MJPEG : 640x480 160x120 176x144 320x176 320x240 352x288 432x240 544x288 640x360
I guess I got the resolution part, but how can I improve my command line to:
- Use no compression (I suspect the current .mkv output is compressed)
- Use the best framerate that the camera&computer is capable of, without duplicating frames either (no point saving the file at 100 fps if the webcam is not capable of capturing frames at that rate)
- All ideas to further improve the video quality are welcome