How to capture the H.264 stream of a Logitech c920 camera

Solution 1:

This is a partial answer, but from what I recall the C920 doesn't stream in H264 by default. I think it defaults to MJPEG (which would explain the blurriness), the 3rd option being YUV.

If you follow this thread, you'll see that I had to change the streaming mode using v4l2ctl (in Linux) to obtain a H264 stream. Assuming you've got a Linux computer somewhere:

#this sets the C920 cam to H264 encoding, framerate 30/1:
v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=1 

Hopefully, the configuration remains after unplugging the webcam, allowing you to use it on OSX...

If you're interested in a less "native" solution than QuickTime, the rest of the thread describes how to use gstreamer, either by rtp streaming or local capture. I didn't try it on OSX but you can try replacing v4l2src by osxvideosrc:

gst-launch-1.0 -vvv osxvideosrc \
! video/x-h264, width=1920, height=1080, framerate=30/1 \
! queue max-size-buffers=1 \
! matroskamux \
! filesink location=/tmp/video.mkv

... which should give you a Matroska file.