Post# 1572789630

3-Nov-2019 8:00 pm


Here's how to separate music from videos and keep only the vocals :

First you need a Linux machine. Won't work on windows.

Download and install youtube-dl and ffmpeg using your package manager.

Next download and install this application
https://github.com/deezer/spleeter

or this one
https://github.com/sigsep/open-unmix-pytorch

I used the first one.

Then use youtube-dl to download youtube videos.
Use "spleeter" that you downloaded above, to split the musical instruments off the audio. It creates two files, called vocals.wav and instrumental.wav.
Replace the audio in the video with vocals.wav using ffmpeg.

You have a music video without the music.

_____

Here's the bash script I use to perform all these.

#!/bin/bash
if (( $# < 2))
then echo Usage: 'yt.nomusic ' exit -1
fi
name=$2
if ! -f $name.mp4
then youtube-dl "$1" -f 18 --no-mtime -o $name.mp4
fi
if ! -f $name/vocals.wav
then bash -c " source ~/.bashrc conda activate spleeter-cpu spleeter separate -i $name.mp4 -p spleeter:2stems -o ./ "
fi
if ! -f $name-nomusic.mp4
then ffmpeg -i $name.mp4 -i $name/vocals.wav -c:v copy -map 0:v:0 -map 1:a:0 -shortest $name-nomusic.mp4
fi

    Comments:
  • https://www.facebook.com/habib.dhaka/posts/10156783729558176
  • Next post will be on a bunch of videos.

3-Nov-2019 8:00 pm

Published
3-Nov-2019