How to Embed Subtitles to a Video in Linux

How to Embed Subtitles to a Video in Linux


1.) ffmpeg:

$ ffmpeg -i /path-to/videoFoo.avi -vf subtitles=/path-to/subtitleFoo.srt /path-to/output_videoFoo.avi


/or


2.) mencoder:

$ mencoder video.avi -oac copy -ovc lavc -sub /path-to/subtitleFoo.srt -subfont-text-scale 3 -o output_videoFoo.avi





Extract and Convert wmv Files to mp3 Files in Linux

Extract and Convert wmv Files to mp3 Files in Linux


Input at command line:

$ ffmpeg -i file.wmv -vn new.mp3


Notes:
- It actually works for many types of video files as well
- You can remove the -vn option and use it on different kinds of audio files to convert to mp3 files

Merge mp4 Files in Linux

Merge mp4 Files in Linux

One of the best ways to prevent losing quality from concatenating files is to transcode them to mpeg transport streams, using  H.264 video and AAC audio -

$ ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts new1.ts

$ ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts new2.ts

then

$ ffmpeg -i "concat:new1.ts|new2.ts" -c copy -bsf:a aac_adtstoasc output.mp4


Notes:
- In this example I use only 2 mp4 files converted to streams and then concatenating them, but you can
put as much as you like that your system can handle

How to Install Linux into a USB Flash Drive

How to Install Linux into a USB Flash Drive:


My preferred way is to disk dump the linux iso contents to the drive by command line, but there are other automated ways to do it and with GUI, such as Unetbootin, Linux Live USB or if your using windows to make the linux live usb drive, I recommend Rufus or Win32DiskImager for (32 bit windows only) For those you can just start the program and follow the instructions, its quite easy, or you can install and use cygwin where you can use GNU/Linux tools like dd in windows.

To find out which device your flash drive is, you can use many ways I'll just mention 2 here, either use fdisk or lsblk at command line:

# fdisk -l
/or
$ lsblk

After determining which is your device

Issue the command, with a pseudo foo path to the file.iso, assuming the flash drive is in /dev/sdb for example

# dd if=/path-to/file.iso of=/dev/sdb bs=4M; sync  
/or

# dd if=/path-to/file.iso of=/dev/sdb bs=4M status=progress oflag=nocache,sync && sync

To make sure the process completes successfully, unmount the flash drive, before unplugging:

# umount /dev/sdb

How to Download a Remote Directory Recursively with wget

How to Download a Remote Directory Recursively with wget

How to Download Folders and Files Recursively within a Remote Directory with wget, Issue command:

$ wget -e robots=off --cut-dirs=3 --reject="index.html*" --no-parent --recursive --relative --level=1 --no-directories "https://url-here/path-to-folder"



Download Flash Videos from Video Streaming Sites like youtube with Linux Command Line Apps

Download Flash Videos from Video Streaming Sites like youtube with Linux Command Line Apps


1.) with youtube-dl:

$ youtube-dl -cit "youtube.com/url-here" 

- optional to download an entire playlist or channel, go to the desired playlist list or channel, and grab the url then paste in terminal:

$ youtube-dl -cit "youtube.com/playlist_url-here"

- optional to download a custom list of video files, create a plain text/txt file and place all the YouTube links that you wish to download there, for example yt_foo_list.txt

$ youtube-dl -a yt_foo_list.txt

- optional to download the sound/music of the video to mp3 only:

$ youtube-dl -cit --extract-audio --audio-format mp3 "youtube.com/url-here"

- optional to download a video in certain file type/resoluton format, use option "–list-formats" with the command

$ youtube-dl –list-formats "youtube.com/url-here" 

- it will show you a list of formats with a corresponding video/resolution format code, that you can download in, choose from them, then to download a preferred file format from the list, use the option "-f", if flv was in the list and you want to save the file in that format, you then issue command

$ youtube-dl -f 34 "youtube.com/url-here"

- where 34 is the video/resolution format code of flv, it will say in the available video formats list or the resolutions available of the same format, code will be mentioned at the left most side

- optional to download video in all available formats, issue command

 $ youtube-dl –all-formats "youtube.com/url-here" 


2.) with get-flash-videos:

$ get-flash-videos "youtube.com/url-here"


3.) with cclive:

$ cclive "youtube.com/url-here"


4.) with movgrab:

$ movgrab "youtube.com/url-here"

5.) with you-get

$ you-get "youtube.com/url-here"

- Display the information of a video without downloading:

$ you-get "youtube.com/url-here"

- Download multiple videos:

$ you-get "youtube.com/url-here/A" "youtube.com/url-here/B"

-  Force Re-download vidoes (This will overwrite any existing video or temporary file):
 
$ you-get -f "youtube.com/url-here/"

- Set the output directory for downloaded files:

$ you-get -o ~/Downloads you-get -f "youtube.com/url-here/"

- Use a specific HTTP Proxy for Downloading
(use this -y proxy.uku.im:8888 as option and proxy for downloading from youku.com):

$ you-get -x 127.0.0.1:8087 "youtube.com/url-here/"

- Disable any proxy use  --no-proxy:

$ you-get --no-proxy "youtube.com/url-here/"

- Watch a video in your own video players of choice, like vlc and mplayer, to avoid uneccessary Ads.

$ you-get -p vlc "youtube.com/url-here/"

/or

$ you-get -p mplayer "youtube.com/url-here/"


Notes:
- To use any of the mentioned apps, they must be installed first
- youtube-dl, get-flash-videos, cclive, movgrab and you-get work in other sites as well not just youtube, for instance youtube-dl actually supports video download from several other sites like Dailymotion, Google Video, Photobucket, Facebook, Yahoo, Metacafe, Depositfiles and few more similar sites
- To upgrade youtube-dl do: $ youtube-dl -U
- youtube-dl can download from chinese websites like youku.com, tudou.com but if it doesnt work try to upgrade it first, if it doesn't work, you can use the you-get console app instead which supports alot of websites including chinese websites and even including japanese websites like niconico

Installing Binaries from Archlinux Packages into Slackware

Installing Binaries from Archlinux Packages into Slackware

*USE AT YOUR OWN RISK

- Sometimes you just want to use a quick and lazy binary in Slackware for whatever reason, Arch Linux uses the same vanilla apps just like slackware and uses the same format of a tarball compressed in xz, best of all they have updated packages, just make sure you have the dependencies or install the necessary dependencies already.

- To use a package from Archlinux Packages, search and choose the package/s, then download

- pkgtool in Slackware can install this package by the typical command installpkg, but it will say some error if you install it as is, even if the package is vanilla stock and with the same tarball and compression, to workaround this, change the file extension of the package, for example: foo_pkg.tar.xz to foo_pkg.txz

- Install with installpkg command:

$ sudo installpkg foo_pkg.txz

- And it should install, I've done this a bunch of times, especially when I can't find other quick install solutions from other repos for binaries or various slackbuild scripts are problematic and building from source is problematic, this is the fastest lazy hack to install packages, removing the package is the same as using the removepkg command from pkgtool.


- That's all.