How to Keep All Video Metadata with FFmpeg

Abstract: Preserve all video metadata during FFmpeg processing by using -map_metadata and -c copy to prevent data loss.

Created: 2026-08-19 by
To preserve all video metadata when using FFmpeg, you must explicitly instruct the tool to copy existing stream and global metadata rather than relying on default behaviors that often strip this information. The most reliable method involves using the -map_metadata flag combined with -c copy for lossless remuxing or specific codec settings for re-encoding. This ensures that titles, authors, creation dates, and technical headers remain intact throughout your processing workflow without data loss or corruption.

Understanding Default Metadata Behavior

When you run a standard FFmpeg command to convert or edit a video file, the software does not automatically carry over all metadata from the source file to the output. By default, FFmpeg may only copy a subset of metadata fields, such as duration or basic stream information, while discarding descriptive tags like title, artist, comment, or custom user-defined keys. This behavior can be problematic for media libraries, content management systems, or professional workflows where accurate attribution and categorization are critical. For example, if you simply run a conversion command like ffmpeg -i input.mp4 output.mp4, you might notice that the resulting file lacks the original creator's name or the date it was recorded. This is because FFmpeg treats metadata as optional unless explicitly told otherwise. Understanding this default limitation is the first step toward mastering metadata retention in your video processing pipeline.

The -map_metadata Flag Explained

The primary tool for controlling metadata flow in FFmpeg is the -map_metadata option. This flag allows you to specify which metadata from the input files should be written to the output file. It uses an index number to refer to the input file. If you have multiple inputs, you can choose exactly which one’s metadata to keep. To copy all metadata from the first input file to the output, use:
ffmpeg -i input.mp4 -map_metadata 0 output.mp4
Here, 0 refers to the first input file (input.mp4). If you have multiple inputs and want to merge their metadata or select a specific one, you adjust this number accordingly. For instance, -map_metadata 1 would take metadata from the second input file. This level of control prevents accidental overwriting or loss of important tags during complex multi-source operations.

Using -c Copy for Lossless Retention

While -map_metadata handles the tags, the encoding process itself can sometimes interfere with container-level metadata. To ensure maximum compatibility and minimal risk of metadata corruption, it is often best to use stream copying (-c copy) whenever possible. This technique avoids re-encoding the video and audio streams entirely, merely repackaging them into a new container format. When you use -c copy, FFmpeg preserves the exact bitstream, including all embedded metadata, chapters, and subtitles, provided the target container supports these features. A typical command looks like this:
ffmpeg -i input.mov -c copy -map_metadata 0 output.mp4
This approach is significantly faster than re-encoding and guarantees that no generational loss occurs. It is ideal for tasks like format conversion (e.g., MOV to MP4) where the visual and audio quality must remain identical to the source. However, note that some metadata types are container-specific and may not transfer perfectly between different formats even with -c copy.

Handling Global vs. Stream Metadata

Video files contain two main types of metadata: global metadata (applying to the whole file, like title or artist) and stream metadata (applying to specific tracks, like language or codec details). Sometimes, you may need to handle these separately. FFmpeg allows you to map global metadata specifically using -map_metadata 0:g for global and -map_metadata 0:s for stream-specific data. In many cases, using -map_metadata 0 without suffixes copies both global and stream metadata, which is usually what users want. However, if you encounter issues where certain tags are missing, check whether they were stored globally or within a specific stream. You can inspect the metadata of your input file using:
ffprobe -show_streams -show_format input.mp4
This diagnostic step reveals where each piece of information is located, helping you fine-tune your mapping strategy. For most general purposes, sticking to -map_metadata 0 alongside -c copy provides a robust solution for retaining all relevant information.

Related Resources

If you are dealing with advanced bitstream filtering alongside metadata preservation, consider reviewing How to use ffplay with -bsf? for insights into stream manipulation.

For issues related to timestamp synchronization that might affect metadata interpretation, see Fixing the 'ffmpeg -itsoffset is not working' Issue.

Frequently Asked Questions

Does -c copy guarantee all metadata is preserved?

Yes, -c copy preserves the raw bitstream, which includes all container-level metadata. However, if the output format does not support a specific metadata type found in the input, that particular tag will be dropped regardless of the flags used.

How do I remove specific metadata tags instead of keeping them?

You can use the -metadata flag followed by the key-value pair to overwrite or clear specific tags. For example, -metadata title="" will remove the title tag from the output file, overriding any inherited metadata.

Why are my chapter markers missing after conversion?

Chapter markers are often stored as stream metadata or in the container header. Ensure you are using -map_metadata 0 and that the output container format (like MP4 or MKV) supports chapters. Some containers require explicit muxing options to retain chapter data.

Can I add new metadata while keeping existing ones?

FFmpeg does not natively merge metadata sets in a single command easily. You typically need to copy existing metadata first using -map_metadata and then append new tags using additional -metadata flags, though this may override conflicting keys.

What is the difference between -map_metadata 0 and -map_metadata 0:g?

-map_metadata 0 copies both global and stream metadata from the first input. -map_metadata 0:g restricts the operation to only global metadata, ignoring any tags attached to individual video or audio streams.

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