Open f321x opened 4 years ago
I've solved by editing the "raprec.c" file. first remove (or comment) lines 128 and 129 :
//system("uvcdynctrl -s 'Exposure, Auto' -- 3");
//system("uvcdynctrl -s 'Exposure, Auto Priority' -- 1");
then change line 163:
//execl("/usr/local/bin/ffmpeg", "ffmpeg", "-y", "-i", "/dev/video0", "-c:v", "h264_omx", "-b:v", "5M", fileStr, (char *)NULL);
execl("/usr/bin/ffmpeg", "ffmpeg", "-y", "-i", "/dev/video0", "-c:v", "libx264", "-b:v", "5M", fileStr, (char *)NULL);
then type in a terminal in the same folder of the file:
sudo systemctl stop raprec
sudo rm raprec
sudo rm raprun
sudo make && sudo make install
sudo systemctl restart raprec
and the recording will start.
With this setup i've found the video a bit laggy, so I've changed again line 163 with:
execl("/usr/bin/ffmpeg", "ffmpeg", "-y", "-f", "video4linux2", "-s", "1280x720", "-i", "/dev/video0", "-c:v", "libx264", "-preset", "ultrafast", "-tune", "zerolatency", "-b:v", "2M", fileStr, (char *)NULL);
With this setup it will record at 720p since is my webcam max resolution.
I end up using this, that also record the audio from the webcam mic (you might need to change the audio device):
execl("/usr/bin/ffmpeg", "ffmpeg", "-y", "-f", "video4linux2", "-s", "1280x720", "-i", "/dev/video0", "-thread_queue_size", "512", "-f", "alsa", "-ac", "1", "-i", "plughw:1,0", "-c:v", "libx264", "-preset", "ultrafast", "-tune", "zerolatency", "-b:v", "2M", "-c:a", "aac", "-b:a", "128k", fileStr, (char *)NULL);
be sure to have ffmpeg installed, the one in the setup.h didn't work for me but you can install it with:
sudo apt install ffmpeg
I've find out that the command i used in the end, made a video not compatible with pretty much anything other than vlc. So now i'm using this:
execl("/usr/bin/ffmpeg", "ffmpeg", "-y", "-f", "video4linux2", "-s", "1280x720", "-i", "/dev/video0", "-thread_queue_size", "512", "-f", "alsa", "-ac", "1", "-i", "plughw:1,0", "-c:v", "libx264", "-preset", "ultrafast", "-tune", "zerolatency", "-profile:v", "baseline", "-level", "3.0", "-pix_fmt", "yuv420p", "-b:v", "2M", "-c:a", "aac", "-b:a", "128k", "-movflags", "+faststart", fileStr, (char *)NULL);
I've forgot to mention that the libmysqlclient-dev is not available anymore, you should use libmariadb-dev and edit the Makefile like this:
all: raprec raprun
raprec: raprec.c
gcc raprec.c -o raprec -Wall -I/usr/include/mariadb -L/usr/lib/mariadb -lmariadb -lm
raprun: raprun.c
gcc raprun.c -o raprun -Wall -I/usr/include/mariadb -L/usr/lib/mariadb -lmariadb -lbluetooth
install:
cp raprec /usr/bin
cp raprun /usr/bin
chmod u+s /usr/bin/raprun
clean:
-rm raprec raprun
and also change line 34 of raprec.c and line 37 of raprun.c with this:
#include <mariadb/mysql.h>
i'll make a fork sooner or later with these and other changes (the setup.sh is a mess under bookworm...)
Hi @nu00 with you new code I've got recordings but no live video, I've tried changing the ffmpeg command but no luck yet, my camera is a C922 and it seems to be tricky to use.
This seems to explain the issue but I don't know how to put this in raprec.c https://raspberrypi.stackexchange.com/questions/63798/get-h264-from-webcam-logitech-c922
Hi @mgueji, I abandoned the project and bought a real dashcam. Sorry, but I can't help you since I don't remember how it works.
The web interface works, it just won't record any footage.
The webcam itself won't activate either, the led's on it won't light up. I can get the webcam to work by using VLC, so i know the webcam itself works. Both VLC and RoadApplePi are setup to use /dev/video0, so that in itself is correct.
I also can't seem to find any error logging, even though it mentions setting up syslog in raprec.c.
I did use matt2005's version, at that seems to be updated to work with raspbian buster.
If i run raprec.c using the terminal, i am getting some errors from v4l2, such as:
invalid v4l2 control type encountered Unknown v4l2 mpeg control id
Altough that might be because the software itself is already running at this point.
I did try a different webcam, that didn't change anything.
Copied the issue from @theelichtje but have the exact same problem. Maybe here someone has a solution?