How to sub (Not translating)

I should preface this by saying that if you do not know Japanese or English you should not be doing JP->EN or EN->JP translations. Seems obvious but apparently not obvious enough from what I’ve seen.

I am not an anime translator, timer, or typesetter. I do unscripted things like radio shows or live streams, which means I don’t have to deal with a lot of the complicated things anime sub groups/people have to deal with. Rather, I have to somehow create legible subtitles out of the chaos that is unscripted talking. With that out of the way…

Now, I’m kinda tired of everyone constantly asking how to make their own subs but I might as well do something about this. I will not go into intense detail on things like how to use Aegisub because there are well made tutorials online. Refer to Doki’s timing guide and unanimated’s typesetting guide.

I’ll go into clipping/cutting, hardsubbing, and some basic ffmpeg stuff. I’ll also talk about some best practices for timing (ctrl+f timing to find it), but I’m no authority on this. It’ll just be me telling you what I think doesn’t look like shit.


Slightly related video guide

See https://www.bilibili.com/video/av66074840/ for scripts and links


What software should I use to make subs?

Aegisub is really the only choice here. Open source and available on all the major platforms, and easy to use once you get used to the keyboard shortcuts. Look up online tutorials on how to use it.

FFmpeg is an extremely powerful command line tool that I recommend to people to hardsub videos and use for general cutting of videos. I will tell you the basic commands you need to know to render and cut videos. You’re free to use Handbrake or whatever, but ffmpeg is much more flexible.

I signed up to translate weeb videos not learn how to code

FFmpeg is not programming. You run extremely simple commands (which you don’t even need to understand). Google how to install it. If you are on Windows, make sure you add ffmpeg to path, or the commands I give you will not work. 

To add ffmpeg to path in Windows (shamelessly copied from https://docs.alfresco.com/4.2/tasks/fot-addpath.html)

  1. On the Windows desktop, right-click My Computer.
  2. In the pop-up menu, click Properties.
  3. In the System Properties window, click the Advanced tab, and then click Environment Variables.
  4. In the System Variables window, highlight Path, and click Edit.
  5. In the Edit System Variables window, insert the cursor at the end of the Variable value field.
  6. If the last character is not a semi-colon (;), add one.
  7. After the final semi-colon, type the full path to the file you want to find. For example: path C:\Program Files\ffmpeg
  8. Click OK in each open window.

In step 7, just make sure the path you enter in the field leads to the folder that contains ffmpeg.exe.


FFmpeg for the clueless translator

Hard-subbing (the easiest possible way)

ffmpeg -i "inputvideo" -vf "ass=subtitlename" outputvideo.mp4

This is basically the most basic command you run to hardsub the video. Yes, there are some things that should be added that I will go into in the next section, but the purpose of this example is to show you how simple ffmpeg is to use.

Run this in the directory your video and subtitle file is in. (Shift+right click in the Windows Explorer window and click Open Powershell here)

Basic breakdown:

ffmpeg” tells Windows to run ffmpeg in this directory. If you get an error that ffmpeg is not a recognized command, you screwed up adding it to PATH.

-i inputvideo” tells ffmpeg what to use as the input video (hence i). If your raw video is called video.mp4, you would type -i video.mp4

-vf” means video filter. You’re telling ffmpeg that you want to use a filter on the video (in this case adding subtitles).

ass=subtitlename” tells ffmpeg that the video filter you want to use is the “ass” filter (note that this only works for .ass files, which is what Aegisub produces by default). If you name your subtitle file subtitles.ass, you type “ass=subtitles.ass” here. Quotes not necessary, but it won’t break if you do add it.

“outputvideo.mp4” FFmpeg will take all the options you specified and turn it into a video called outputvideo.mp4

Hard-subbing while not destroying quality of the original video

FFmpeg generally produces decent looking videos by default, but sometimes it’s no good.

ffmpeg -i input -vf "ass=subtitles" -c:a copy -c:v libx264 -preset slow -crf 23 output.mp4

So now it looks a bit more complicated. The only thing that has changed is me adding “-c:a copy -c:v libx264 -preset slow -crf 23”.

A quick breakdown:

“-c:a” Can also be written as “-acodec”. This tells ffmpeg that you are about to tell it what to do with the audio codec.

“copy” By saying this after “-c:a”, you tell ffmpeg to just not reencode the audio and copy it over to the new video. Audio is generally an insignificant percentage of the overall size of a video, so it doesn’t hurt to just copy it over. I pretty much always add this option.

“-c:v libx264” Since -c:a tells ffmpeg you’re changing audio settings, it should be obvious -c:v tells you to change video codec. You don’t really need to know what libx264 is, but you can’t go wrong with it.

“-preset slow” This is a setting that controls encoding speed/compression ratio. Basically, it encodes slower but looks better. It’s not really necessary, but most of the stuff in this section isn’t anyway.

“-crf 23” crf stands for constant rate factor, a useful feature of the video codec we chose. It basically tells the encoder to make the video constantly look like a quality of “23” and vary the bitrate automatically to do so. You can enter any value from 1 to 51. Higher is worse. 17-28 are reasonable values. Play with this value until you get a good file size/quality compromise.

Rule of thumb for -crf: changing CRF by +6 about halves file size, -6 about doubles it. Note a double size (probably) does not “double” video quality, so…

I did what you told me but Twitter/Vegas Pro/something else will not take my video

Change “-c:a copy” to “-c:a aac -b:a 128k”. This tells ffmpeg to reencode the audio to constant 128kbps aac, compatible with Twitter + most things. Feel free to experiment with different audio codecs here, but at low bitrates aac is generally the most failsafe and is compatible with most things.

Add “-pix_fmt yuv420p” to video settings. This changes the pixel format to something compatible with Twitter + most things. You can also do “-vf format=yuv420p”.

Note that when applying two video filters at the same time, you must specify them together or ffmpeg will only apply the later one (or the earlier one, I cba to check right now). This means if you are hardsubbing your video at the same time, you should do:

... -vf "ass=subtitles.ass, format=yuv420p" ...

Quotes required. This pattern continues for however many video filters you may need to add (scaling, deinterlacing, maybe concatenating?)

Clipping/cutting videos without killing quality

ffmpeg -ss starttime -i input.mp4 -t videoduration -c copy output.mp4
ffmpeg -i input.mp4 -ss starttime -to endtime -c copy output.mp4

Clipping losslessly means you don’t reencode the video, making the process near instant, while not losing any video quality. This is a surprisingly complicated topic, so I recommend you read FFmpeg’s page on seeking.

“-ss starttime” This tells ffmpeg where to seek to to start the new video.

For example:

-ss 10 will start your new video at 10 seconds of the original video

-ss 1:23 will start your new video at 1 minute 23 seconds

-ss 1:23:30 will start your new video at 1 hour 23 minutes 30 seconds

-ss 1:23:30.5 will start your new video at 1 hour 23 minutes 30 seconds 500 milliseconds.

-t videoduration The -t flag tells ffmpeg to output the next videoduration time of video, ie) -t 1:30:30.5 will make your new video start at the time you specified after -ss and then run for 1 hour, 30 minutes, 30 seconds, and 500 milliseconds total. If your original video isn’t that long it’ll just end whenever the original video ends.

-to endtime The -to flag tells ffmpeg to only output until endtime, so in many cases it’s a bit easier to use than -t.

-c copy Like we talked about -c:a and -c:v before, this tells ffmpeg what codec to use. By not specifying :a and :v, we tell ffmpeg to just copy everything.

You might have noticed I put -ss before the input in one line and after the input in another. It doesn’t really matter where you put it when you do -c copy, but note that if you put -ss before -i you can only use -t and not -to. (Unless you add another flag -copyts. I can keep on going but this is meant to be a simple post.)

My video doesn’t start when I told it to/My audio and video is desynchronized

Read the ffmpeg link I posted in the last section.

tl;dr Lossless video clipping isn’t perfect. It can only clip to specific parts in the video. Take out -c copy if you must clip to a place that ffmpeg won’t let you clip to. Play with encoding settings until it looks good enough. Be a bit more generous with the file size here, since this file is going to get reencoded again when you hardsub the video, so you want as much quality as you have to work with.


Timing (decently)

I hope you read Doki’s timing guide. If it was too long for you to read, then I’m already worried about your subs. I will admit that I do not follow everything in there because of the nature of unscripted live streams, but here are the important takeaways (straight from the guide you should have read):

Scene bleeds: If there is a camera cut that your subtitles start/end close to and you do not time them on the exact frame, it was also look like your subtitles are flashing. That is bad.

Stacking subtitles: This is often a problem, especially in radio shows or live streams, when there is no script and everyone is talking over each other. Here are some rules of thumb I try my best to follow:

  1. Don’t let subtitles stack (or at least try): If it is two people talking after each other in quick succession, you may be able to get away with just having the subs follow each other instead of stacking. Keep the 500 ms rule in mind.
  2. Avoid floating subtitles: I am guilty of this in my earlier videos too. There will often be times when a new speaker talks over the original one then keeps on going. Normal timing methods will result in the bottom subtitle disappearing after a while, while the top one keeps on going, resulting in a weird subtitle floating in the middle of nowhere effect. I try to avoid this by just letting the bottom line stay until it can disappear/change with the top line. Remember, if the new speaker starts talking around the time the original stops, in some cases it might be OK to cut off the original speaker’s line and just move on to the new line. Have someone else watch it and tell you if they think it’s readable/makes sense.
  3. Limit the number of lines on screen: Aegisub will automatically add new lines to your subtitles when you run out of screen width and shift everything upwards. This does not mean you should just go wild typing paragraphs into single subtitle lines. I try to limit max # of lines on screen at 2 lines, unless a ton of speakers start talking over each other, in which case I may briefly go to 3 lines.
  4. Keep stacked subtitles synced as best as you can: This is similar to the “gaps” problem I talked about earlier. When you have two people talking each over at about the same time, your lines will stack. It is rare for people to talk in perfect sync in these situations, but you should keep your subtitles for these two people in perfect sync if they are talking for similar amounts of time at the same time.
  5. Not everything has to be translated!: “Sacrilege! It is a translator’s job to translate every single thing said in a video!” But when you have 9 people screaming “sugoi” and “yabai” over each other or just talking over each other saying the same things, at some point something has to give. Use your own judgement here. What’s the important stuff being said?

I’m trying to follow your stacking suggestions but my whole video is just people talking over each other

In times like this, you have to wonder if your video can really be subtitled neatly. At some point, native speakers of the language will also stop being able to keep up with everyone talking at the same time so you could cherry-pick lines to translate and try to bluff your way through it.


I’ll continue updating this article based on suggestions and comments. Please Google any questions you have before asking me.

If any authors of information cited here takes offense to me referencing their work, please let me know.

2 thoughts on “How to sub (Not translating)

  1. Bash shortcut:

    “`sh
    function mux() {
    command ffmpeg -i $1 -vf “ass=$2” -c:a copy -c:v libx264 -preset slow -crf 23 output.mp4
    }
    “`
    Usage:

    `mux source.mp4 subs.ass`

    Will output to `output.mp4` in the current working directory.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s