Skip to content

Instantly share code, notes, and snippets.

@ArneAnka
Last active May 25, 2020 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArneAnka/29edc60a5f286404de40bdf352a3eaf3 to your computer and use it in GitHub Desktop.
Save ArneAnka/29edc60a5f286404de40bdf352a3eaf3 to your computer and use it in GitHub Desktop.
1. youtube-dl -a lista.txt // Download all lectures with youtube-dl from file `lista.txt`
2. for f in *.mp4; do ffmpeg -i "$f" -vn "$(basename "$f" .mp4).mp3"; done // convert all mp4 to mp3
3. for f in *.mp3; do ffmpeg -i "$f" -af "highpass=f=200, lowpass=f=3000" "$(basename "$f" .mp3)_noice.mp3"; done
4. for f in *_noice.mp3; do ffmpeg -i "$f" -af silenceremove=1:0:-50dB "$(basename "$f" .mp3)_silence.mp3"; done
5. ffmpeg-normalize *.mp3 -c:a libmp3lame -b:a 192k -ext mp3 (https://superuser.com/a/323127/643639, https://stackoverflow.com/a/58997035/4892914)
6. ????
7. PROFIT
(2. ffmpeg -i input.mp4 -f mp3 -ab 192000 -vn output.mp3)
(3. ffmpeg -i output.mp3 -af "highpass=f=200, lowpass=f=3000" output_clean.mp3) // reduce noice (https://superuser.com/questions/733061/reduce-background-noise-and-optimize-the-speech-from-an-audio-clip-using-ffmpeg)
(4. ffmpeg -i output_clean.mp3 -af silenceremove=1:0:-50dB output_stripped.mp3) // remove silent bits from the mp3
@ArneAnka
Copy link
Author

ArneAnka commented May 6, 2020

final??

for f in *.mp4; do ffmpeg -i "$f" -af "highpass=f=200, lowpass=f=3000, silenceremove=1:0:-50dB" \
-vn "$(basename "$f" .mp4).mp3"; done && ffmpeg-normalize *.mp3 -c:a libmp3lame -b:a 192k -ext mp3

@ArneAnka
Copy link
Author

ArneAnka commented May 7, 2020

Final version!

for f in *.mp4; do ffmpeg -i "$f" \
-af "silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-40dB,highpass=f=200,lowpass=f=3000,loudnorm" \
-codec:a libmp3lame -q:a 5 -vn "$(basename "$f" .mp4).mp3"; done

For reference I found this reddit thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment