---
title: "ffmpeg: convert and inspect media from the command line"
license: CC0-1.0
license_url: https://creativecommons.org/publicdomain/zero/1.0/
source: https://iinventedlight.com/library/notes/ffmpeg-media-convert.md
upstream_source: https://ffmpeg.org/ffmpeg.html
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
source_license: "FFmpeg docs; restated, not copied"
license_note: "Steps are our own words from a version run on the test PC plus the cited docs; offered under CC0 1.0."
attribution: "How-to by iinventedlight (AI-assisted). Sources listed below."
condensed_by: "iinventedlight (Grok Bot, AI-assisted)"
fact_checked: 2026-10-31
date: 2026-10-31
status: published
category: agent-howto
tags: agent-howto, ffmpeg, media, transcode, cli
checked_on: 2026-10-31
tested_version: "ffmpeg 9.0.2-full_build-www.gyan.dev (Windows 11 PC); convert/streamcopy untested"
sources:
  - id: S1
    title: "ffmpeg Documentation"
    publisher: FFmpeg project
    url: https://ffmpeg.org/ffmpeg.html
    accessed: 2026-10-31
    license: "restated"
  - id: S2
    title: "Windows 11 PC run: ffmpeg -version"
    publisher: iinventedlight test PC
    url: local run, 2026-10-31
    accessed: 2026-10-31
    license: "CC0 1.0 (our own observation)"
    result: "ffmpeg version 9.0.2-full_build-www.gyan.dev Copyright (c) 2000-2026 the FFmpeg developers"
---
# ffmpeg: convert and inspect media from the command line

> **Partly tested:** only `ffmpeg -version` was run (ffmpeg 9.0.2, Windows 11, 2026-10-31). The convert and transcode steps are untested and restated from the cited docs.

## Summary
`ffmpeg` reads inputs (`-i`) and writes outputs. Prefer streamcopy (`-c copy`) when you only need a different container; transcode only when a filter or codec change is required [S1].

## Agent access
- CLI: yes (`ffmpeg`, plus `ffprobe` in a full build). MCP connector: none connected. API: libav* libraries. GUI: optional front-ends, not needed.
- Best route: CLI.
- Permissions: local filesystem. Network URLs as `-i` need network. Overwrite needs `-y` [S1].

## Steps
1. Version (**tested 2026-10-31 on the test PC**): `ffmpeg -version` printed `ffmpeg version 9.0.2-full_build-www.gyan.dev Copyright (c) 2000-2026 the FFmpeg developers` [F1][S2].
2. Convert container without re-encode (**untested**): `ffmpeg -i input.mkv -map 0:1 -c copy output.mp4` [S1].
3. Transcode video, copy audio (**untested**): `ffmpeg -i INPUT.mkv -map 0:v -map 0:a -c:v libx264 -c:a copy OUTPUT.mp4` [S1].
4. Do not overwrite by accident: default asks; scripts use `-n` to refuse existing outputs, or `-y` only when replacing is intended [S1].
5. Quiet logs in scripts: `-hide_banner` (and `-loglevel error` when you only want failures) [S1].

## Traps
- Options apply to the **next** file; put all inputs first, then outputs [S1].
- Argument order matters for `-ss`/`-t` (input vs output) and for maps [S1].
- Without `-c copy`, audio/video/subtitles are transcoded with the muxer's default encoder [S1].
- Automatic stream selection picks one video (highest resolution), one audio (most channels), and may skip data/attachments unless `-map` is used [S1].
- Do not run GPU encodes (`nvenc` / CUDA) on a shared machine while another job is using the GPU.

## What worked looks like
Version line starts with `ffmpeg version 9.0.2-full_build-www.gyan.dev`. A convert job (untested here) would exit 0 and write the named output.

## Facts
- id: F1
  claim: ffmpeg -version on the test PC on 2026-10-31 printed "ffmpeg version 9.0.2-full_build-www.gyan.dev Copyright (c) 2000-2026 the FFmpeg developers".
  confidence: high
  date: 2026-10-31
  sources: [S2]
  license: CC0 1.0
  checked_on: 2026-10-31
- id: F2
  claim: ffmpeg -c copy copies packets without decoding or encoding (streamcopy).
  confidence: high
  date: 2026-10-31
  sources: [S1]
  license: CC0 1.0
  checked_on: 2026-10-31
