As part of my work advocating for special-needs orphans, I produce a (mostly) weekly podcast highlighting several of the children on our website. Whenever one of the featured children has a video posted on our site, I try to include an audio snippet of the child talking or, as in the case of one little boy, jamming on his toy guitar. I record, edit, and publish this podcast entirely on my iPad (except for those rare occasions when the episode is an interview), and it’s been a challenge to figure out how to extract the audio from these kids’ videos, which are almost always hosted on YouTube or Vimeo. There are various apps for the Mac that’ll download YouTube videos, but there’s nothing comparable for the iPad. I discovered that it’s possible to download these videos using the iCab browser if you change the user agent, but I could never get this to work consistently. There is a command-line program you can run called
youtube-dl that will download videos from YouTube (and other sites). The problem is, the iPad doesn’t ship with a Terminal app like the Mac does, so while I could do this on my Mac, I struggled to find a way to use this command on my iPad. During its beta period, the iOS/iPadOS app iSH Shell handled
youtube-dl fine, but following its public, non-beta release and the removal and subsequent reinstatement of
youtube-dl from GitHub, I couldn’t get iSH Shell to work properly. Maybe that’s because I’m a command-line novice, but whatever the cause was, this was no longer working for me. I was close to giving up, but one last search last weekend proved to be unexpectedly fruitful.
The answer lies with another command-line app for the iPad: a-Shell. I’d heard about this app before in the context of
youtube-dl—I think on an episode of the Adapt podcast—but I was never able to get it to work. Everything came together, though, when I found this YouTube video explaining how to install
ffmpeg in a-Shell. That was the missing piece in my previous attempts. I highly recommend watching the video, but I’m going to list the steps below. Once
ffmpeg has been installed,
youtube-dl works great in a-Shell on the iPad.
- Install a-Shell.
- Run the command
pip install youtube-dlto install the
ffmpegfrom this GitHub page. Follow that link, scroll down to the bottom section, and click the link for
ffmpeg. Or, you can click here to download it directly on your iPad. This will put it in your default downloads folder, which, in my case, is the
Downloadsfolder in iCloud Drive.
- In the Files app, navigate to the
On My iPadsection and select the
a-Shellfolder. In that folder, create a folder called
- Move the
ffmpeg.wasmfile from the
Downloadsfolder into the
binfolder. Now that it’s inside of a-Shell’s folder, the app can call on that program when it runs
- Start using
The simplest thing to do is to type the command
youtube-dl <link to YouTube video>. That will create a video file, in that
bin folder on your iPad, of the online video. Be warned, however, that by default
youtube-dl will generate a .mkv video file, which is unplayable on the iPad without installing another app or converting it. I recommend telling a-Shell to download the best .mp4 version of a video by inserting
-f '(mp4)' just before the video link. Give this one a try:
youtube-dl -f '(mp4)' https://youtu.be/tEvXVJHTQAk
For more information on what you can do with
youtube-dl, read this page. I didn’t realize there was so much I could do with
youtube-dl, and I’m glad to know that I can download only the audio, if that’s all I really want.
All in all, I’m quite happy with this setup. I no longer have to use my Mac to download videos reliably and then transfer those files to my iPad. Everything can now be done directly on iPad, which is fantastic.
(Update 2020-12-01): If the
a-Shell folder doesn’t appear in the On My iPad section of the Files app, try issuing the following commands back-to-back:
The first command makes sure that you’re in the main
a-Shell folder, and the second creates the desired
bin subfolder. Doing that should jog the Files app into showing all of this. If you still can’t see this in Files, reboot your iPad.
(Update 2020-12-02): If you saw this post via the link on MacStories and tried Federico’s shortcut, you might be unable to find the downloaded files in the Files app. According to a-Shell’s developer, files saved via the shortcut are saved to a
$SHORTCUTS folder, which is invisible in the Files app. In a-Shell, use the command
cd $SHORTCUTS to navigate to that folder, and then you can use UNIX commands like
mv to see, move, rename, etc. the files in that folder.