Skip to content

Instantly share code, notes, and snippets.

@toolness
Last active August 29, 2015 14:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toolness/3b5f9c48aa0d98bf4107 to your computer and use it in GitHub Desktop.
Save toolness/3b5f9c48aa0d98bf4107 to your computer and use it in GitHub Desktop.
A Dockerfile that makes it easy to convert youtube videos to mp3's
FROM ubuntu:14.04
MAINTAINER Atul Varma
RUN printf '\ndeb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse' >> /etc/apt/sources.list
RUN printf '\ndeb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse' >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y libav-tools libavcodec-extra-54 python python-pip
RUN pip install --upgrade youtube_dl
@toolness
Copy link
Author

toolness commented Aug 1, 2014

I prefer listening to conference talks and such as podcasts while walking or running, but was having a hard time finding tools/services that made this easy for me, so I decided to use it as an opportunity to learn Docker.

To use it, just make a new directory, cd into it, paste the above code into a file called Dockerfile and run this:

docker build -t my_youtuber .
docker run -t -i my_youtuber /bin/bash

At this point you'll be in your new docker container and you can run the following to create an mp3 out of a youtube video:

youtube-dl --extract-audio --audio-format mp3 --prefer-avconv \
'http://youtu.be/LlO2_GecWo8?list=PL37ZVnwpeshFXOP2lqCUykYPXYNsK_fgN'

Next step is to actually use this Dockerfile as the basis for a web service that converts youtube videos to mp3's.

@toolness
Copy link
Author

This dockerfile has been superseded by https://github.com/toolness/youtube-to-mp3.

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