Category: Software

Converting MKV video file to MP4 with hardsubs (embedded subtitles) on Linux (Ubuntu)

I had to convert some MKV video files into MP4 format with embedded (rendered) subtitles. This would not be a problem if not the external ASS subs that I had. HandBrakeCLI can easily convert between those formats but it can use embedded ASS file (from MKV video) or provided SRT. There is no way to use an external ASS subtitles file. Luckily there is a quite simple solution for that issue: we can just remove original MKV video subtitles, add ours and then use HandBrakeCLI to convert the video.

Replacing the ASS MKV subtitles with our own

First we need to remove the original ASS subtitles that are stored in MKV file:

mkvmerge --no-subtitles source.mkv -o target.mkv

This will copy MKV file but will remove subtitles.

After that, we need to add our ow ASS file (subtitles.ass):

mkvmerge -o target_with_subs.mkv target.mkv -D -A subtitles.ass

Now we have a MKV file with our ASS subtitles, that we can use to create MP4 file.

Creating MP4 file with embedded (hardcoded) subtitles

Convertion is really simple:

HandBrakeCLI -i target_with_subs.mkv -o result.mp4 -e x264 -q 20 -B 160\
 --x264-preset medium --two-pass -O --turbo --subtitle "1" \
 --subtitle-burn "1" --srt-codeset utf8

Simple one line long command and 30 minutes later you have your MP4 file with hardsubs.

Medialab – Social Innovations Lab – Presentation & Short description

Recently I took part in MediaLab - Social Innovation Lab that focused on social issues which could be solved with new technologies. During the lab, I gave a small presentation about web applications. It can be downloaded here: About web apps

I must say, that it was pretty amazing experience. Working with non-IT people in order to develop an IT tool is really something else. A quick briefing on how did it look like:

  • groups of 8-10
  • 1 IT mentor per each group
  • 1 non IT mentor per each group
  • 4 days (2 weekends)
  • variety of skills among people in the same group
  • great attitude
  • 8h/day

We had 4 days (2 weekends) for idea, research, development, design and marketing strategy. I think we did pretty amazing thing: Incydentnik. It is a simple application that allows you to mark dangerous/not friendly places in Cracow, so other people will know about such places.

incydentnik1

incydentnik2

Some photos from the event:

If you consider participating in event of such type - don't hesitate! It is 100% worth it!

922519_498077266912449_862986850_o 922446_498077093579133_929243096_o
914163_498077310245778_424645888_o

Copyright © 2026 Closer to Code

Theme by Anders NorenUp ↑