Using ffmpeg with MTS files created from Canon video camera

Abstract: Resolve Canon MTS playback errors and compatibility issues by converting files to H.264 MP4 using ffmpeg with proper deinterlacing and audio settings.

Created: 2026-08-16 by

Use the command ffmpeg -i input.MTS -c:v libx264 -preset fast -crf 23 output.mp4 to convert Canon MTS files efficiently. This command forces re-encoding into a widely compatible MP4 container using the H.264 codec, ensuring smooth playback across devices while maintaining high visual quality with minimal file size increase.

Understanding the MTS Format Challenge

Canon video cameras typically record in the AVCHD format, which stores footage inside an MPEG-2 Transport Stream container with a .MTS extension. While this format is excellent for archiving due to its efficient compression, it presents significant compatibility issues for web streaming, mobile editing, and social media uploads. Most modern software expects standard MP4 containers with AAC audio codecs, leading to errors or unplayable files when you attempt to use raw MTS inputs directly.

The core issue lies not in the video data itself, but in the container structure and the specific encoding parameters used by the camera. FFmpeg handles these streams well, but it requires explicit instructions on how to remux or transcode the data because the default behavior might not match your desired output standards. Without proper flags, you may encounter black screens, audio desynchronization, or files that are too large for practical sharing.

Basic Conversion Workflow

To resolve these compatibility issues, you need to perform a full transcoding operation rather than a simple copy. This process decodes the incoming MPEG-2 video stream and re-encodes it into a more universal format. The following command provides a robust baseline for most users who want a balance between speed and quality.

ffmpeg -i input.MTS -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 192k output.mp4

This command specifies the input file as input.MTS. It sets the video codec to libx264, which is the industry standard for H.264 encoding. The -preset fast option balances processing time with compression efficiency, making it suitable for daily use without excessive CPU load. The -crf 23 parameter controls the Constant Rate Factor, where 23 is considered visually lossless for most content; lower values mean higher quality but larger files.

For the audio, we explicitly specify the AAC codec with a bitrate of 192kbps. This ensures that the audio remains synchronized and compatible with virtually all players. If you skip the audio specification, FFmpeg might choose a less compatible codec depending on its internal configuration, leading to potential playback issues on older devices.

Handling Interlaced Footage

Many Canon cameras record interlaced video to save bandwidth during capture. If you play the converted file on a modern computer or browser, you may notice horizontal lines or "comb" artifacts during fast motion. This happens because progressive displays struggle to render interlaced frames correctly. To fix this, you must deinterlace the video during the conversion process.

Add the -vf fieldorder=bt,deinterlace filter to your command line. The fieldorder=bt part tells FFmpeg that the top field is displayed first (bottom-top), which is the standard for AVCHD. The deinterlace filter then converts the interlaced fields into a progressive sequence. This results in a smoother viewing experience, especially for sports or action scenes recorded by your camera.

ffmpeg -i input.MTS -c:v libx264 -preset fast -crf 23 -vf fieldorder=bt,deinterlace -c:a aac output.mp4

Advanced Optimization Techniques

For users who need faster processing times or specific hardware acceleration, FFmpeg offers several advanced options. If you have an NVIDIA GPU, you can utilize the h264_nvenc encoder instead of libx264. This shifts the workload from the CPU to the GPU, significantly speeding up the conversion process for large batches of files.

However, GPU encoders sometimes produce slightly lower quality at equivalent bitrates compared to CPU-based software encoders. Therefore, it is advisable to test the output before committing to this method for critical projects. You can also adjust the -movflags +faststart flag to move metadata to the beginning of the file. This allows web browsers to start buffering the video immediately, improving the user experience for online distribution.

If you encounter issues related to corrupted headers or invalid signatures during the conversion, refer to our guide on fixing invalid PNG signature errors, which often share underlying causes with container corruption. Additionally, if your goal is to combine these clips with other media, ensure you understand how to concatenate image and video without reencoding the video portion to preserve maximum quality.

Checking File Integrity

Before converting, it is wise to check the integrity of the source MTS file. Corrupted files from broken card removals can cause FFmpeg to hang or produce garbled output. Run ffprobe input.MTS to analyze the stream. Look for any error messages regarding dropped packets or incorrect timestamps. If the probe fails, consider using recovery tools on the SD card before attempting further conversions.

Another common pitfall is dealing with variable frame rates. Some cameras report a constant frame rate even when the actual recording varies slightly. FFmpeg can handle this, but adding -r 30 (or your target frame rate) forces a consistent output, preventing stuttering in players that expect strict timing.

Common Troubleshooting Steps

If the output file plays but has no sound, verify that the audio stream was successfully mapped. Sometimes, FFmpeg defaults to copying the audio stream without re-encoding, which can fail if the destination container does not support the original codec. Explicitly setting -c:a aac resolves this by forcing a compatible re-encode.

If the video appears green or purple, it is likely a color space mismatch. AVCHD uses YUV 4:2:0, while some players expect RGB. Adding -pix_fmt yuv420p to the command line ensures the pixel format is compatible with almost all HTML5 video players and media centers. This small adjustment prevents color distortion in browsers like Chrome and Edge, where seekability issues might otherwise arise due to incompatible formats.

Frequently Asked Questions

Why does my converted video look blocky?

This usually indicates that the CRF value is set too high, resulting in aggressive compression. Lower the CRF value to 18-20 for high-quality results, or increase the bitrate manually using the -b:v flag. Ensure you are not using a very slow preset if you need maximum quality, as slower presets allocate bits more efficiently.

Can I convert MTS to MKV instead of MP4?

Yes, simply change the output filename extension to .mkv. MKV supports more codecs and metadata than MP4, making it ideal for archival purposes. However, keep in mind that some smart TVs and gaming consoles have limited support for MKV containers compared to the universal MP4 standard.

How do I speed up the conversion process?

You can reduce the encoding time by using a faster preset like ultrafast or by enabling hardware acceleration with -c:v h264_nvenc on NVIDIA GPUs. Note that faster presets sacrifice compression efficiency, meaning you will get larger files for the same visual quality. Always test the trade-off between speed and file size.

What should I do if FFmpeg crashes during conversion?

Crashes are often caused by corrupted source files or insufficient memory. First, run ffprobe on the input file to check for errors. If the file is intact, try increasing the thread count with -threads 0 to let FFmpeg auto-detect optimal CPU usage. Updating FFmpeg to the latest version also resolves many known bugs related to specific codec implementations.

Does converting MTS to MP4 lose quality?

If you use a high CRF value (like 23 or lower) and a good preset, the quality loss is negligible to the human eye. This is called "visually lossless" transcoding. However, any re-encoding is technically a generation loss. For final masters, consider keeping the original MTS files and only creating MP4 versions for distribution or editing.

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