Celeb Glow
news | March 13, 2026

Adding subtitles via command line in ffmpeg

I'm trying to loop, via batch file, through all my folders and, where external subtitle files are present, merge them into existing files. Subtitles could be srt/sub/idx/etc., basically any format. Most are English, but a few are other languages. The video files could be MP4, MKV, AVI. (Understood that ffmpeg might not support all of these.)

I don't want to "burn in" the subtitles, I just want them available.

If possible, I don't want to reencode any of the files, just add in the subtitles so I don't need the separate subtitle files.

I'd appreciate it someone could share the proper-syntax command line to do this.

I have the (however inelegant) framework (batch file), basically:

For /R %%A in (D:\Movies) Do (
If Exist %%~dpn.srt (
[awaiting ffmpeg CLI syntax]
Del %%~dpn.srt
)
For /R %%B in ("%%~dpn.*Eng.srt") Do (
[awaiting ffmpeg CLI syntax]
Del %%B
)
If Exist %%~dpn.*Ita.srt (
[awaiting ffmpeg CLI syntax]
Del %%~dpn.srt
)
For /R %%B in ("%%~dpn.*Ita.srt") Do (
[awaiting ffmpeg CLI syntax]
Del %%B
)
If Exist %%~dpn.sub (
[awaiting ffmpeg CLI syntax]
Del %%~dpn.srt
)
If Exist %%~dpn.idx (
[awaiting ffmpeg CLI syntax]
Del %%~dpn.srt
)
[repeat for each subtitle format]
)

What I'm missing is a simple clear understanding of the CLI to only embed (but not "burn in") the subtitles, without otherwise re-encoding each file (or, if re-encoding, need to make sure the file does not significantly grow).

Appreciate your help in advance.

Thank you.

1 Answer

There are plenty of existing posts about the same task:

Basically you just specify both files as inputs using -i and ffmpeg will create a combined file which contains all of the input streams it finds.

Note that not all containers support all subtitle types, and some might need a special option. For example, if you're writing to an MP4 file, you'll need -c:s mov_text to convert SUB/SRT into MP4's interna' subtitle format. If you have fancy-formatted SSA (.ass) subtitles, they can only be added to .mkv containers.

To avoid re-encoding, make sure to use the "copy" codec: -c:a copy and -c:v copy. Also avoid referring to any posts which mention "hardsubs"; do not use -vf.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy