Showing posts with label [solved]. Show all posts
Showing posts with label [solved]. Show all posts

Sunday, September 18, 2022

[Solved] Streaming USB webcam via command command line with cvlc (VLC) with MJPG output

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.


1. Select your video device (duh)
2. Check the [Show more options] box and then fill in the Advanced options.
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
3. At the bottom in the [Edit Options] box, copy the whole line. That's your v4l2 options. You'll need that later so save it into a file otherwise you have to select your options EVERY TIME.

INFO:I use HTTP as my stream so your settings may differ if you stream with something else. And I'm only streaming at 800x448 resolution. Again, it works for my purpose. 

4. Click Stream -> Next, click the pull-down and select HTTP and click Add -> Next.
If you want to transcode, create a new profile. Select Ogg/Ogm

-As mentioned earlier, I switched to MKV-
Then click the [Video codec] tab -> check the Video checkbox and select Theora in the Codec pull-down. Adjust the Frame Rate to fit your needs. I use 16 since it's good enough and doesn't stutter. If you want audio then select that as well. For my purposes, I don't use audio to keep the stream fast. Then click Create, and then Next.

5. Copy the [Generated stream output string] to be used later for the command line option.

6. Click Stream to make sure it works.

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!

Wednesday, June 22, 2022

Stupid Galaxy/Android keyboard update got rid of "3 x 4 flick", here's how to get it back!

 Well, it might be an unpopular opinion but I like using the 3x4 flick input keyboard and after the latest Galaxy/Android update (I did mine on June 19, 2022 for my Galaxy S20). Well color me surprised when I couldn't type anything properly...WTF! I checked and double checked but couldn't find the "3x4 flick" option! It only had the stupid "3x4" option and you need to move your finger left to right to get the letter you want??...so freaking annoying. I like the tap, flick up, flick down, flick left, or flick right way of entering characters...been using it forever so I have it memorized. I don't want to learn another way.


Luckily after a bit of searching I found out how to get the "flick" part back.


Go to Settings > General Management > Galaxy Keyboard settings > Layout > Button and symbol layout
Select Alternative. Next go back to Galaxy Keyboard settings > Languages and types, and click (in my case) English (US) and select "3 x 4 flick"

All is well again! and Leave my keyboard setting alone!

Wednesday, May 4, 2022

[Solved] Linux: Fix for USB Webcam not being recognized and no /dev/video* for newer kernels or after kernel upgrade

 So my USB webcam was working fine until newer kernel versions. Then all of a sudden it wouldn't show up in guvcview or cheese. Tried a bunch of stuff but it was pointless. Then after much googling, I found two fixes, a temporary one and a permanent one. 
Because this only worked because I tried the temporary fix first, your results may vary. Therefore, try the temp fix to see if your unrecognizable webcam will actually work.

1. [Temporary, necessary after reboot. **Must have a second working webcam**] If you have another USB webcam that actually works, reboot with the working webcam plugged in. This will load uvcvideo during boot. Then plug in the one that doesn't get recognized and it should get recognized.

2. [Permanent] in /etc/modules-load.d create uvcvideo.conf and add the following line

    uvcvideo

*If Fix #1 works, then this will load uvcvideo during boot without needing to actually do Fix #1. Also make sure uvcvideo isn't added to a blacklist.

Friday, January 6, 2017

[solved] ? Windows takes forever / Windows takes a long time to do a windows update

GASP! an MS Windows post! blasphemy!

...but I use Windows at work and ran into the same problem and looked online for ways to solve it but couldn't find a solution...nothing seemed to work.
However! by combining suggestions I ran into something very interesting. Any time there's a Windows update that includes one for Internet Explorer, the update takes forever!
So instead of manually installing everything willy-nilly, just manually install the one for Internet Explorer and update the rest normally.

1. You can just wait until you get that dreaded notice and try your luck...or go to TN Security Advisories and click on Security Bulletin Summaries, the current year...yeah it's 2017 but no updates yet so click on 2016 (unless it's the future!) and then MS16-DEC.
2. Look for the one that says Internet Explorer under Affected Software and click that Bulletin ID, in this case MS16-144.
3. Find your version, download the Monthly Rollup or Security Only file and manually install the update. I chose the Monthly Rollup.
4. Reboot...twice just in case...cause Windows. Then in Task Manager -> Services, make sure BITS is running. Start it up if it's not running and go take a break for a few minutes.
5. Then, if you haven't gotten the "hey there's updates available" message in the tray, try running Windows Update. It should work a lot faster and hopefully get all the necessary updates.

Every now and then (usually three or four times a month) check that BITS is running (I changed mine to automatic...but for some reason, it changes back to manual so I change it to automatic again...and again..) then open up the Windows Update window to make sure it's checking for updates. You can see if it is by looking at the date...if it hasn't changed since the last update, you may have problems during the next update...but fret not, I haven't had any issues these past few months so it does seems to work.

Hope this helped. And let me know if this worked for you!

Cheers!

I may have unintentionally left something out...if you run into a roadblock let me know.
There are plenty of sites that tell you how to manually install updates so I didn't include those instructions here. google it.

Sunday, April 22, 2012

Bypassing (layer 7) firewalls with proxytunnel and ssh over https/ssl

The whole thing is written out all over the internet.
The site I used was HERE.
And it worked after I made a few adjustments and assuming you patched apache2 to accept a CONNECT thru SSL.

To patch apache...You will need to download the source and install this patch.

1. SU to root since it's easier than sudoing everything and it's less likely to run into issues.
cd /usr/src
2. get the dependencies and download the source.
apt-get build-dep apache2; apt-get source apache2
3. extract the source file.
dpkg-source -x apache2_2.2.16-6+squeeze7.dsc
4. apply the patch (e.g. patch -p0<patch)
5. cd into the apache directory if you're not in there already.
cd apache2-2.2.16
6. build the package and install.
dpkg-buildpackage -b && dpkg -i *.deb

Then you need to set up apache.
I have several virtual hosts set up on apache so I decided that I wanted to make this on a vhost also. What I did was make an entry to add a vhost just for ssh over ssl.

This is what my add "looks" like...ssh.server.org is an example, change it to yours. First I forced ssl usage

/etc/apache2/sites-available/vhost1-sslproxy80

<VirtualHost *:80>
ServerName ssh.server.org
ErrorLog /var/log/apache2/ssh-on-ssl-error.log
Loglevel warn
Redirect 301 / https://ssh.server.org
</VirtualHost>


` then to /etc/apache2/sites-available/vhost1-sslproxy443

<IfModule mod_proxy.c>
<VirtualHost *:443>
ServerAdmin http@localhost
ServerName ssh.server.org
DocumentRoot /var/www/ssh-ssl
ServerSignature off
CustomLog /var/log/apache2/ssh-on-ssl.log combined
Errorlog /var/log/apache2/ssh-on-ssl-error.log
<Directory /var/www/ssh-ssl>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
# THIS IS THE CONFIG NEEDED FOR OUR TUNNELLING
# Allow proxy connect (forward-proxy) on port 22 (SSH)
ProxyRequests on
AllowCONNECT 22
ProxyVia on
# Deny all proxying by default...

Order deny,allow
Deny from all
Allow from localhost
Allow from any.local.ip
Allow from any.local.ip.hostname.belonging.to.the.server
Allow from anyother.ip.hostname.you.want.to.allow.connect.from

# END OF TUNNELLING CONFIG
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
SSLEngine On
SSLproxyengine on
</VirtualHost>
</IfModule>


Then enable the 2 sites using a2ensite
a2ensite vhost1-sslproxy80 vhost1-sslproxy443

This next part is the part that made me lose a few hairs since it kept saying "405 method not allowed" and the fix is that you MUST put your vhost name in the /etc/hosts file!!!

Add a line to /etc/hosts
127.0.0.1 ssh.server.org
assuming that you have a public fqdn or dynamic hostname. (FYI I use no-ip.org)

Then check if apache is started.
If all is good then try her out.