Welp, I've been using VLC to stream my webcam to my LAN so I can see when my Amazon packages arrive since my doorbell isn't that loud. At first I used motion since it was the only thing that somewhat worked, but it was horrid...people looked like they were just going across my screen only with the same leg up and just moving every second instead of actually walking. Then I did some tweaks with VLC and it was laggy but it worked way better than motion. After many hours I found that Theora and Ogg had the smoothest results.
Then, I wanted to use only the command line version since it would reduce memory usage by half...then some more hours to even get it working and then some more to get MJPG working then realizing all that time was pointless since now it's way faster without transcoding lol. I also found out that using MKV is (for me) faster than Ogg with far less dropped frames. For MKV you need the libmatroska-dev library.
sudo apt-get install libmatroska-dev
Anyways...for those who want to know how to set the GUI for decent webcam streaming on your LAN...see below.
2 (a) If you want to use MJPG instead of the default YUYV, fill in the third line [Video input chroma format] with MJPG, otherwise leave it blank or whatever other option you need, such as h264. Set the other info so that you can get all your settings done at once. Then click OK
7. To save on RAM usage, use the command line program, cvlc
cvlc -vvv <your device> <the v4l2 options> <the transcode info>
The -vvv device is in [MRL] just above [Edit Options]
cvlc -vvv v4l2:///dev/video0 --no-audio :v4l2-standard= :v4l2-dev=/dev/video0 :v4l2-vbidev= :v4l2-chroma=MJPG :v4l2-input=0 :v4l2-audio-input=-1 :v4l2-width=800 :v4l2-height=448 :v4l2-aspect-ratio= :v4l2-fps=16 :no-v4l2-controls-reset :v4l2-brightness=-1 :v4l2-brightness-auto=-1 :v4l2-contrast=-1 :v4l2-saturation=-1 :v4l2-hue=-1 :v4l2-hue-auto=-1 :v4l2-white-balance-temperature=-1 :v4l2-auto-white-balance=-1 :v4l2-red-balance=-1 :v4l2-blue-balance=-1 :v4l2-gamma=-1 :v4l2-autogain=-1 :v4l2-gain=-1 :v4l2-sharpness=-1 :v4l2-chroma-gain=-1 :v4l2-chroma-gain-auto=-1 :v4l2-power-line-frequency=0 :v4l2-backlight-compensation=-1 :v4l2-band-stop-filter=-1 :no-v4l2-hflip :no-v4l2-vflip :v4l2-rotate=-1 :v4l2-color-killer=-1 :v4l2-color-effect=-1 :v4l2-audio-volume=-1 :v4l2-audio-balance=-1 :no-v4l2-audio-mute :v4l2-audio-bass=-1 :v4l2-audio-treble=-1 :no-v4l2-audio-loudness :v4l2-set-ctrls= :live-caching=150 --sout '#transcode{vcodec=theo,vb=815,fps=16,scale=Auto,width=800,height=448,acodec=none,scodec=none}:http{mux=mkv,dst=:8080/}' --no-sout-all --sout-keep --quiet
And if you don't want or need to transcode (since I set the resolution and the fps and all the other options, I'm sending it as I want it...although the fps ends up as 250 [sometimes 1000, not sure what's going on there] instead of 16!)
cvlc -vvv v4l2:///dev/video0 --no-audio :v4l2-standard= :v4l2-dev=/dev/video0 :v4l2-vbidev= :v4l2-chroma=MJPG :v4l2-input=0 :v4l2-audio-input=-1 :v4l2-width=800 :v4l2-height=448 :v4l2-aspect-ratio= :v4l2-fps=16 :no-v4l2-controls-reset :v4l2-brightness=-1 :v4l2-brightness-auto=-1 :v4l2-contrast=-1 :v4l2-saturation=-1 :v4l2-hue=-1 :v4l2-hue-auto=-1 :v4l2-white-balance-temperature=-1 :v4l2-auto-white-balance=-1 :v4l2-red-balance=-1 :v4l2-blue-balance=-1 :v4l2-gamma=-1 :v4l2-autogain=-1 :v4l2-gain=-1 :v4l2-sharpness=-1 :v4l2-chroma-gain=-1 :v4l2-chroma-gain-auto=-1 :v4l2-power-line-frequency=0 :v4l2-backlight-compensation=-1 :v4l2-band-stop-filter=-1 :no-v4l2-hflip :no-v4l2-vflip :v4l2-rotate=-1 :v4l2-color-killer=-1 :v4l2-color-effect=-1 :v4l2-audio-volume=-1 :v4l2-audio-balance=-1 :no-v4l2-audio-mute :v4l2-audio-bass=-1 :v4l2-audio-treble=-1 :no-v4l2-audio-loudness :v4l2-set-ctrls= :live-caching=150 --sout '#standard{access=http,mux=mkv,dst=:8080/}' --quiet
Transcoding with MJPG is about 60% CPU usage, YUYV is about 35% CPU usage, and no transcoding is about 2% (evenings due to less light) to 7% (daytime due to brighter colors) CPU usage. I went with no transcoding since I'm running Linux on a mini PC with only 2 cores and 2 threads.
If you want to just use the GUI, skip the [Advanced options] part and just paste the v4l2 options, which you saved earlier, directly in the [Edit Options] box. You still need to select your [Video device name] tho. Then select the transcode profile you created or uncheck the [Activate Transcode] checkbox to skip transcoding, and then stream.
Hope this helps!
No comments:
Post a Comment