How to Add SRT Subtitle File to an Existing .TS File using FFmpeg

Abstract: Resolve duplicate subtitle streams in TS files by explicitly mapping video and audio tracks while adding a new SRT file with FFmpeg.

Created: 2026-09-13 by
To add an SRT subtitle file to an existing .TS file without duplicating streams, use FFmpeg’s stream mapping options to explicitly select only the video and audio tracks while adding the new subtitle track. The command structure requires specifying input sources for each stream type individually rather than using broad wildcard mappings that capture existing data. This approach ensures a clean muxing process where your provided SRT file becomes the sole subtitle source in the output container.

Understanding the Stream Duplication Issue

A common mistake when working with Transport Stream (.TS) files is assuming that all inputs are empty canvases. Many recorded .TS files already contain embedded subtitle streams, such as Closed Captions or PGS subtitles. When users run standard FFmpeg commands that map all streams from the input file, these existing subtitles are copied into the output alongside your newly added SRT file. This results in duplicate subtitle tracks, which can cause playback issues in media players like VLC or Kodi, where users might see multiple identical or conflicting subtitle options. To avoid this, you must understand how FFmpeg handles stream selection. By default, FFmpeg attempts to copy every stream it finds in the input unless instructed otherwise. Therefore, the solution lies not just in adding the subtitle, but in carefully curating which streams are carried over from the original .TS file. You need to separate the video and audio streams from the potential existing subtitle streams, ensuring only the latter are excluded or overwritten by your new external file.

Preparing Your Input Files

Before running the conversion, ensure your SRT file is properly formatted. SubRip Text files should have consistent timing formats and valid line breaks. If your SRT file contains special characters or non-Latin scripts, you may encounter rendering issues depending on the player. For general compatibility, UTF-8 encoding is recommended. Additionally, verify that the timestamp alignment in your SRT file matches the duration of the video content. Mismatches here will not be fixed by FFmpeg during muxing; they will simply result in subtitles appearing at the wrong times or not at all. You also need to locate the original .TS file and the .SRT file on your local system. Note their full paths, as FFmpeg commands require precise file locations. It is advisable to work with copies of your original files if you are unsure about the process, although FFmpeg’s remuxing operation is generally non-destructive to the original source data.

The Correct FFmpeg Command Structure

The most robust way to handle this task is to explicitly define the inputs and outputs for each stream type. This method gives you granular control over what gets included in the final file. Instead of using -map 0, which maps all streams from the first input, you should use specific map indices or global stream selection flags. Here is the recommended command structure:
ffmpeg -i input.ts -i subtitle.srt -c:v copy -c:a copy -c:s mov_text -map 0:v:0 -map 0:a:0 -map 1:s:0 output.ts
Let’s break down why this works. The -i input.ts specifies the main video file, and -i subtitle.srt adds the subtitle file as a second input. The codec flags -c:v copy and -c:a copy tell FFmpeg to re-encode neither the video nor the audio, making the process extremely fast as it only muxes (combines) the streams. The critical part is the -map section. -map 0:v:0 selects only the first video stream from the first input. -map 0:a:0 selects the first audio stream. Finally, -map 1:s:0 selects the subtitle stream from the second input (the SRT file). By omitting any map for subtitles from the first input, you effectively discard any existing subtitles in the .TS file. Note on Codec Selection: While some guides suggest using -c:s mov_text, this is primarily designed for MP4 containers. For TS files, especially those intended for broadcast or standard players, -c:s srt or simply letting FFmpeg auto-detect the subtitle codec based on the input format is often safer. However, since we are mapping an external SRT file, FFmpeg will typically handle the internal representation correctly. If you face compatibility issues with specific players, consider using -c:s dvb_subtitle or -c:s pgs if you convert the SRT first, but for direct SRT addition, the explicit mapping is the key fix.

Verifying the Output

After running the command, always verify the output file. Use a tool like ffprobe to inspect the streams in the new output.ts. Run the following command:
ffprobe output.ts
Look for the stream tags. You should see one video stream, one or more audio streams, and exactly one subtitle stream derived from your SRT file. If you see additional subtitle streams labeled with IDs that do not match your SRT input, the mapping was incorrect, and you likely still have duplicates. Play the file in a reliable media player to ensure the subtitles appear synchronously and are selectable. For users who need to retain existing subtitles while adding new ones, or manage complex multi-track scenarios, refer to How to Add Multiple Audio and Subtitle Tracks to Video. This guide expands on stream selection techniques for more intricate editing tasks. If you are experiencing issues with Arabic text displaying as square boxes or burnt-in subtitle problems, check out Fix Arabic Words Showing Square Boxes and Burnt Subtitles with FFmpeg for specific encoding solutions related to script support.

Frequently Asked Questions

What happens if I don't specify -map?

If you omit the -map option, FFmpeg defaults to copying all streams from the input files. This means any existing subtitles in your .TS file will be duplicated alongside your new SRT file, leading to multiple subtitle tracks in the output.

Can I burn the subtitles directly into the video?

Yes, but this requires re-encoding the video stream, which takes significantly longer and reduces quality. To burn subtitles, you would use the -vf subtitles=subtitle.srt filter instead of mapping the subtitle as a separate stream.

Why does my player show no subtitles even after adding them?

This is often due to codec incompatibility. Some older players struggle with raw SRT streams in TS containers. Try converting the SRT to a different format like PGS or DVB subtitles before muxing, or ensure your player supports soft-coded SRT subtitles.

Is it safe to overwrite the original .TS file?

FFmpeg allows you to save the output to a new filename, which is safer. If you attempt to write back to the same filename, FFmpeg may fail because it cannot read the input file while simultaneously writing to it. Always use a distinct output name.

How do I remove all existing subtitles from a TS file?

You can achieve this by excluding subtitle maps entirely. Use -map 0:v -map 0:a without any -map commands for subtitles. This forces FFmpeg to copy only video and audio, discarding any embedded subtitle tracks from the source.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More