FFmpeg Fails to Rotate Landscape MP4 Videos During Concatenation

Abstract: Fix FFmpeg landscape MP4 rotation loss during concatenation by re-encoding with transpose filters or using the concat demuxer to preserve metadata.

Created: 2026-08-17 by
FFmpeg fails to rotate landscape MP4 videos during concatenation because the rotation metadata is often stored in the container headers rather than being baked into the video frames. When you concatenate files, the default concat demuxer or protocol simply joins the streams without applying these header transformations, resulting in a video that appears sideways. To fix this, you must either re-encode the video to bake the rotation into the pixels using filters like transpose, or use the modern concat demuxer with proper metadata handling to preserve orientation information across the join.

Understanding Rotation Metadata vs. Pixel Data

Modern MP4 files created by smartphones and cameras rarely store the physical pixel data rotated. Instead, they store a rotate tag in the stream metadata indicating how the player should orient the image. For example, a phone held vertically might save a horizontal video but mark it as needing a 90-degree clockwise rotation. When FFmpeg processes these files individually, players respect this tag. However, when concatenating multiple clips, many older methods ignore this metadata, leading to the final output appearing in the wrong orientation.

This issue is distinct from actual pixel manipulation. If you look at the raw frame dimensions, a landscape video will still have width greater than height, even if the metadata says it should be portrait. This distinction is critical because re-encoding to "bake" the rotation changes the file size and quality, while metadata-aware concatenation preserves the original bitrate and speed.

Solution 1: Re-encoding with Transpose Filters

The most reliable way to ensure consistent orientation across concatenated segments is to normalize all input videos before joining them. This involves re-encoding each clip so that the rotation is physically applied to the video frames. You can achieve this using the transpose filter within an FFmpeg complex filter graph.

To rotate a video 90 degrees clockwise, you typically use transpose=1. Note that earlier guides sometimes incorrectly suggested transpose=0 for simple rotations, but transpose=0 actually performs a 90-degree counter-clockwise rotation followed by a vertical flip, which is not what you want for standard landscape-to-portrait conversion. The correct values are:

  • transpose=1: Rotate 90 degrees clockwise.
  • transpose=2: Rotate 90 degrees counter-clockwise.
  • transpose=3: Rotate 90 degrees counter-clockwise and flip vertically.
  • transpose=4: Rotate 90 degrees clockwise and flip vertically.

You can apply this to a single file using the following command structure:

ffmpeg -i input.mp4 -vf "transpose=1" -c:a copy output_rotated.mp4

After rotating all individual clips, you can safely concatenate them using any standard method, as the orientation is now part of the pixel data. This approach is ideal if you need the final file to be compatible with legacy players that do not read rotation tags.

Solution 2: Using the Concat Demuxer with Metadata

A more efficient solution, which avoids re-encoding entirely, is to use the FFmpeg concat demuxer with the safe option and ensure your inputs are properly formatted. While the basic concat protocol ignores metadata, the demuxer can handle it better if the files are prepared correctly. However, even the demuxer may strip rotation tags depending on the container format and encoder settings.

If you prefer not to re-encode, you can try forcing the preservation of metadata during the concat process. Use a text file listing your inputs:

file 'clip1.mp4'
file 'clip2.mp4'

Then run the concat command:

ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4

In some cases, this preserves the last file's metadata, but it is inconsistent. For robust results without re-encoding, consider converting all files to a format that supports metadata well, such as MKV, concatenate, and then convert back to MP4. Alternatively, use the -metadata:s:v rotate=0 flag to explicitly set or clear rotation metadata after concatenation if the player ignores it.

Common Pitfalls and Debugging

One common mistake is assuming that copy mode always preserves all aspects of the original file. While it copies audio and video streams, it does not always carry over complex side-data like rotation tags unless the container supports it natively and the muxer is configured to pass it through. Always check the output file properties using ffprobe to see if the rotation tag exists in the new file.

Another pitfall is mixing codecs. If one video is H.264 and another is H.265, direct concatenation is impossible without re-encoding. Ensure all source videos have identical codecs, resolutions, and frame rates. If you are dealing with varying resolutions, you must scale them to a common dimension before concatenation, which further necessitates re-encoding. In such cases, combining scaling and rotation in one step is efficient.

For users experiencing issues where the video plays correctly in VLC but not in web browsers, the issue is almost certainly the missing rotation metadata. Browsers often ignore the rotate tag in MP4 containers. In this scenario, re-encoding with the transpose filter is the only viable solution.

Advanced Filtering for Complex Scenarios

If you need to perform more complex operations, such as overlaying graphics while rotating, you can chain filters. For instance, if you need to scale the video to fit a specific aspect ratio after rotation, you can add a scale filter:

ffmpeg -i input.mp4 -vf "transpose=1,scale=1080:1920" -c:a copy output.mp4

This ensures that the video is both rotated and resized in a single pass. Be aware that this process is CPU-intensive and will take longer than simple concatenation. If you have many large files, consider processing them in batches or using hardware acceleration with -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 if available on your system.

For related issues involving overlays or character rendering, refer to our guide on FFmpeg: Scale2Ref Overlay Complex Filters Returning Audio-Only MP4 Output to understand how complex filter graphs interact with audio streams. Additionally, if you suspect corruption in your source files causing rotation failures, check out FFmpeg Fails to Process MP4 File Despite VLC Media Player Success for diagnostic steps.

Frequently Asked Questions

Why does my concatenated video appear sideways?

This happens because the rotation information is stored in the metadata header, not in the pixel data itself. When files are joined, the metadata from the first file is often kept, or ignored entirely, leaving the viewer with the original unrotated pixel orientation.

Is transpose=0 the correct filter for 90-degree rotation?

No, transpose=0 rotates 90 degrees counter-clockwise and flips the image vertically. For a standard 90-degree clockwise rotation, use transpose=1.

Can I concatenate videos without re-encoding?

Yes, but you must ensure all videos have identical codecs and parameters. However, note that rotation metadata may not be preserved reliably in all container formats during a lossless concat operation.

How do I check if a video has rotation metadata?

Use the command ffprobe -v error -select_streams v:0 -show_entries stream_tags=rotate -of default=noprint_wrappers=1:nokey=1 input.mp4. If it returns a value like 90, 180, or 270, the video relies on metadata for orientation.

Why does VLC play the video correctly but Chrome does not?

VLC is very permissive and automatically applies rotation metadata. Web browsers often ignore the rotate tag in MP4 files due to HTML5 video specification ambiguities, requiring the rotation to be baked into the pixels via re-encoding.

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