How to Use ffmpeg to Help You Work with Openshot

Extracting Audio of a Video to MP3 File

ffmpeg -i input.ext -codec:a libmp3lame -qscale:a 2 output.mp3

Cropping Media File Duration

ffmpeg -ss 00:02:20.0 -i input.ext -c copy -t 00:00:31.0 output.ext

Removing Audio Stream from a Video File

ffmpeg -i input.ext -c copy -an output.ext

Reducing Final Video File Size

ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4

Merging Video Chunks from Ant Video Downloader

ffmpeg -f concat -safe 0 -i demuxer.txt -c copy -bsf:a aac_adtstoasc output.mp4

Pacman Fix Shell Script for TeX Live

#!/bin/sh

cd /etc/texmf

for a in `find . -name "*.pacnew"`; do

    sudo mv $(echo ${a/.pacnew/}) $(echo ${a/.pacnew/}).mybackup;

    sudo mv $a $(echo ${a/.pacnew/});

done

sudo fmtutil-sys --all

Creating Linux Distro USB Live Media under Linux

Here is what you need:

  1. an ISO file of the Linux distribution of your choice,
  2. an empty flash drive whose size is larger than the ISO file,
  3. a working Linux computer (it doesn't have to be of the same distro or even architecture as the one in the Live ISO) and...
  4. a little bit of common sense.

Here is how you'd do it.

  1. Plug your flash drive in to your Linux computer.
  2. If your flash drive is automatically mounted, unmount it.
    1. Check the list of drives connected to your system.
      $ lsblk
    2. Unmount the partition.
      # umount /dev/sdd1
  3. Go to the folder where your ISO is located (so you don't need to type the full path to it later).
    $ cd /path/to/the/iso/file/of/the/distribution/you/want/to/put/in/the/flash/drive/
  4. Run "disk dump".
    # dd bs=4M if=manjaro-xfce-16.06.1-x86_64.iso of=/dev/sdd status=progress && sync
    1. Please note that you're dd-ing to the disk, not the partition. Therefore, dd will take all your disk size no matter how much the difference it has with the ISO file size.
    2. The parameter bs=4M is to make sure that the dumping process will run fast.
    3. The parameter status=progress is to report the dumping progress from start to finish.
    4. Lastly, sync is to clarify that... I don't know. People at Arch Linux use it so you need to follow them too. If you're curious, you can always do man sync.

Happy dd-ing!

P.S.: Run wipefs --all /dev/sdd to your USB live media to get rid of the live OS and restore the full capacity of the disk.

How to Download Anything with Wget

Here are useful wget parameters I've discovered within around six years of using wget as my one-and-only download helper (except for YouTube vids).

Resuming an interrupted download (or simply worry-free downloading)

$ wget -c http://www.downloadedlink.com/a-folder/a-pdf-file.pdf

Turning off restrictions imposed by robots.txt

$ wget -e robots=off --wait 1 http://www.downloadedlink.com/a-folder/an-iso-file.iso

Downloading a whole folder recursively while leaving the unnecesary parent directories behind

$ wget -np -cr http://www.downloadedlink.com/a-folder/

Downloading nothing but files of a particular extension

$ wget --accept=*.ext http://www.downloadedlink.com/a-folder/

Downloading everything but files of a particular extension

$ wget --reject=*.ext http://www.downloadedlink.com/a-folder/

Keeping the downloaded files' names intact

This is especially important for downloading files whose names are typed in Russian/Asian writing systems (Cyrillic alphabet, Japanese kana, Arabic abjad, Hebrew alephbet, Hindi devanagari, etc.).

$ wget --restrict-file-names=nocontrol http://www.downloadedlink.com/a-folder/4%20l0ng%20fu9ly%20cryp7ic%20fil3%20n4me.mkv

Saving a downloaded file with a different name

This is especially important when you're downloading a file from a website that applies some kind of URL masking to their downloadable files (like sourceforge.net) but then suddenly the download gets interrupted out of pure bad luck.

$ wget -O desired-file-name.3gp -c http://www.downloadedlink.com/a-folder/a-file/download/

Happy leeching!

P.S.: Use your imagination.

CentOS 7: Removing Old, Corrupted Kernels

Before removing anything, first make sure that yum-utils is already installed in your system.

[user@localhost ~]$ rpm -q yum-utils
yum-utils-1.1.31-34.el7.noarch

If you don't have it yet, install it.

[user@localhost ~]$ sudo yum install yum-utils

Check what versions of kernels are currently installed in your system.

[user@localhost ~]$ rpm -q kernel
kernel-3.10.0-123.el7.x86_64
kernel-3.10.0-229.1.2.el7.x86_64
kernel-3.10.0-229.7.2.el7.x86_64
kernel-3.10.0-327.18.2.el7.x86_64

Removing Old Kernels

Run this for removing old kernels and leaving only a few of them (2 in this example).

[user@localhost ~]$ sudo package-cleanup --oldkernels --count=2

Removing a Particularly Troublesome (or Simply Corrupted) Kernel

This is blatantly the same as how you uninstall a specific rpm package in CentOS 7.
(*Below is just an example in my case; yours might be different.)

[user@localhost ~]$ sudo rpm -e kernel-3.10.0-327.4.4.el7.x86_64

Happy removing!

Diposting oleh ideal1st pada 15.06.2016 tepat jam 15:38