FFmpeg Map Metadata Not Working: A Guide for Tech Support

Abstract: Resolve missing cover art in FFmpeg MP4 conversions by explicitly mapping MJPEG image streams using the -map flag.

Created: 2026-10-23 by
When FFmpeg fails to map metadata correctly during video conversion, the issue usually stems from improper stream selection or conflicting codec instructions. By explicitly defining which streams carry audio, video, and picture data using the -map flag, you can ensure that cover art and other metadata are preserved accurately in the output file without corruption or loss.

Understanding the Metadata Mapping Problem

Many users encounter situations where their converted videos lack embedded cover art or possess incorrect metadata tags. This often happens when converting formats like MKV to MP4, especially when the source contains a high-resolution image stored as an MJPEG stream alongside standard video and audio tracks. The default behavior of FFmpeg may not automatically select the correct streams for inclusion in the final container, leading to missing visual elements or playback issues on certain devices. To resolve this, it is crucial to understand how FFmpeg identifies streams. Each input file has numbered streams (0:0, 0:1, etc.), and without explicit mapping, FFmpeg might pick the wrong video stream or ignore the image stream entirely. This is particularly common when dealing with complex inputs that contain multiple video tracks, subtitle streams, or data streams. Properly identifying these streams is the first step toward fixing the metadata issue. For more context on general FFmpeg conversion challenges, you might find our guide on Troubleshooting FFmpeg: Why isn't 'ffmpeg -i input.mkv -c:copy output.mp4' working? helpful, as it covers similar stream copying pitfalls.

Identifying Stream Positions

Before constructing your command, you must determine the exact position of each stream within your input file. Use the following command to inspect the input:
ffmpeg -i input.mkv
Look for lines indicating stream types. For example, you might see something like:
  • Stream #0:0: Video: h264 (High) — Main video content
  • Stream #0:1: Audio: aac — Audio track
  • Stream #0:2: Video: mjpeg (Baseline) — Cover art/picture
In this scenario, the main video is at index 0, audio at 1, and the cover art image at 2. Note that FFmpeg counts streams starting from 0. If you want to preserve the cover art, you must explicitly include stream 2 in your output mapping. Failing to do so results in the image being dropped from the final MP4 file.

Constructing the Correct Map Command

The solution lies in using the -map option to selectively choose which streams to copy. You should also use -c:v copy and -c:a copy to avoid re-encoding, which preserves quality and speeds up processing. However, simply copying all streams might not work if there are conflicts or unwanted data streams. Here is the recommended command structure:
ffmpeg -i input.mkv -map 0:0 -map 0:1 -map 0:2 -c:v copy -c:a copy output.mp4
Let's break down what each part does:
  • -map 0:0: Selects the first video stream (main content).
  • -map 0:1: Selects the audio stream.
  • -map 0:2: Selects the second video stream, which holds the MJPEG cover art.
  • -c:v copy: Copies the video bitstream without re-encoding.
  • -c:a copy: Copies the audio bitstream without re-encoding.
By explicitly mapping each stream, you guarantee that FFmpeg includes the cover art in the output. If you omit -map 0:2, the image will not appear in players that rely on embedded pictures for display.

Handling Multiple Audio or Subtitle Tracks

If your file contains additional audio languages or subtitles, you may need to map them as well. For instance, to include a second audio track, you would add -map 0:3. It is important to verify the stream indices again, as adding new streams shifts subsequent numbers. Always run ffmpeg -i input.mkv before finalizing your command to ensure accuracy. For related troubleshooting on stream handling, see our article on How to Convert Videos to Play on iPhone Using FFmpeg on Linux, which discusses device-specific compatibility.

Verifying the Output

After running the command, verify that the metadata was successfully mapped. Use the following command to check the output file:
ffprobe output.mp4
Look for the presence of both the H.264 video stream and the MJPEG image stream. If both are present, the cover art should now display correctly in media players like VLC, iTunes, or web browsers. If the image is still missing, double-check that the input stream was indeed MJPEG and that no errors occurred during the mapping process.

Common Pitfalls and Best Practices

One common mistake is assuming that FFmpeg will auto-detect the best streams. While it often does, complex files with multiple video tracks can confuse the auto-selection logic. Always be explicit with -map when precision is required. Another pitfall is forgetting that some containers, like MP4, have specific limitations on supported codecs. Ensure that your cover art codec (usually JPEG or PNG) is compatible with the target container. Additionally, avoid using global options like -map_metadata unless you specifically need to manipulate metadata tags rather than stream content. In most cases, simply mapping the correct streams is sufficient for preserving embedded images.

Frequently Asked Questions

Why does my video play but show no cover art?

This occurs because the image stream was not included in the output file. FFmpeg defaults to selecting only one video stream, often ignoring embedded pictures. You must use -map to explicitly include the image stream index in your command.

Can I re-encode the cover art instead of copying it?

Yes, but it is unnecessary and reduces quality. Since cover art is typically static, copying the existing MJPEG or PNG stream is faster and preserves the original resolution. Re-encoding adds CPU load without visual benefit.

What if I have multiple audio tracks?

You can map additional audio streams by adding more -map arguments, such as -map 0:1 and -map 0:3. Check ffprobe output to identify the correct indices for each language track you wish to include.

Does this method work for WebM outputs?

No, WebM generally does not support embedded image streams in the same way MP4 does. For WebM, you may need to extract the image separately or use different metadata methods. Stick to MP4 or MKV for embedding cover art reliably.

How do I remove unwanted streams from the output?

Simply do not include them in your -map list. FFmpeg will only output streams that are explicitly mapped. Omitting an index ensures it is excluded from the final file, reducing file size and complexity.

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