mpromonet / v4l2rtspserver

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

Setting stream parameters #261

Open dbrb2 opened 2 years ago

dbrb2 commented 2 years ago

This isn't a bug, so much as a request for clarification:

I can specify frame rate and resolution for an H.264 video source (in this case a pi camera with the bcm2835-v4l2 driver) as follows: v4l2rtspserver -F $FPS -H $Y -W $X /dev/video0

I can also set some other stream parameters using v4l2-ctrl at the terminal - such as: v4l2-ctl -d /dev/video0 -c video_bitrate=4000000

On paper, I can also set frame rate at the terminal (when the device is not in use) - v4l2-ctl -d /dev/video0 -p 10

However, if I do that, and then subsequently start v4l2rtspserver without a "-F" parameter, the frame rate defaults to 25fps

Does v4l2rtspserver set frame rate and resolution to some default if not specified - overriding any preceding v4l2-ctl commands?

mpromonet commented 2 years ago

Hi,

You are right, default settings is 25fps, this could be better to not set fps by default. There is 2 possible ways either using '-f ' (no ioctl will be send and then current capture settings will be used), or using '-F0' (fps will not be set).

Best Regards, Michel

dbrb2 commented 2 years ago

Ah thanks. Setting just -f still seemed to override the configured frame rate with 25fps However, setting -F0 left it as set

Interestingly, whilst leaving out an explicit F defaulted to 25fps, not specifying W and H does not seem to result in these being overridden - they stay set to whatever their preconfigured valued were

Cheers!

`

!/bin/bash

DEVICE=/dev/video0 PORT=554 X=640 Y=480 FPS=5 BITRATE=4000000 MODE=0 #0=VBR, 1=CBR WB=1 POWERLINE=1

v4l2-ctl -d $DEVICE -c video_bitrate=$BITRATE v4l2-ctl -d $DEVICE -c video_bitrate_mode=$MODE v4l2-ctl -d $DEVICE -c white_balance_auto_preset=$WB v4l2-ctl -d $DEVICE -c power_line_frequency=$POWERLINE v4l2-ctl -p $FPS v4l2-ctl --set-fmt-video=width=$X,height=$Y,pixelformat=4

/usr/local/bin/v4l2rtspserver -F0 -P $PORT -u "" $DEVICE `