Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4l2multi_stream_mmal based rtsp fnc #2126

Closed
wants to merge 11 commits into from

Conversation

jasaw
Copy link
Collaborator

@jasaw jasaw commented Oct 5, 2019

This PR replaces gstreamer based RTSP video stream with v4l2multi_stream_mmal & v4l2rtspserver, which reduces latency and CPU load, but at the expense of restricting RTSP FNC to Pi Cameras only. If we want to support USB based cameras, we can add gstreamer back into FNC.

RTSP mode now supports most of the options in raspimjpeg.conf which makes the streameye.sh script a lot cleaner. This is the list of supported options:
"analoggain" "awb" "awbgains" "bitrate" "brightness" "colfx" "contrast" "denoise" "digitalgain" "drc" "ev" "exposure" "flicker" "framerate" "height" "hflip" "imxfx" "intra" "irefresh" "iso" "level" "metering" "profile" "roi" "rotation" "saturation" "sharpness" "shutter" "vflip" "vstab" "width" "mjpegbitrate" "mjpegframerate" "mjpegwidth" "mjpegheight"
These options are the same as raspivid/raspistill programs.

There are 3 supported audio config items in raspimjpeg.conf file: audio_bitrate, audio_channels, audio_format. Audio capture device can be specified in streameye.conf file with config item AUDIO_DEV. Example: AUDIO_DEV=hw:1,0

There is no authentication on RTSP yet, but it's easy to add.

Note that I have done minimal testing, and absolutely no testing on the audio support. I want to get this out for you guys to review and probably help with some testing.

@ccrisan Should we merge this into a new branch rather than dev?

@popoviciri Do you want to create a PR for the additional RTSP controls on the web front-end (seeing that you have already done most of it)?

@jasaw jasaw requested a review from ccrisan October 5, 2019 15:27
@ccrisan
Copy link
Collaborator

ccrisan commented Oct 5, 2019

@jasaw the work done here looks great, especially given that we say goodbye to many gstreamer-related packages and code now looks cleaner.

...but at the expense of restricting RTSP FNC to Pi Cameras only. If we want to support USB based cameras, we can add gstreamer back into FNC.

I certainly don't see this as a real problem, since (1) FNC traditionally worked only with RPi camera modules and (2) 99.99% of the FNC users probably use the CSI camera module.

Should we merge this into a new branch rather than dev?

I think we can safely merge this directly into our current dev. Reasons include (1) the fact that we already have some experimental code in dev and thus we don't expect a stable release anytime soon and (2) this PR, even if it were completely broken, probably wouldn't affect too many users at this time.

The changes look good overall, with a small remark: could we have the new packages added to thingOS rather than directly to motionEyeOS? I prefer adding new packages there because (1) we can resolve possible future conflicts when merging with BuildRoot slightly more upstreamish and (2) other users/projects can benefit of them.

@popoviciri
Copy link
Contributor

Hi @jasaw, I'll give this one a try, although to be able to use the mjpeg stream settings from the frontend requires tinkering with the streameye.sh as well. To avoid conflicts I could edit your streameye.sh and submit the PR to your branch. I wonder how that would work?
As a side note, getting rid of gstreamer, breaks the motion compilation due to missing ffmpeg lib dependencies, otherwise installed by gstreamer. So you must bring these two back to the configs:

BR2_PACKAGE_FFMPEG=y
BR2_PACKAGE_FFMPEG_SWSCALE=y

Thank you very much for this. Building now.
Cheers!

+ $(CXX) -o $@ $(CXXFLAGS) -I$(PREFIX)/include/h264bitstream -I$(PREFIX)/include/hevcbitstream -I$(PREFIX)/include/libyuv $^ $(LDFLAGS) -lh264bitstream -lhevcbitstream -lyuv -ljpeg
+
+v4l2fuse: src/v4l2fuse.c
+ $(CC) -o $@ $(CXXFLAGS) $^ $(LDFLAGS) -D_FILE_OFFSET_BITS=64 -lfuse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compilation fails at v4l2fuse.c with error: array type has incomplete element type. To fix, use C compiler for v4l2fuse:

$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) -D_FILE_OFFSET_BITS=64 -lfuse

@popoviciri
Copy link
Contributor

Hi @jasaw, been running your latest v4l2multi_stream_mmal app for couple of hours on a rpi zero w and 2B without issues. It just works. Only thing I have different is the GOP --intra or -g option which I have it set to 50, as you previously suggested. I'll send later tonight a PR with the trivial changes to motioneye and streameye.sh. Cheers.

@jasaw jasaw closed this Oct 6, 2019
@jasaw jasaw deleted the mmal_rtsp_fnc branch October 18, 2019 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants