Saturday, January 16, 2021

How to install youtube-dl and cmus for Android App Termux and play music

# Download youtube-dl (Python Binary executable)
pkg install wget
cd ~
wget https://github.com/ytdl-org/youtube-dl/releases/download/2021.03.25/youtube-dl

chmod +x youtube-dl

Note: This python binary executable can be used cross platform x86, x64, arm or arm64, Linux or Mac.

# move to usr/bin
mv ~/youtube-dl /data/data/com.termux/files/usr/bin/

# Install required packages
pkg install python
pkg install openssl
pkg install ffmpeg

# Update to latest version
youtube-dl -U

# Setup Android local storage
termux-setup-storage

# Download Youtube as m4a format(add --no-continue to overwrite)
cd ~/storage/music
youtube-dl -i -f m4a https://youtu.be/e0npW4WoGmc

# Convert from mp4 to m4a using ffmpeg (-y is to overwrite)
ffmpeg -y -i 'downloaded video.mp4' -vn -c:a copy 'downloaded video convert to audio.m4a'

# Convert from m4a to mp3 using ffmpeg
ffmpeg -i input.m4a -c:v copy -c:a libmp3lame -q:a 4 output.mp3

# scale based on input size e.g. lets say reduce the width/height to half
ffmpeg -i input.avi -vf scale="iw/2:ih/2" output.avi

# Install cmus terminal player
pkg install cmus
cmus
# Press 5 to select music to play



No comments: