Collection of command line tools and commands.

A small living collection of some handy and usefull tools I use from time to time but can't memorize.

ffmpeg

# Compress a .mp4 file
#
# -crf range 0-51. Recommended 17–28
# https://trac.ffmpeg.org/wiki/Encode/H.264

ffmpeg -i <INPUT_FILE> -vcodec h264 -crf 34 <OUTPUT_FILE>

# Compress a .webm file
#
# -crf range 0-63. Recommended 15–35
# https://trac.ffmpeg.org/wiki/Encode/VP9

ffmpeg -i <INPUT_FILE> -c:v libvpx-vp9 -crf 48 -b:v 0 <OUTPUT_FILE>
# Convert audio/video file

ffmpeg -i <INPUT_FILE> <OUTPUT_FILE>
# Trim audio and video file
#
# Format time duration: [HH:]MM:SS[.m...]

ffmpeg -i <INPUT_FILE> -ss 00:00:00.000 -to 00:00:00.000 -c copy <OUTPUT_FILE>

openssl

# Encode file to base64
# https://ss64.com/osx/openssl.html

openssl base64 -in <INPUT_FILE> -out <OUTPUT_FILE>

youtube-dl

# Download and extract audio of youtube video
# https://github.com/ytdl-org/youtube-dl

youtube-dl -x --audio-format mp3 <URL>