Sunday, September 20, 2020

Commands useful along with Youtube-dl

The following is to download a only a particular part of a video from YouTube 

ffmpeg -i $(youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=cmne_rokrs4) -ss 00:10:10 -to 00:12:52 -c:v copy -c:a copy happy.mp4

Or you can download all the video first and then cut some parts following the instructions here.

If you want to concatenate MP4 videos (you can prepare an script):

echo file input1.mp4 >  mylist.txt

echo file input2.mp4 >>  mylist.txt

ffmpeg -f concat -i mylist.txt -c copy output.mp4

To list all subs for a video:

youtube-dl --list-subs URL

To download all subs, but not the video:

youtube-dl --all-subs --skip-download URL

Or you can only download one subtitle

youtube-dl --write-sub --sub-lang en --skip-download URL

Or  for downloading the automatically generated subtitles

youtube-dl --write-auto-sub --skip-download URL

If you want to convert the subtitles do:

ffmpeg -i input.vtt output.srt

The following is to convert videos to a higher speed. For instance, if you want to multiply by 1.15, the command is:

ffmpeg -i input.mkv -filter_complex "[0:v]setpts=0.87*PTS[v];[0:a]atempo=1.15[a]" -map "[v]" -map "[a]" output.mkv

#The "setpts" corresponds to the inversed speed (in this case 100/1.25 = 0.8)

#while the "atempo" corresponds to the desired direct speed of the video.

#Those values are proportionally inversed.

#For a 25% higher speed output video the values

#would be "setpts=0.8*PTS" and "atempo=1.25"

100/1.25 = 0.8

References:

Friday, September 18, 2020

Setting a SSH server in a workstation



sudo apt install openssh-server

systemctl status sshd

sudo systemctl restart ssh

sudo ufw allow ssh

Enable the SSH server to start automatically during the boot.

sudo systemctl enable ssh

Connect from a remote client to your SSH server. First, obtain an IP address of your SSH server. 

ip a

If connecting over the internet you need your external IP address:

echo $(wget -qO - https://api.ipify.org)

Check if IP being used to login via SSH is correct. Re-check IP of device being SSH'd into with:

hostname -I

For Dynamic DNS the freedns.afraid.org works fine with ddclient in Linux.

If you don't want to use the default port 22 for SSH, you need to edit the sshd config file in:

/etc/ssh/sshd_config 

and change the value of "Port 22" in it for another number. You should run SSH on an unprivileged port number, i.e. from 1024 to 65535. You can check what local ports are in use currently to avoid a conflict with:

netstat -taulpn 

and also avoid IANA registered service numbers, check with:

cat /etc/services

Once you have made the appropriate change open a firewall port to correspond with the new SSH port where "xxxx" represent the new number that you chose:

sudo ufw allow xxxx/tcp

Then

sudo systemctl restart ssh

For a SSH connection through a specific port, where "xxxx" is the number chosen, do:

ssh -p xxxx username@{hostname or IP}



----

Sunday, September 06, 2020

Dual Boot Linux and Windows 10

 If Windows was installed to run in UEFI, the Linux OS must also be installed using the UEFI mode. This means that most likely you need to disable in the BIOS the legacy mode and allow secure boot.

Is the "Install Ubuntu alongside Windows 10" option missing?

Please note that in the following circumstances the Ubuntu 20.04 installation option "Install Ubuntu alongside Windows 10" may be missing, if your Windows 10 installation: is not correctly shutdown or is hibernating, has corrupted partition which needs repair, partition has not enough free disk space left for resizing, uses Dynamic Disk or the file system contains uncontrollable file fragmentation.

Another case is if you try to install Linux using legacy boot for your installation media; the installation would be possible but the dual boot won't work. 

-----

References: LinuxConfig.org