How to use a GoPro Hero 8 as a webcam on linux

March 2020

linux video4linux gopro rtmp ffmpeg

Tired of having a shitty integrated webcam ?

Use your GoPro Hero 8 as video4linux video source!

Basically, we will use ffmpeg as rtmp server and feed video4linux with the video stream.

I’m using Debian GNU/Linux for the demonstration

Install

sudo apt install ffmpeg v4l2loopback-dkms
sudo modprobe v4l2loopback exclusive_caps=1

Note: exclusive_caps=1 is required for many applications to see the v4l device as a source as soon as an output is present. (by default v4l2loopback obviously exposes source and output capabilities)

Run the rtmp server

ffmpeg -f flv -listen 1 -i rtmp://0.0.0.0:1935/app/live -fflags nobuffer -f:v mpegts -probesize 8192 -map 0:v -pix_fmt yuv420p -r 20 -f v4l2 /dev/video2

Note: on my machine, v4l2loopback was using /dev/video2, it may be different on your machine.