Cheers guys. Over the last days, i’ve been trying to set up a USB webcam via FFmpeg. I’m quite green when it comes to this kinda stuff so apologies if I talk any nonsense.
So the first issue was, that the test recording command ( the one from the official home assistant page about FFmpeg ) :
$ ffmpeg -i /dev/video0 -codec:v libx264 -qp 0 lossless.mp4
would only record a black video without sound that would skip right to the end when played in a media player. I believe to have figured out that that’s caused by the fact that my webcam (Logitech c922) seems to have some kind of hardware encoding included. I managed to fix this by adding the -f video4linux2
line before -i
and changed the output format from .mp4
to .mpeg
. Also, I had to remove the -codec:v libx264
for it to finally record some viewable video footage. So the complete command that I managed to get working on a test recording is:
$ ffmpeg -f video4linux2 -i /dev/video0 lossless.mpeg
Now back to what I’m actually trying: Implementing this into my Home Assistant Interface via the FFmpeg Camera Component.
First of all, let’s see what I’ve already got entered in my config:
For the FFmpeg component:
ffmpeg:
ffmpeg_bin: /usr/bin/ffmpeg
And for the Camera component:
camera:
- platform: ffmpeg
input: -i /dev/video0
extra_arguments: -f video4linux2
So far so good, I’m not getting any errors from the config… BUT sadly the Camera panel in the frontend still shows “FFmpeg (Image not available)”. I’ve tried adding different extra_arguments but nothing changed. So now I’m out of ideas and need some help adjusting this. I have a few suspicions like for example that that’s caused by the same thing that won’t let me record .mp4
videos, forcing me to record in .mpeg
format but then again I have not a single clue what I’m talking about.
Any and all help is greatly appreciated!
Greetings,
Nik