How to rip and save audio from YouTube videos with your iPhone

By

rip youtube audio
This screen represents YouTube, and the telephone represents audio. Or something.
Photo: Charlie Sorrel/Cult of Mac

YouTube isn’t just for video. Lots of folks use it to post audio files, only they gum up the songs with slideshows so they can upload them to the video-publishing service. There are all kinds of apps that let you convert a YouTube video back into an MP3, but today we’re going to see how to convert a video to an MP3 right in Safari, using Apple’a own Workflow/Shortcuts app.

A little while back, we saw how to download YouTube videos for offline viewing. We used Workflow, the Apple app that lets you automate all kinds of neat stuff, and which is about to be replaced by the equally useful Siri Shortcuts app.

Today, we’re going to modify that workflow to convert the video streams to MP3 or M4A files, and save them to iCloud Drive. You could also choose to save the files to Dropbox or another storage service.

Pro tip: If you use the podcasting app Castro, you can then drag and drop these MP3 files into Castro’s own iCloud folder, and listen to them in that app. If you want to add the files to your Apple Music library, you’ll still need a Mac or PC with iTunes to do it.

How to convert any YouTube video to an MP3

If you’re feeling super-lazy, just grab my Download YouTube MP3 workflow from the Workflow Directory. It’s based on an existing workflow from Reddit’s Workflow subreddit. If you prefer to download that, and follow along with this tutorial, then grab the first workflow in this thread.

While Danialenotdan has also provided a nice audio-only version, that doesn’t work, so we’re going to tweak it ourselves. So, visit the site on your iPad or iPhone, and download the workflow, which will let you add it to your Workflow app.

As always when downloading any app, script or executable code from the internet, double-check you’re happy that it is safe before use. Shared workflows can be previewed in the browser before downloading, so make sure you do that.

If you already are following along with our video download tutorial, you can just duplicate the workflow you made, and go from there.

Edit the workflow

To use your new workflow, you just tap the share arrow in Safari whenever you’re viewing a video you want to convert. Then tap the Workflow icon, and choose your Download YouTube MP3 action from the list. Then wait while it runs. The workflow works great on most YouTube videos, but sometimes it just fails. This has something to do with the YouTube end of things, and I have’t yet worked out why.

This workflow will download the YouTube video, convert the video to MP3/M4A audio, then give the file a name (taken from the title of the video) and save it to iCloud.

Change the video to a lower resolution

Because we’re discarding the video section, we will download the 360p resolution instead of the 720p. This will be faster. To do this, scroll down your workflow until you see this list:

Danialenotdan's workflow lets you choose different defaults for video quality.
Danialenotdan’s workflow lets you choose different defaults for video quality.
Photo: Cult of Mac

Then, just drag the line containing number 18 up to the top, replacing 22. This sets the priority order for the download when it picks a video format and size. Danialenotdan explains:

If you’d like to change the format, rearrange the items in the List action in the workflow – the first number is the quality it defaults to:

22: mp4, 720p 18: mp4, 360p 34: flv, 360p 35: flv, 480p

Danialenotdan’s workflow doesn’t rename or save the file, so I added both steps. At the end of the workflow, delete the Quick Look action, and then drag in three new actions:

  • Set Name
  • Encode Media
  • Save File

In that order. Then, configure these actions as follows:

Set Name

This action grabs the video title from the original YouTube page.
This action grabs the video title from the original YouTube page.
Photo: Cult of Mac

Tap in the Name field, then tap on the Workflow Input token in the row above the keyboard. In this case, the Workflow Input is the YouTube page. We will extract the video title from this.

Tap the WorkFlow Input token you just inserted, then use the dropdown menus to set Workflow Input to as Article, and Get field to Title.

Encode Media

This takes the video file and converts it to an audio file. You can choose the format, and other options, depending on whether you pick MP3 or M4A. YouTube videos have their audio in M4A, so this is a good option. If you prefer MP3, it may take a little longer.

Save File

Here, we choose where to save the resulting audio file. My workflow uses iCloud Drive. The Workflow app is only allowed to write to its own folder, so that’s the one I pick. You can also have the action ask for a destination every time you run it.

The important part here is to tap the Destination Path field, then tap the Set Name token in the row above the keyboard. This is the token (or variable) we created earlier. It will get inserted after the word /Workflow/ . Then, tap this token again, and choose from the following options:

This takes the video title and uses it as a file name for your MP3 file.
This takes the video title and uses it as a file name for your MP3 file.
Photo: Cult of Mac

Now, tap Done. Every time you want to strip the audio from a YouTube video, just run this from the Workflow extension in Safari’s Share Sheet. The workflow will crank through its steps and place the resulting audio file in your destination of choice. If you don’t want to configure it all yourself, just grab my version from the Workflow Directory. But remember, check through it before you install it, just to make sure it’s not going to do anything weird to your machine.