How to embed subtitles using VLC - Tutorial


Updated: March 1, 2017

The topic of hardcoding subtitles into video clips is not a new one. We have discussed this in a tutorial several years ago, using Linux only tools. Today, we will revisit this concept, with the focus on the highly versatile and powerful media player, VideoLAN (VLC).

Indeed, if you are not in the mood to use multiple tools to accomplish a few simple video editing tasks, nor dabble in strange, unknown operating systems, VLC can do the job for you, in a simple and elegant manner. Now, this guide partially demonstrates on Linux, but the steps are 100% identical and consistent for Windows, too. Please, join me.

Teaser

Embed subtitles

The first task is to create or find a video clip, and then, respectively, organize your subtitles. Let's assume you have a subtitle file. It will most likely be in the SUB or SRT format. Both these are just text files really, and you can always open and inspect the contents in a text editor. Now, we want to hardcode the text as an overlay to your video clip, so you can always watch the subtitles, even on devices that do not support fancy container formats capable of displaying subtitles separately.

Open VLC > Media > Stream. This will open the dialog box where you can choose one or more files for transcoding. You do not need to check the box that reads 'Use a subtitle file' at this point. We will sort this later on. Click Stream at the bottom. This will launch a transcoding wizard. The first step is to select source, but you've already done that.

Open stream

Select file

Source

Next, choose the destination (output) file. You may want to give it a suffix that matches the output format you're seeking. This could be AVI or MP4 or alike. Do remember that some format do not support subtitles.

Destination

Transcoding options

This is where it gets a little bit complicated. You need to choose the right profile for transcoding, and this means encapsulation format, video and audio codecs, and the subtitles overlay. Some codecs may not be available on your system.

Transcoding profiles

Transcoding

Choose the 'right' profile. Then, you have three buttons on the right side. Edit, delete and create new profile. Do remember that deleting a profile is permanent. So are any changes you add to an existing profile. Therefore, do not randomly edit settings until you're 100% sure you know what you're doing.

The best thing is to create a new profile and play with it until you get it right. You will need to choose four options - the encapsulation format, largely dictated by its ability to include subtitles, the right video and audio codecs, and the subtitles overlay.

Encapsulation

Video codec

Audio codec

On the last page in the profile edition - check both the box that reads Subtitles and the one that reads Overlay subtitles on the video. You do not need to worry about the codec, we will sort that out later.

Subtitle page

In some cases, some of the options may not be available - like for instance the Subtitles codec if you choose WebM as your container. Either way, you should test what works for you, see that the rendered product is what you are looking for, and you are happy there are no weird artifacts. Do remember the availability of codecs on your system will also dictate how things are done.

WebM video page

WebM audio page

WebM subtitles page

Review options & tweak subtitles

Now, the next step in the wizard will let you review the selected options. You will need to tweak one small thing, and that is to remove the Subtitles (scodec) option, because you do not need to transcode them, merely overlay them.

Output string

Therefore, if your output looks like:

:sout=#transcode{vcodec=h264,vb=800,fps=24,scale=Auto,
width=1920,height=1080,acodec=mpga,ab=128,channels=2,
samplerate=44100,scodec=dvbs,soverlay}:file{dst=<file>,
no-overwrite} :sout-keep

Remove the piece that reads scodec=dvbs,. Then, hit Stream.

Remove text from output string

Final string

Render & test

The render time will depend on many factors, including your CPU clock, the video size, the options you've selected, and such. Lean back and let it run. Once the file render finishes, close the media player, then launch your file to see what gives. You should also test on the destination system of your choice, wherever you'd like to watch the final product, to make sure everything works perfectly. There might be errors, and we will discuss those separately.

Streaming

Optional steps

You might also be interested in changing the default text renderer options through VLC advanced preferences menu. Tools > Settings, Show settings: All (bottom left), in the sidebar, select Video > Subtitles/OSD > Text renderer. Tweak as you please.

Text renderer

More reading

If you liked this article, then perhaps you'll enjoy these as well:

Handbrake tutorial (it can also do subtitles, I might follow up with an article)

Stream and record media in VLC

VLC secrets: logging and how it helps with bad files

Problems with VLC codecs - and how to fix this (Linux)

VLC cannot play remote files

Rotate videos in VLC

Conclusion

VideoLAN (VLC) is an extremely versatile tool, and this tutorial proves it. Literally, there are very few media-related tasks that VLC can't execute. It's just the right software for pretty much anything. The work flow is not as intuitive as it can be, but still. Your biggest enemy will be your own understanding of multimedia, and whatever codec support you have on your box. Plus of course the legal restrictions of distributing your work.

There we go. Another hurdle overcome. Now, this is not a simple one, and you're more likely to face weird errors and problems than smooth sailing. But we will address this in a followup article. Specifically, we will talk about audio problems, as well as issues of trying to upload our rendered files to Youtube. Worry not, all shall be resolved.

Cheers.

RSS Feed icon

del.icio.us del.icio.us stumbleupon stumble digg digg reddit reddit slashdot slashdot



Advertise!

Would you like to advertise your product/site on Dedoimedo?

Read more

Donate to Dedoimedo!

Do you want to
help me take early retirement? How about donating
some dinero to
Dedoimedo?

Read more

Donate