mailto: blog -at- heyrick -dot- eu

Only here for the Playmo? Click here...

Downloading a subtitled programme from YouTube to stream to an iPad

In this little tutorial, we shall look at how to download and assemble a YouTube video in such a way that it can be streamed to an iPad from a local server (NAS) with subtitles intact. Assuming that you are using (or have access to) a machine running Windows. For Mac/Linux, the principle is the same and you ought to be able to find similar software at each step.

Before we begin

Note first that YouTube's terms of service prohibits downloading of material; however given erratic broadband, frequent interruptions in streaming, and the ability to watch content when no active internet connection is available (in the car, for example), I frequently download from YouTube. While they could argue that this affects their ability to gain advertising revenue, it is in truth more likely to affect them if I couldn't download. You just can't watch a stream that frequently pauses and/or switches to super-silly low resolution. I rarely watch Crunchyroll for this reason, and I just don't visit video sites that make it difficult to download.

Now, the best video player that I have found for the iPad is VLC. It is on and off the official App Store like a yoyo, so the binary package can be downloaded directly from VideoLan, so you can 'install' it into iTunes and then sync with your iPad. I have not yet used this method as I got VLC when it was on the App Store.

There are other video playback programs (obviously), but none offer the comprehensive features of VLC whilst being free and I was surprised at how many didn't cope well with streaming animé MKVs.

While you can place a video file and a subtitle file with the same name into VLC's private storage using iTunes, this means using iTunes and it also means claiming the space on the iPad's internal storage. So a much simpler solution is to have it held on a local WiFi access point with streaming capabilities. The Orange Livebox can do this, numerous NAS boxes can do this. With a much larger internal harddisc, and/or the ability to accept media such as SD cards, it is easy to download a file drop it on the device and install it ready for playing.
However... The problem is twofold. Firstly, you cannot place subtitles alongside the file on the server. They won't be noticed. Secondly, it isn't hard, using mp4box to merge the subtitles into the video stream, however while VLC notices that subtitles exist, it does not show them (bug?). Therefore we must come up with an alternative method. One that isn't overly complicated and does not require the video to be transcoded (that takes forever).
As it happens, such a possibility exists.

Here are the preliminary steps:

1. Install VLC on iOS

As said above, you can find it here and install it via iTunes. If you prefer not to do this, there are other programs on the App Store - let me know if you find a good one that a, works and b, doesn't plaster advertising everywhere (including, in one case, on top of the video being watched!).

This article will continue assuming VLC is being used.

2. Install YouTubeDownloaderHD

It's a long title - it's an equally long URL: http://youtubedownloaderhd.com/. Available for Windows and Mac, download and install the appropriate version.
Note - you want to not accept the licence conditions for everything that isn't YouTubeDownloader itself, otherwise it will want to install rubbish into your system (toolbars and such). I think there are two or three things, just say no to them.

3. Install Google2Srt

Google2SRT does exactly what its name suggests. It will retrieve subtitles associated with YouTube videos (if in Closed Caption format, those burned into the video don't need to be downloaded separately) and saves them as a standard timed SRT file.

3. Download MKVToolNix

These tools deal with Matroska files and are available for all sorts of platforms. For Windows, grab the 7zip and unpack to \mkvtoolnix.

 

Now the setup is complete. The last step might have clued you in as to what we are going to do. You see, my animé is MKV with subtitles and it plays fine. So the method being used here is to create an MKV file with embedded SRT subtitles. Essentially containing everything in one tidy package. Some programs have difficulties with Matroska (MKV) which is a shame as it is better specified than MP4 and AVI.


Shigatsu wa Kimi no Uso

Here, now, are the steps to assemble a video. What we shall download as an example is part one of a TV series called "Shōkōjo Seira". This Japanese television series from 2009 is (currently) available on YouTube and it tells the story of A Little Princess (Francis Hodgson Burnett, originally 1888 and expanded into a proper story in 1905; the Japense series says 1884). Japanese girl, technicolour Indians (the girl has pet elephants!). As a person who would say another story by the same author (The Secret Garden) is one of my favourites, I thought it would be interesting to observe the Japanese take on the tale.


Shōkōjo Seira
Incidentally, the book now has public domain status, so you can read it yourself at http://en.wikisource.org/wiki/A_Little_Princess or you ought to be able to find it available as a free Kindle book on Amazon (same for The Secret Garden, which I would recommend).

1. Download the video

You can find the series from a quick Google search. I'll make it easier for you and point you at the uploader's list of videos. Start watching part one. If you like what you see, then we can continue!

The URL for the first episode is http://www.youtube.com/watch?v=CFWC3zUdtas. Copy that and paste it into the video URL part of YouTubeDownloaderHD. Specify the download path, then select the video quality that you want. I have chosen 480p as it is good quality without a massive file size. At an hour and a half, it is around half a gigabyte of data.
Click on Download and let it get on with things.

Because of changes in how YouTube delivers content, the downloader will first retrieve the video. It will then retrieve the audio. Afterwards, at the point where it looks as if the dlownloader has hung or crashed, it will mux the two together to make a complete video file. This process may take a while (as the first episode is a large file). Be patient.
Also note that you cannot fetch two episodes at once, or the "audio.mp4" file from one may overwrite the "audio.mp4" file from the other. Do them one at a time.

2. Download the subtitles

This is simple. Start Google2SRT and paste the URL into the top box and click the Read button. After a few moments, the desired subtitles will be listed and you can select the English ones and click on Go to download and save them.

3. Prepare the files

As we are going to use the command line (eeek!), we will need to change the filenames to be something that can be handled by the command line (no kanji!). Rename the files to something simpler, as shown here (no spaces, no punctuation, no Japanese), and keep it short (command line limitations):

4. Start the command line

Now for the scary part. The command line. People who grew up with the interactive GUI world tend to avoid the command line, often because "it is complicated". Well, yes, that is true. But sometimes you can do things in the command line that just aren't possible with the pretty pointy-clicky interface. I'll give an example - you have a folder full of ".jpeg" files but the stupid photo machine at the supermarket only understands ".jpg" files. Are you going to have to change the names one by one? In Windows, yes. In the command line, this will do it: rename *.jpeg *.jpg
So, Start then All Programs then Accessories then Command Prompt (us geeks put it directly on the start menu as that's a lot of faffing).

The first thing that you must do is to tell the command line where the MKV tools are. On my system, they are placed in G:\mkvtoolnix so I enter the following command Set PATH=%PATH%;G:\mkvtoolnix

To test this, type in mkvmerge and press Enter. If you see help text flash by, all is good. If you see a message that the command is not available, then you will need to check that you have entered the correct path.

Now for the magic. To convert the video file, we need a more complicated command line. We need this:
   mkvmerge -o Seira01.mkv --compression -1:none --language 2:jpn Seira01.mp4 --compression -1:none --language 0:eng Seira01.srt
We can just fit that in (with two characters to spare!). What is happening, I shall explain the command line step by step:

mkvmerge Call the program
-o Seria01.mkv Specify the output file
--compression -1:none Don't (re)compress anything
--language 2:jpn Set the audio (stream 2) as being Japanese
Seria01.mp4 The input video/audio file
--compression -1:none Don't compress the subtitles
--language 0:eng Set the subtitles as being English
Seira01.srt The subtitles file

Press Enter and it will process the file, giving you a running status. As we're only muxing into an MKV file and not transcoding, it is quite fast...

The end result in an MKV file which you can then play on an iPad with VLC. As everything is contained within the one file, it'll just work. It will also work with MXPlayer on an Android mobile phone, as well as various traditional players (RaspBMC on a Pi, VLC and SMPlayer on Windows (etc), and so on).


Shōkōjo Seira

Repeat the command line steps for each video to be processed. If you have downloaded all of the files, you can just change the command to mkvmerge.

Problems you may encounter

You may find subtitles are missing or incorrect (Google2SRT will either throw an error or report something other than English available). I think episodes 9 and 10-part1 have no subtitles, and part 2 of episode 10 has Italian subtitles. Don't worry, Google Is Your Friend. You can find subtitles elsewhere, such as http://www.d-addicts.com/forum/viewtopic_79279.htm.

You will notice that episode 10 is split into two parts. This, and the lack of subtitling, is a pain. But not a large pain. Simply open the first part in AVIDemux and then append the second part (just drag it on top). Save the file with video copy and audio copy in an MP4 (psp) container. No transcoding, so it'll be quick.
The subs from d-addicts (above) appear to match on two test points near the end of the file. I don't want to watch more as I do not want to watch the final episode before I watch the others!

Obviously, if you are downloading something in a language that you understand, you don't need the subs and so VLC (etc) can just play the original file!

This method can be used to mux subtitles into files from other sources, such as dorama.x264. Naniwa shōnen tanteidan is super-cute.

 

Okay, here's Playmo!

Day twenty

The twentieth day (already 20?!) brings:

 

 

Your comments:

Please note that while I check this page every so often, I am not able to control what users write; therefore I disclaim all liability for unpleasant and/or infringing and/or defamatory material. Undesired content will be removed as soon as it is noticed. By leaving a comment, you agree not to post material that is illegal or in bad taste, and you should be aware that the time and your IP address are both recorded, should it be necessary to find out who you are. Oh, and don't bother trying to inline HTML. I'm not that stupid! ☺ ADDING COMMENTS DOES NOT WORK IF READING TRANSLATED VERSIONS.
 
You can now follow comment additions with the comment RSS feed. This is distinct from the b.log RSS feed, so you can subscribe to one or both as you wish.

Furious 7, 12th March 2015, 12:16
This is My first visit on your site and i got impress after watching article of yours  
i have read this article completely and really you have clear in the above article that we cooperate <a href="http://fastandfurious7torrentdownload.com/">Fast And Furious 7 Torrent </a> 
<a href="http://ekpahelileelatorrentdownload.com/">Ek Paheli Leela Torrent </a>
Rick, 13th March 2015, 23:10
Wow. Somebody tried to spam my blog. Does that mean it's popular? 
You'll notice that you cannot embed URLs. This is by design, to stop crap like this. 
Who is Ek Paheli Leela anyway? Sounds like one of the Doctor's companions back in the '70s. ;-)

Add a comment (v0.11) [help?] . . . try the comment feed!
Your name
Your email (optional)
Validation Are you real? Please type 60341 backwards.
Your comment
French flagSpanish flagJapanese flag
Calendar

(Felicity? Marte? Find out!)

Last 5 entries

List all b.log entries

Return to the site index

Geekery
 
Alphabetical:

Search

Search Rick's b.log!

PS: Don't try to be clever.
It's a simple substring match.

Etc...

Last read at 14:44 on 2024/12/10.

QR code


Valid HTML 4.01 Transitional
Valid CSS
Valid RSS 2.0

 

© 2014 Rick Murray
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted.
RIPA notice: No consent is given for interception of page transmission.

 

Have you noticed the watermarks on pictures?
Next entry - 2014/12/21
Return to top of page