mpromonet / v4l2rtspserver

RTSP Server for V4L2 device capture supporting HEVC/H264/JPEG/VP8/VP9
The Unlicense
1.82k stars 423 forks source link

Unable to capture stdout when running in /etc/init.d #258

Closed tachang closed 2 years ago

tachang commented 2 years ago

Describe the bug

When I run the following command the output is as expected. Stdout is sent to the file and stderr is captured.

/usr/bin/v4l2rtspserver $AUTH_PARAMS -A 48000 -C 1 -a S16_LE -l 1 /dev/video3,hw:0,1 /dev/video5 1> /var/log/v4l2rtspserver-stdout.log 2> /var/log/v4l2rtspserver-stderr.log &

However when the same command is run in the etc/init.d system on startup I only get for stdout this:

# cat v4l2rtspserver-stdout.log 
log level:500
# 

I don't see any of the [NOTICE] log messages. Anyone have any ideas why this is? I do roughly the same thing for other processes and it seems to work. Is there something special about the logging in this project that causes this to happen?

mpromonet commented 2 years ago

Hi,

Increasing the log level may help you ? Maybe some sound access without login session ?

Best Regards, Michel.

tachang commented 2 years ago

Odd. I think log level is fine. It seems like when I background the process using the ampersand & it fails to log to stdout.

tachang commented 2 years ago

I also get this behavior when I pipe it to tee.

# /usr/bin/v4l2rtspserver -P 8555 /dev/video3 /dev/video5 | tee
log level:500
VIDIOC_REQBUFS: Inappropriate ioctl for device
VIDIOC_STREAMOFF: Inappropriate ioctl for device
VIDIOC_REQBUFS: Inappropriate ioctl for device
VIDIOC_REQBUFS: Inappropriate ioctl for device
VIDIOC_STREAMOFF: Inappropriate ioctl for device
VIDIOC_REQBUFS: Inappropriate ioctl for device
tachang commented 2 years ago

I wonder if log4cpp is missing the ImmediateFlush parameter so I am seeing it all getting buffered.

mpromonet commented 2 years ago

Hi,

To unbuferred stdout you may look to https://unix.stackexchange.com/questions/25372/turn-off-buffering-in-pipe

Best Regards, Michel.