18.03.2020

Ubuntu: Disable screenlock after resuming from hibernation

There are many tutorials out there, how to disable the screen locking.

The problem with these solutions is, that still after resuming from hibernation / standby the screenlock is triggered.

To disable this behaviour you can check this:
schroff@zerberus:~/$ gsettings get org.gnome.desktop.screensaver ubuntu-lock-on-suspend
true
and then do:

gsettings set org.gnome.desktop.screensaver ubuntu-lock-on-suspend false
If you want to do it via gui you have to install dconf-editor
apt install dconf-editor
Here you have to change the second last line "ubuntu-lock-on-suspend".

15.03.2020

Streaming a live-stream... [ffmpeg + vlc for m3u8]

After writing about how to stream a file to some smartphones or tablets, now the commands for streaming a live-stream to other devices.

And like before: VLC is needed.


But in addition to vlc you have to use ffmpeg:
A complete, cross-platform solution to record, convert and stream audio and video.

First thing you need is the url of the live-stream you want to re-stream. In my case is took the "Zweites Deutsches Fernsehen" (secondary channel of germany) and their url is
https://zdf-hls-01.akamaized.net/hls/live/2002460/de/high/master.m3u8
(In most of the tv channels it is something like "master.m3u8")
m3u is the acronym for MP3 URL and m3u8 uses UTF-8.

So the command for streaming is:
ffmpeg -i https://zdf-hls-01.akamaized.net/hls/live/2002460/de/high/master.m3u8 -c copy -f nut - | vlc - :sout=#transcode\{vcodec=h264,scale=Auto,scodec=none\}:http\{mux=ffmpeg\{mux=flv\},dst=:8080/test\} :no-sout-all :sout-keep
 which consists of

ffmpeg -i https://zdf-hls-01.akamaized.net/hls/live/2002460/de/high/master.m3u8 -c copy -f nut - 
which is piped into
 vlc - :sout=#transcode\{vcodec=h264,scale=Auto,scodec=none\}:http\{mux=ffmpeg\{mux=flv\},dst=:8080/test\} :no-sout-all :sout-keep
(this is the command i build up in the last posting.)

Have fun!

Streaming a video file with vlc to other devices (like smartphones, etc.)

If you want to look a video on a tablet or smartphone (or laptop) and the file is on a server in your network, you can do this very easily with vlc.
One big advantage: The video can be consumed by many devices - so the movie can be watched on e.g. 3 tablets...

What do you have to do?
Install vlc on your computer (i used a ubuntu laptop) and start vlc.
Next step is to open the menu: media -> stream... (or press Strg-S):

Then select the video on your disc with "+Add":
 After that click on "Stream" and this window will open:
 Click "Next" and then choose "HTTP" and press "Add"
 On the next window you have to enter the port and URL, where the devices have to connect to (in my example, the ip of my laptop was 192.168.178.39 - so the URL is 192.168.178.39:8080/test)
 Then you should select this setting and click on the wrench (="settings"):
 Here you have to select "Keep original audio track", otherwise audio will not work:

Last window before the streaming starts:
Copy the string to your clipboard
:sout=#transcode{vcodec=h264,scale=Auto,scodec=none}:http{mux=ffmpeg{mux=flv},dst=:8080/test} :no-sout-all :sout-keep
 After that install vlc on your device, start it and enter the URL:
 Press "Verstanden und weiter" ;-)
 and here we go:

If you want to skip the wizard, just open vlc with the string from your clipboard
(you have to escape the curled brackets!):

vlc test.mp4 :sout=#transcode\{vcodec=h264,scale=Auto,scodec=none\}:http\{mux=ffmpeg\{mux=flv\},dst=:8080/test\} :no-sout-all :sout-keep

14.03.2020

Squid: How to setup a proxy...


If you are limited on bandwidth and you want to setup several machines, using a caching proxy will speed up your installation process significantly.



What is a caching proxy:
https://en.wikipedia.org/wiki/Proxy_server#Improving_performance

But proxies have some issues, that you should be aware of:
https://en.wikipedia.org/wiki/Proxy_server#Content-control_software

If you are sure, to use a proxy, just enter these commands:

root@zerberus:~# apt install squid
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libdbi-perl libecap3 squid-common squid-langpack
Suggested packages:
  libmldbm-perl libnet-daemon-perl libsql-statement-perl squidclient squid-cgi
  squid-purge resolvconf smbclient winbindd
[....]

Unpacking squid (3.5.27-1ubuntu1.5) ...
Setting up libecap3:amd64 (1.0.1-3.2) ...
Setting up squid-langpack (20170901-1) ...
Setting up squid-common (3.5.27-1ubuntu1.5) ...
Setting up libdbi-perl (1.640-1) ...
Setting up squid (3.5.27-1ubuntu1.5) ...
[....]
To check the default configuration you can use this command:
(to suppress the documentation and comments)

root@zerberus:/etc/squid# cat squid.conf |grep -v \# |grep -v -e "^$"

acl SSL_ports port 443
acl CONNECT method CONNECT
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localhost
http_access deny all
http_port 3128
coredump_dir /var/spool/squid
refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern -i (/cgi-bin/|\?) 0    0%    0
refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880
refresh_pattern .        0    20%    4320

After the installation the squid process should be visible and listening to its default port 3128. Check this with
netstat -lntup
and you will find the following lines in the output:

tcp6       0      0 :::3128                 :::*                    LISTEN      25638/(squid-1)     
udp        0      0 0.0.0.0:45167           0.0.0.0:*                           25638/(squid-1)     
udp6       0      0 :::45347                :::*                                25638/(squid-1)     

To use this proxy just enter the proxy settings inside your system settings:


After that all of your connections are made over your proxy. You can check this via the file /var/log/squid/access.log and /var/log/squid/cache.log.