How to Concatenate Videos with FFmpeg: Keep Original Frame Rate

Abstract: Resolve frame rate conversion and stuttering when merging video clips by using the FFmpeg concat demuxer to join files without re-encoding.

Created: 2026-10-09 by

Concatenating videos in FFmpeg while preserving the original frame rate requires ensuring all input clips share identical video parameters. By using the concat demuxer with a properly formatted list file, you can merge footage without re-encoding, which maintains the source quality and timing. This approach avoids the common pitfall of frame rate conversion that occurs when using simple pipe concatenation.

Why Frame Rate Changes Occur

When users attempt to join video files using basic methods like piping output from one instance to another, FFmpeg often attempts to normalize the stream. If the input files have different resolutions, codecs, or frame rates, the software must re-encode the data to create a unified stream. This process frequently results in an incorrect or averaged frame rate, leading to stuttering playback or audio desynchronization. To keep the original frame rate intact, you must avoid this transcoding step entirely by treating the inputs as compatible containers. The most reliable method for Linux environments is using the concat demuxer. Unlike the protocol-based concatenation which streams data through memory, the demuxer reads metadata from a text file and instructs FFmpeg to simply copy the packets from each file into the new container. Because no decoding or encoding happens, the video frames remain exactly as they were in the source files, including their precise timestamps and frame rates.

Preparing Your Input Files

Before running any commands, verify that all video segments you intend to join are encoded with the same codec, resolution, and pixel format. For example, if one clip is H.264 at 1920x1080 and another is HEVC at 1280x720, direct concatenation will fail or produce corrupted output. You can check these details using ffprobe:
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name,width,height,r_frame_rate -of default=noprint_wrappers=1 input.mp4
If the outputs match across all your files, you are ready to proceed. If they differ, you must first standardize them using a filter complex or by re-encoding to a common baseline, though this will alter the original frame rate and quality. Ensure your filenames do not contain spaces or special characters, as this can cause parsing errors in the list file.

Creating the Concat List File

Create a plain text file named input.txt (or similar) on your Linux system. Each line in this file must specify the path to a video file using the file directive followed by the absolute or relative path enclosed in single quotes. The order of lines determines the playback order of the final video.
file '/path/to/clip1.mp4'
file '/path/to/clip2.mp4'
file '/path/to/clip3.mp4'
Do not include blank lines between entries, as some versions of FFmpeg may interpret them incorrectly. Ensure there is a newline character at the very end of the file. This small detail is often overlooked but is critical for the parser to recognize the last entry. Save the file in the same directory as your videos or adjust the paths accordingly.

Executing the Concatenation Command

With the list file prepared, run the following FFmpeg command in your terminal. This command tells FFmpeg to use the concat demuxer, read the instructions from your text file, and copy the video and audio streams directly into the output file without modification.
ffmpeg -f concat -safe 0 -i input.txt -c copy output.mp4
The -f concat flag specifies the format. The -safe 0 option allows the use of absolute paths in the list file; omitting this may cause security warnings or errors if you are using full directory paths. The -c copy instruction is crucial because it forces stream copying rather than re-encoding. This ensures the original frame rate, bitrate, and quality are preserved exactly as they existed in the source clips. If you encounter issues with certain formats like MP4, ensure the files are MPEG-4 compliant. Some older or non-standard MP4 files may not support direct concatenation due to missing moov atoms or incompatible header structures. In such cases, you may need to remux them first using ffmpeg -i input.mp4 -c copy fixed.mp4 before adding them to the list. For more advanced editing needs, such as removing specific frames to smooth out transitions, you might explore techniques detailed in our guide on How to Delete Every 25th Frame in FFMPEG for Smoother Video Playback. This can help resolve minor sync issues after concatenation if the sources had slight timing drifts.

Troubleshooting Common Errors

Users often face the "Invalid data found" error during concatenation. This usually indicates that the input files are not truly compatible, even if they appear similar. Check for differences in audio sample rates or channel layouts. A mismatch here will prevent the muxer from creating a valid output file. Another common issue is the "Unsafe file name" error. This happens when FFmpeg detects potential directory traversal attacks in your list file. Using absolute paths without the -safe 0 flag triggers this. Always include this flag when working with complex directory structures on Linux. If the output file plays back at double speed or has audio/video desync, check the frame rates again. Sometimes, variable frame rate (VFR) recordings from cameras can confuse the demuxer. Converting VFR to constant frame rate (CFR) using a filter before concatenation can stabilize the timeline. For insights on handling timestamp issues, refer to Incorrect pts filename with ffmpeg's -ss and -frame_pts true, which discusses how PTS (Presentation Timestamp) errors affect playback accuracy.

Frequently Asked Questions

Can I concatenate videos with different resolutions?

No, FFmpeg cannot directly concatenate clips with different resolutions using the demuxer method. You must first resize and pad the videos to a common dimension using the scale and pad filters before joining them.

What if my video has variable frame rate?

Variable frame rate (VFR) can cause synchronization issues during concatenation. Convert your clips to constant frame rate (CFR) using the -r flag or a filter graph before creating the list file to ensure stable playback.

Does this method work for MKV files?

Yes, the concat demuxer works well with MKV, AVI, and other container formats, provided the underlying video and audio codecs are identical across all input files.

How do I add audio tracks during concatenation?

The standard command copies existing audio streams automatically. If you want to replace audio, you can map specific streams using the -map option, but mixing different audio codecs still requires re-encoding.

Is there a limit to the number of files I can join?

There is no hard limit imposed by FFmpeg itself, but practical limits depend on your system's RAM and the length of the list file. Extremely long lists may slow down processing, so consider splitting massive projects into smaller batches.

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