@brunowernimont
Let's connect together

Listen to Youtube video on your iPhone in background

June 24, 2021

Youtube Aucast

Introduction

Aucast play mp3 (aac and m4a) files on your iPhone and save your progress automatically like other podcast players.
However Aucast has a CLI tool that downloads youtube video and converts it to mp3 with the help of youtube-dl (macOS or Linux).
aucast_cli.

Aucast

Youtube-dl installation

First we need to install youtube-dl wich will download and convert youtube video to audio.
Note that despite the name youtube-dl, many other streaming services are supported.
To install it for Linux and macOS type:

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

To install it through Homebrew type:

brew install youtube-dl

There are others ways to install Homebrew, please refer to the readme to get more information.

Aucast-cli installation

aucast_cli is written in ruby, so be sure to install it first on your system.

gem install aucast

Download and transfer video

Convert and copy youtube video to mp3 in ~/downloads:

aucast copy https://www.youtube.com/watch\?v\=OaLxTz1Yw7M -d ~/Downloads

To send audio to Aucast be sure to enable the build-in webserver in the settings and get your iPhone address:

aucast upload https://www.youtube.com/watch\?v\=OaLxTz1Yw7M -a iphone-de-bruno-wernimont.local

enable wifi webserver

Save configuration

Run setup and follow the instructions. You’ll be asked to enter your phone bonjour address and/or path where you want to copy your files.

aucast setup

Conclusion

Now you can you will be able to play Youtube video on your iPhone either you have an internet connexion or not.

Resources