BreeeZe / rpos

Raspberry Pi Onvif Server
http://breeeze.github.io/rpos
MIT License
643 stars 146 forks source link

Different video device #123

Open GeniusOnline opened 2 years ago

GeniusOnline commented 2 years ago

i have been trying to stream a v4l2loopback with rpos. i changed all the video0 refrences to video90 (my v4l2 device) but when i run the nod it says it cannot find /dev/video0

pi@raspberrypi:~/rpos $ node rpos.js
execSync('cat /proc/device-tree/model')
execSync('cat /proc/cpuinfo')
Read IP address from awdl0 failed
Read IP address 192.168.2.43 from eth0
Manufacturer : Raspberry Pi
Model : 2 B
HardwareId :
SerialNumber : 100000009471cc50
FirmwareVersion : 2.1.0
Starting camera settings webserver on http://192.168.2.43:8081/
execSync('v4l2-ctl --set-fmt-video=pixelformat=4')
Cannot open device /dev/video0, exiting.
execSync('v4l2-ctl --set-fmt-video=width=1280,height=720')
Cannot open device /dev/video0, exiting.
execSync('v4l2-ctl --set-parm=25')
Cannot open device /dev/video0, exiting.
execSync('v4l2-ctl --set-priority=3')
Cannot open device /dev/video0, exiting.
execSync('v4l2-ctl --set-ctrl contrast=32,saturation=32,power_line_frequency=2,s                                                                                                                                                             harpness=24')
Cannot open device /dev/video0, exiting.
execSync('v4l2-ctl -l')
Cannot open device /dev/video0, exiting.
Could not retrieve Controlvalue 'brightness'
Could not retrieve Controlvalue 'contrast'
Could not retrieve Controlvalue 'saturation'
Could not retrieve Controlvalue 'red_balance'
Could not retrieve Controlvalue 'blue_balance'
Could not retrieve Controlvalue 'horizontal_flip'
Could not retrieve Controlvalue 'vertical_flip'
Could not retrieve Controlvalue 'power_line_frequency'
Could not retrieve Controlvalue 'sharpness'
Could not retrieve Controlvalue 'color_effects'
Could not retrieve Controlvalue 'rotate'
Could not retrieve Controlvalue 'color_effects_cbcr'
Could not retrieve Controlvalue 'video_bitrate_mode'
Could not retrieve Controlvalue 'video_bitrate'
Could not retrieve Controlvalue 'repeat_sequence_header'
Could not retrieve Controlvalue 'h264_i_frame_period'
Could not retrieve Controlvalue 'h264_level'
Could not retrieve Controlvalue 'h264_profile'
Could not retrieve Controlvalue 'auto_exposure'
Could not retrieve Controlvalue 'exposure_time_absolute'
Could not retrieve Controlvalue 'exposure_dynamic_framerate'
Could not retrieve Controlvalue 'auto_exposure_bias'
Could not retrieve Controlvalue 'white_balance_auto_preset'
Could not retrieve Controlvalue 'image_stabilization'
Could not retrieve Controlvalue 'iso_sensitivity'
Could not retrieve Controlvalue 'exposure_metering_mode'
Could not retrieve Controlvalue 'scene_mode'
Could not retrieve Controlvalue 'compression_quality'
Binding DeviceService to http://192.168.2.43:8081/onvif/device_service
Binding MediaService to http://192.168.2.43:8081/onvif/media_service
Binding PTZService to http://192.168.2.43:8081/onvif/ptz_service
Binding ImagingService to http://192.168.2.43:8081/onvif/imaging_service
discovery_service started
ptz_service started
imaging_service started
device_service started
Starting Live555 rtsp server
spawn('./python/gst-rtsp-launch.sh', [-P,8554,-u,h264,-W,1280,-H,720,-d,/dev/video90], undefined)
media_service started
rtspServer: -P 8554 -u h264 -W 1280 -H 720 -d /dev/video90

rtspServer: INFO:root:StreamServer initialized

rtspServer: INFO:root:Video settings loaded from v4l2ctl.json

rtspServer: DEBUG:root:StreamServer.launch
INFO:root:USB camera ignored most of the parameters
DEBUG:root:( v4l2src device=/dev/video90 brightness=50 contrast=32 saturation=32 ! image/jpeg,width=1280,height=720,framerate=30/1 ! jpegdec ! clockoverlay ! omxh264enc target-bitrate=10000000 control-rate=variable ! video/x-h264,profile=baseline ! h264parse ! rtph264pay name=pay0 pt=96 )
INFO:root:Starting service on port 8554 at url /h264

rtspServer: INFO:root:Running RTSP Server

i've been looking into adding the device to udev (/etc/udev/rules.d/99com.rules) but didn't find out how to do it properly. inside the v4l2loopback there is a udev file so it shouldn't be necesarry in the first place.

GeniusOnline commented 2 years ago

i have fixed the issue by adding --device /dev/video90 in v4l2ctl.js so it specifies the device. there is however still no stream.

pi@raspberrypi:~/rpos $ node rpos.js
execSync('cat /proc/device-tree/model')
execSync('cat /proc/cpuinfo')
Read IP address from awdl0 failed
Read IP address 192.168.2.43 from eth0
Manufacturer : Raspberry Pi
Model : 2 B
HardwareId :
SerialNumber : 100000009471cc50
FirmwareVersion : 2.1.0
Starting camera settings webserver on http://192.168.2.43:8081/
execSync('v4l2-ctl --device /dev/video90 --set-fmt-video=pixelformat=4')
execSync('v4l2-ctl --device /dev/video90 --set-fmt-video=width=1280,height=720')
execSync('v4l2-ctl --device /dev/video90 --set-parm=25')
execSync('v4l2-ctl --device /dev/video90 --set-priority=3')
execSync('v4l2-ctl --device /dev/video90 --set-ctrl contrast=32,saturation=32,power_line_frequency=2,sharpness=24')
unknown control 'contrast'
execSync('v4l2-ctl --device /dev/video90 -l')
Could not retrieve Controlvalue 'brightness'
Could not retrieve Controlvalue 'contrast'
Could not retrieve Controlvalue 'saturation'
Could not retrieve Controlvalue 'red_balance'
Could not retrieve Controlvalue 'blue_balance'
Could not retrieve Controlvalue 'horizontal_flip'
Could not retrieve Controlvalue 'vertical_flip'
Could not retrieve Controlvalue 'power_line_frequency'
Could not retrieve Controlvalue 'sharpness'
Could not retrieve Controlvalue 'color_effects'
Could not retrieve Controlvalue 'rotate'
Could not retrieve Controlvalue 'color_effects_cbcr'
Could not retrieve Controlvalue 'video_bitrate_mode'
Could not retrieve Controlvalue 'video_bitrate'
Could not retrieve Controlvalue 'repeat_sequence_header'
Could not retrieve Controlvalue 'h264_i_frame_period'
Could not retrieve Controlvalue 'h264_level'
Could not retrieve Controlvalue 'h264_profile'
Could not retrieve Controlvalue 'auto_exposure'
Could not retrieve Controlvalue 'exposure_time_absolute'
Could not retrieve Controlvalue 'exposure_dynamic_framerate'
Could not retrieve Controlvalue 'auto_exposure_bias'
Could not retrieve Controlvalue 'white_balance_auto_preset'
Could not retrieve Controlvalue 'image_stabilization'
Could not retrieve Controlvalue 'iso_sensitivity'
Could not retrieve Controlvalue 'exposure_metering_mode'
Could not retrieve Controlvalue 'scene_mode'
Could not retrieve Controlvalue 'compression_quality'
Binding DeviceService to http://192.168.2.43:8081/onvif/device_service
Binding MediaService to http://192.168.2.43:8081/onvif/media_service
Binding PTZService to http://192.168.2.43:8081/onvif/ptz_service
Binding ImagingService to http://192.168.2.43:8081/onvif/imaging_service
discovery_service started
ptz_service started
imaging_service started
Starting Live555 rtsp server
spawn('./python/gst-rtsp-launch.sh', [-P,8554,-u,h264,-W,1280,-H,720,-d,/dev/video90], undefined)
media_service started
device_service started
rtspServer: -P 8554 -u h264 -W 1280 -H 720 -d /dev/video90

rtspServer: INFO:root:StreamServer initialized

rtspServer: INFO:root:Video settings loaded from v4l2ctl.json

rtspServer: DEBUG:root:StreamServer.launch
INFO:root:USB camera ignored most of the parameters
DEBUG:root:( v4l2src device=/dev/video90 brightness=50 contrast=32 saturation=32 ! image/jpeg,width=1280,height=720,framerate=30/1 ! jpegdec ! clockoverlay ! omxh264enc target-bitrate=10000000 control-rate=variable ! video/x-h264,profile=baseline ! h264parse ! rtph264pay name=pay0 pt=96 )
INFO:root:Starting service on port 8554 at url /h264

rtspServer: INFO:root:Running RTSP Server

Discovery received from 192.168.2.10
(node:3819) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Discovery received from 192.168.2.10
Discovery received from 192.168.2.10
Discovery received from 192.168.2.10
Discovery received from 192.168.2.10
Discovery received from 192.168.2.10
Discovery received from 192.168.2.10
Discovery received from 192.168.2.10
Discovery received from 192.168.2.10
DeviceService received request GetCapabilities
DeviceService received request GetDNS
DeviceService received request GetScopes
DeviceService received request GetNetworkInterfaces
DeviceService received request GetDeviceInformation
DeviceService received request GetServices
DeviceService received request GetCapabilities
web request received : /onvif/events_service
MediaService received request GetVideoSources
MediaService received request GetProfiles
MediaService received request GetProfiles
MediaService received request GetSnapshotUri
web request received : /web/snapshot.jpg
ffmpeg - starting
ffmpeg - finished
ffmpeg exec error: Error: Command failed: ffmpeg -fflags nobuffer -probesize 256 -rtsp_transport tcp -i rtsp://127.0.0.1:8554/h264 -vframes 1  -r 1 -s 640x360 -y /dev/shm/snapshot.jpg
/bin/sh: 1: ffmpeg: not found

    at ChildProcess.exithandler (child_process.js:308:12)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Socket.<anonymous> (internal/child_process.js:444:11)
    at Socket.emit (events.js:314:20)
    at Pipe.<anonymous> (net.js:675:12) {
  killed: false,
  code: 127,
  signal: null,
  cmd: 'ffmpeg -fflags nobuffer -probesize 256 -rtsp_transport tcp -i rtsp://127.0.0.1:8554/h264 -vframes 1  -r 1 -s 640x360 -y /dev/shm/snapshot.jpg'
}
Error opening snapshot : Error: ENOENT: no such file or directory, open '/dev/shm/snapshot.jpg'
    at Object.openSync (fs.js:462:3)
    at Object.readFileSync (fs.js:364:35)
    at MediaService.deliver_jpg (/home/pi/rpos/services/media_service.js:91:26)
    at /home/pi/rpos/services/media_service.js:71:39
    at ChildProcess.exithandler (child_process.js:315:5)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Socket.<anonymous> (internal/child_process.js:444:11)
    at Socket.emit (events.js:314:20)
    at Pipe.<anonymous> (net.js:675:12) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/dev/shm/snapshot.jpg'
}
MediaService received request GetProfile
MediaService received request GetProfile
MediaService received request GetStreamUri
MediaService received request GetStreamUri
MediaService received request GetVideoSourceConfiguration
^CCtrl-C...
pi@raspberrypi:~/rpos $