FFmpeg Altering Codec Tags in M2TS Files: Notable Process Output

Abstract: Prevent FFmpeg from altering codec tags in M2TS files by explicitly specifying input codec identifiers during remuxing.

Created: 2026-09-24 by
FFmpeg modifies codec tags in M2TS containers when it re-encodes or remuxes streams, often changing how Blu-ray PCM audio is identified. This behavior stems from FFmpeg's default codec selection logic and its handling of legacy container formats. Users can prevent unwanted tag alterations by explicitly specifying codec identifiers during the conversion process.

Understanding Codec Tag Alteration

When working with M2TS files, particularly those extracted from Blu-ray discs, you may notice that FFmpeg changes the internal metadata describing the audio and video streams. The most common culprit is the handling of uncompressed Pulse Code Modulation (PCM) audio. While many players rely on standard tags like pcm_s16le, some Blu-ray sources use specific descriptors that FFmpeg might normalize to a more generic format during processing.

This alteration is not always an error but rather a side effect of FFmpeg's strict adherence to standard container specifications. When you remux a file without re-encoding, FFmpeg attempts to map the source stream to the closest compatible codec in the output container. If the source uses a non-standard or proprietary tag for PCM audio, FFmpeg may replace it with a standard WAV-like tag. This can cause compatibility issues with older hardware players that expect the original Blu-ray specific tags.

It is important to distinguish between actual data corruption and mere metadata changes. In most cases, the underlying audio or video data remains intact. However, if the player fails to recognize the new tag, playback may fail or switch to a fallback decoder, which can result in stuttering or silence. For detailed diagnostics on stream composition, you can refer to our guide on How to detect with ffmpeg if the stream has video or audio or both to verify what streams are actually present in your file.

Identifying the Problematic Streams

Before attempting a fix, you must identify exactly which stream is being altered. Use the following command to inspect the input file:

ffprobe -v error -show_entries stream=codec_name,codec_tag_string,channels,sample_rate -of json input.m2ts

Look for the audio stream entry. If the codec_tag_string shows something unusual or differs from the expected standard, this confirms the issue. Common tags for Blu-ray PCM include LPCM or specific vendor codes. If FFmpeg outputs a different tag in the log, it indicates where the mismatch occurs.

Solutions to Preserve Codec Tags

To prevent FFmpeg from altering these tags, you need to force the output codec to match the input exactly. This is achieved using the -c:a and -c:v flags with specific codec names that preserve the original encoding.

For Audio Streams

If you are dealing with PCM audio, avoid using generic encoders. Instead, specify the exact codec name used in the source. For example, if the source is 16-bit little-endian PCM, use:

ffmpeg -i input.m2ts -c:a pcm_s16le -c:v copy output.m2ts

If the source uses a different PCM variant, such as big-endian, adjust the flag accordingly (pcm_s24be). It is crucial to ensure that the target container supports the specific bit depth and endianness of the source audio.

For Video Streams

Video codec tags are less frequently the source of this specific issue but can still be affected. To preserve the video stream without re-encoding, use the copy option:

ffmpeg -i input.m2ts -c:v copy -c:a copy output.m2ts

This method copies all streams verbatim, including their tags. However, if you must re-encode the video for size reduction, you will inevitably change the codec tag to the new encoder's identifier (e.g., avc1 for H.264). In such cases, test the output on your target device to ensure compatibility.

Handling Complex Multi-Stream Files

M2TS files often contain multiple audio tracks, subtitles, and chapters. When combining media, it is easy to inadvertently drop or alter streams. If you are adding delayed audio or merging streams, ensure that each stream is mapped individually to maintain control over its codec settings. For more information on managing complex stream arrangements, see Combining Video and Audio with FFmpeg.

Use the -map option to explicitly select streams. This prevents FFmpeg from making automatic decisions about which streams to include and how to encode them. For example:

ffmpeg -i input.m2ts -map 0:0 -map 0:1 -c:v copy -c:a pcm_s16le output.m2ts

This command maps the first video stream and the first audio stream, ensuring that only the specified audio stream is processed with the PCM encoder while the video is copied directly.

Verifying the Output

After running the conversion, verify that the codec tags have been preserved correctly. Run the same ffprobe command on the output file and compare the results. If the tags match your expectations, the issue is resolved. If they still differ, check the FFmpeg documentation for your specific version, as codec handling can vary between releases.

Frequently Asked Questions

Why does my Blu-ray player not recognize the new audio track?

Many consumer Blu-ray players are strict about codec tags and may reject streams that do not match the expected specification. Even if the audio data is identical, a different tag string can cause the player to skip the track or display an error. Always use the exact codec name from the source file when remuxing.

Can I convert PCM to AC3 without changing the tag incorrectly?

Yes, but you must explicitly specify the AC3 encoder. Use -c:a ac3 to encode the audio into Dolby Digital. This will change the codec tag to reflect AC3, which is generally widely supported. Ensure the bitrate is set appropriately using -b:a to maintain quality.

Does FFmpeg always alter tags when re-encoding video?

Yes, re-encoding changes the codec identifier to the one used by the new encoder. For example, converting from MPEG-2 to H.264 will change the video codec tag from mp2v to avc1. This is normal and usually does not affect playback unless the target device has very limited codec support.

How do I handle delayed audio streams in M2TS files?

If your audio stream has a delay, you can correct it using the adelay filter or by adjusting the timestamps. For complex scenarios involving multiple delayed tracks, refer to our guide on Adding Multiple Delayed Audio Streams to a Single Video Using FFmpeg for detailed filtering techniques.

Is it safe to use -c copy for all streams?

Using -c copy is safe and preserves all original metadata and codec tags. However, it increases file size significantly because no compression is applied. Use this method only when you need to modify container-level metadata or merge streams without altering the core media data.

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