我正在尝试在 Debian 系统上运行(Raspberry Pi上的Dietpi):
v4l2rtspserver -H 1080 -W 1920 -F 30 -P 8555 /dev/video0
但是尽管添加了& disown ,它仍然在命令控制台中运行
我也尝试过使用& 作业,但好像什么都没有,它一直在命令控制台中运行,而不是在后台运行。
我注意到的是v4l2rtspserver运行多个进程,我想这可能是那里的问题。
[1]+ Running v4l2rtspserver -H 1080 -W 1920 -F 30 -P 8555 /dev/video0 &
dietpi@DietPi:~$ log level:500
[NOTICE] /home/dietpi/v4l2rtspserver/main.cpp:297
Version: 0.3.3-8-gb007df2 live555 version:2022.04.26
[NOTICE] /home/dietpi/v4l2rtspserver/src/V4l2RTSPServer.cpp:37
Create V4L2 Source.../dev/video0
[NOTICE] /home/dietpi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:133
driver:bm2835 mmal capabilities:85200005 mandatory:4000001
[NOTICE] /home/dietpi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:136
/dev/video0 support capture
[NOTICE] /home/dietpi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:138
/dev/video0 support read/write
[NOTICE] /home/dietpi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:139
/dev/video0 support streaming
[NOTICE] /home/dietpi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:225
/dev/video0:H264 size:1920x1080 bufferSize:2088960
[NOTICE] /home/dietpi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:246
fps:1/30
[NOTICE] /home/dietpi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:247
nbBuffer:1
[NOTICE] /home/dietpi/v4l2rtspserver/v4l2wrapper/src/V4l2MmapDevice.cpp:49
Device /dev/video0
[NOTICE] /home/dietpi/v4l2rtspserver/v4l2wrapper/src/V4l2MmapDevice.cpp:73
Device /dev/video0 nb buffer:10
[NOTICE] /home/dietpi/v4l2rtspserver/src/V4l2RTSPServer.cpp:62
Create Source .../dev/video0
[NOTICE] /home/dietpi/v4l2rtspserver/src/V4L2DeviceSource.cpp:96
begin thread
[NOTICE] /home/dietpi/v4l2rtspserver/inc/BaseServerMediaSubsession.h:49
format:video/H264
[NOTICE] /home/dietpi/v4l2rtspserver/inc/V4l2RTSPServer.h:80
我只使用Linux很短时间,我无法确定问题所在。这是怎么回事?谢谢。
编辑:
感谢user1686的解决方案,它现在在后台运行没有问题,但我试图让它在系统启动时运行脚本,但我不能。我在/etc/systemd/system/v4l2rtsp.service中添加了:
[Unit]
Description=prueba
After=dev-video0.device
[Service]
Type=exec
User=dietpi
ExecStart=/home/dietpi/script_v4l2rtsp.sh
[Install]
WantedBy=multi-user.target
然后我保存了文件,我放了这个命令,但是流没有启动:
sudo systemctl start v4l2rtsp
我也试图让它像这样在启动时运行,但也没有:
sudo systemctl enable v4l2rtsp
虽然如果我独立运行文件,它可以完美运行:
dietpi@DietPi:~$ sudo bash script_v4l2rtsp.sh
[1]+ Running v4l2rtspserver -H 1080 -W 1920 -F 30 -P 8555 /dev/video0 &> /dev/null &
dietpi@DietPi:~$
那可能会发生吗?