You are here:Home»KB»Media»My FFmpeg Notes
Tuesday, 26 August 2025 12:40

My FFmpeg Notes

Written by

A collection of my FFmpeg notes

Downloading the Windows Binaries

Getting the right version can be tricky unless you know what file to download and why, but that is easy to explain.

TL;DR

Static vs. Shared Builds

In general, when you compile a binary, you may prefer to include its dependencies (Static) so that users don't need to search for external dlls aftermath, or try to use the executable with an incompatible version of the dll, but it means that the same dll will have to be present in all executables that need them, so that the whole software will use more room on the HD. Shared versions are likely to save some space, but I presume they are not significantly faster than others. It is useful just to explain the difference between the two compiling types.

  • Static build (essentials, full):
    • The .exe (on Windows) or binary contains all libraries compiled inside it.
    • Easier to use — you just download, extract, and run ffmpeg.exe.
    • Bigger file size, less flexible if you want to swap/update libraries individually.
    • Each binary has the required libraries and DLLs compiled in, each binary is therefore self contained and needs nothing else to run.
    • All components and libraries reside in the EXE file. So, it is self-contained.
  • Shared build (full shared):
    • The binary depends on separate .dll (on Windows) or .so (on Linux) library files.
    • The main ffmpeg.exe is smaller, but it requires those external files to run.
    • More modular: you can update or replace individual codec libraries without rebuilding FFmpeg.
    • Useful for developers embedding FFmpeg into other applications.
    • Less portable: you can’t just copy ffmpeg.exe alone to another PC — you also need all the matching DLLs.
    • Each ffmpeg library resides in a separate DLL, and the ffmpeg binaries (ffmpeg.exe ..etc) link to these libraries i.e. locate and access their capabilities only during execution. However, 3rd party libs are statically linked with the corresponding ffmpeg lib.e.g. libx264 resides inside avcodec.dll
    • The DLLs should be in your path or same folder as the EXE. Saves space but if you have multiple av*.dll in your path, due to older versions or other builds, that is liable to create problems.
    • Shared "shares" the DLLs and libraries between ffmpeg, ffprobe and ffplay.
    • You’ll usually see several folders:
      • bin\ → contains ffmpeg.exe, ffplay.exe, ffprobe.exe, and .dll files.
      • lib\ → contains development libraries (.a, .lib) for compiling against FFmpeg.
      • include\ → header files for developers.

What Version of FFmpeg should I download?

  • Essentials
    • Use case: Support features in a program like Krita or Blender
    • A minimal build of FFmpeg that includes the most widely used codecs and features.
    • Includes:
      • Common encoders/decoders like H.264 (via libx264), AAC, MP3, VP9, etc.
      • Basic formats and filters needed for everyday media conversion.
  • Full
    • Use case: Just converting media for personal use?
    • All formats, filters, encoders and decoders are included.
  • Full Shared
    • Use case: Developing software or need modular updates.
    • Same functionality as "Full"
    • Do not use this version if you are not a software developer, otherwise you may encounter missing xxx.dll errors.

How to get the latest build for Windows

Links

 

 

 

 

Repairing Media Files

You’ve got an AEA audio file (Sony ATRAC encapsulation, usually .aea), and while VLC can play it, MKVToolNix won’t accept it — which strongly suggests that the container header is damaged or malformed, even if the raw audio stream is intact. Here are some free/open-source tools and workflows you can try to “repair” or rewrap it into something MKVToolNix will accept:

1. FFmpeg (best first try)

  • FFmpeg is usually the most effective way to “rewrap” or re-encode damaged media.
  • Since VLC can play it, FFmpeg should also be able to read it.

Try first a straight rewrap (no re-encoding):

ffmpeg -i input.aea -c copy output.wav

or

ffmpeg -i input.aea -c copy output.mka

If the header is corrupt, FFmpeg might still balk. In that case, force stream copy with re-indexing:

ffmpeg -err_detect ignore_err -i input.aea -c copy fixed.mka

If that still doesn’t work, do a lossless re-encode to WAV (PCM):

ffmpeg -i input.aea -c:a pcm_s16le output.wav

Once you have a WAV/FLAC/MKA, MKVToolNix should accept it.

2. SoX (Sound eXchange)

  • Another open-source audio utility, great at handling raw audio.
  • If FFmpeg struggles, you can try:
sox input.aea output.wav

3. Audacity (GUI method)

  • Free, open-source audio editor.
  • Import the .aea into Audacity (it uses FFmpeg under the hood), then export as WAV/FLAC.
  • This bypasses container issues and ensures you get a clean audio file.

4. Re-mux with mkvmerge directly

  • Sometimes MKVToolNix GUI rejects files that mkvmerge (the CLI tool) can still handle.
    Try:
mkvmerge -o output.mkv --no-video input.aea

My recommendation: Start with FFmpeg (method 1). If -c copy fails, re-encode to WAV/FLAC and then mux that into MKV. Do you want me to give you a one-liner FFmpeg command that will automatically fix/dump to WAV even if the header is bad, so you can drag it straight into MKVToolNix? you want to keep the original audio stream untouched (no re-encoding). That means we need to focus on remuxing/repairing the container only.

1. FFmpeg (copy mode, no re-encode)

This is the safest first step:

ffmpeg -i input.aea -c copy output.mka
  • -c copy = stream copy (no re-encoding).
  • mka (Matroska Audio) is usually well-accepted by MKVToolNix.

If the header is damaged, you can try forcing FFmpeg to ignore errors:

ffmpeg -err_detect ignore_err -i input.aea -c copy fixed.mka

2. Try mkvmerge directly

Even if MKVToolNix GUI rejects it, the CLI might succeed:

mkvmerge -o output.mka input.aea

or

mkvmerge -o output.mkv --no-video input.aea

3. Container rewrap (raw stream copy)

If FFmpeg can demux the stream but not mux it properly, you could dump the raw stream first:

ffmpeg -i input.aea -c copy output.oma

(.oma is another ATRAC container Sony used; Matroska often accepts it better.)
Then try adding output.oma into MKVToolNix. If all copy-only methods fail, the problem may be that the damaged AEA header prevents FFmpeg from identifying the stream type. In that case, we’d need to manually specify the codec during remuxing (still without re-encoding). Do you want me to write you an FFmpeg command that forces the codec identification (e.g., ATRAC3/ATRAC9) so it can copy the stream even if the header is broken? Perfect ? If the AEA header is damaged, FFmpeg may fail to guess the codec, but you can force it to treat the stream as ATRAC and just remux without re-encoding.

1. Identify the codec

Run:

ffmpeg -i input.aea
  • Even if it errors out, FFmpeg usually prints something like:
    Stream #0:0: Audio: atrac3 (or atrac3plus / atrac9), 44100 Hz, stereo

Note the codec name (likely atrac3 or atrac3plus).

2. Force remux with codec copy

Once you know the codec, run:

ffmpeg -f aea -i input.aea -c:a copy -map 0 output.mka

 

  • -f aea → forces FFmpeg to read as AEA format.
  • -c:a copy → copies the stream without re-encoding.
  • -map 0 → ensures all streams are included.
  • output.mka → Matroska Audio container, friendly for MKVToolNix.

 

3. If FFmpeg still fails to guess properly

You can force the codec by specifying it:

ffmpeg -f aea -i input.aea -c:a copy -acodec atrac3 fixed.mka

(or -acodec atrac3plus depending on what you saw in step 1).   This way, you keep the original audio untouched, just rewrapped into .mka so MKVToolNix can accept it.

Do you want me to also show you how to probe the file with ffprobe to be 100% sure which ATRAC variant you’ve got before running the copy?

 


what is ffprobe ffprobe is a companion tool to FFmpeg.

  • Where ffmpeg converts or remuxes media,
  • ffprobe analyzes media and prints detailed info about streams, codecs, metadata, bitrates, etc.

It’s included automatically when you install FFmpeg (same download).

Example usage

ffprobe input.aea

You’ll see output something like:

Input #0, aea, from 'input.aea':
  Duration: 00:04:21.00, bitrate: 132 kb/s
  Stream #0:0: Audio: atrac3, 44100 Hz, stereo, fltp

That tells you:

  • Container format (aea)
  • Codec (atrac3 / atrac3plus / atrac9)
  • Sample rate, channels, etc.

Why it’s useful here

Since your AEA header may be broken, ffmpeg -i input.aea or ffprobe input.aea will tell us:

  • If FFmpeg can still detect the codec
  • Which exact ATRAC variant you have
  • What flags we need to use for a clean stream copy into .mka

  Do you want me to give you a ready-to-run command that uses ffprobe to print just the codec name (so you don’t have to scan through a big text output)? what is the difference between ffprobe and ffpmeg -i Great question ? — they look similar, but there are some important differences between ffmpeg -i and ffprobe:

? ffmpeg -i input.ext

  • ffmpeg is mainly a converter/remuxer.
  • When you run it with just -i, it:
    • Prints some stream info to the console (container, codec, bitrate, channels, etc.).
    • Then usually errors out because you didn’t tell it what to output.
  • The printed info is meant for humans (not machine-readable).

Example:

ffmpeg -i input.aea

Output:

Input #0, aea, from 'input.aea':
  Duration: 00:04:21.00, bitrate: 132 kb/s
  Stream #0:0: Audio: atrac3, 44100 Hz, stereo, fltp

? ffprobe input.ext

  • ffprobe is dedicated to analysis only.
  • It never tries to convert or output media — it just inspects it.
  • It can print:
    • The same human-readable info as ffmpeg -i
    • Or structured machine-readable output (JSON, XML, etc.)

Example (human-readable):

ffprobe input.aea

Example (just codec name in JSON):

ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 input.aea

Output:

atrac3

In short:

  • ffmpeg -i → Quick check, human-readable, but “side effect” is that it looks like an error run.
  • ffprobe → Purpose-built for inspecting files, can give clean codec info and more detailed technical metadata.

   



  Convert AEA to FLAC  from the wiki that the rest are based on

for f in *.aea; do ffmpeg -i "$f" -vn -hide_banner -c:a flac -sample_fmt s16 -ar 44100 "${f%.aea}.flac"; done

Your Linux command loops through all *.aea files in the current folder and converts them to FLAC using ffmpeg. On Windows (cmd.exe) you can write it like this:

for %%f in (*.aea) do ffmpeg -i "%%f" -vn -hide_banner -c:a flac -sample_fmt s16 -ar 44100 "%%~nf.flac"

Notes:

  • If you run this directly in a batch file (.bat), keep the double %%f.
  • If you run it directly in the command prompt, use a single %f:
for %f in (*.aea) do ffmpeg -i "%f" -vn -hide_banner -c:a flac -sample_fmt s16 -ar 44100 "%~nf.flac"

Do you want me to also give you the PowerShell version (nicer syntax, supports Unicode filenames better), or will you run this in cmd.exe? Here’s the PowerShell version of your loop:

Get-ChildItem *.aea | ForEach-Object {
    ffmpeg -i $_.FullName -vn -hide_banner -c:a flac -sample_fmt s16 -ar 44100 "$($_.BaseName).flac"
}

Explanation:

  • Get-ChildItem *.aea → gets all .aea files in the folder.
  • $_ → represents each file object.
  • $.FullName → full path to the file.
  • $.BaseName → filename without extension (so output becomes filename.flac).

⚡ Advantage: PowerShell handles spaces and special characters in filenames much more gracefully than cmd.exe.

Do you want me to also make a ready-to-run .ps1 script that you can drop into your folder and double-click/run, or will you paste it directly into the PowerShell terminal?

Here’s a ready-to-run PowerShell script (batch file) you can save as Convert-AEA.ps1 in the same folder as your .aea files:

# Convert-AEA.ps1
# Converts all .aea files in the current folder to FLAC (16-bit, 44.1kHz)

# Get all .aea files in this folder
Get-ChildItem -Filter *.aea | ForEach-Object {
    $inputFile = $_.FullName
    $outputFile = "$($_.BaseName).flac"

    Write-Host "Converting $($_.Name) -> $outputFile"
    ffmpeg -i "$inputFile" -vn -hide_banner -c:a flac -sample_fmt s16 -ar 44100 "$outputFile"
}

How to use it

  1. Open Notepad, paste the script above, and save it as Convert-AEA.ps1 in your folder with the .aea files.
    (Make sure the file extension is .ps1, not .txt.)
  2. Open PowerShell in that folder.
  3. If scripts aren’t allowed yet, run this once to enable them:
    Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
  4. Run the script:
    .\Convert-AEA.ps1

Same loop as the first script, just expanded with variables and messages so it’s easier to read and debug.

 

Got it ✅ Here’s the PowerShell script version (Batch file) that will scan the current folder and all subfolders for .aea files, then convert them to .flac while keeping the same folder structure:

# Convert-AEA.ps1
# Recursively converts all .aea files in this folder (and subfolders) to FLAC (16-bit, 44.1kHz)

# Get all .aea files in this folder and subfolders
Get-ChildItem -Filter *.aea -Recurse | ForEach-Object {
    $inputFile  = $_.FullName
    $outputFile = Join-Path $_.DirectoryName "$($_.BaseName).flac"

    Write-Host "Converting $($_.FullName) -> $outputFile"
    ffmpeg -i "$inputFile" -vn -hide_banner -c:a flac -sample_fmt s16 -ar 44100 "$outputFile"
}

How it works

  • -Recurse makes PowerShell go into all subfolders.
  • Join-Path $_.DirectoryName ... ensures each .flac lands in the same folder as the original .aea file.
  • Outputs look like:
    music\track1.aea → music\track1.flac
    music\subfolder\track2.aea → music\subfolder\track2.flac

recursive one-liner (for pasting, and from above)

Get-ChildItem -Filter *.aea -Recurse | ForEach-Object {
    ffmpeg -i $_.FullName -vn -hide_banner -c:a flac -sample_fmt s16 -ar 44100 "$($_.DirectoryName)\$($_.BaseName).flac"
}

Difference from your original:

  • -Recurse → searches subfolders too.
  • "$($_.DirectoryName)\$($_.BaseName).flac" → makes sure the .flac is written into the same folder as the source file (not all dumped into the top folder).

recursive PowerShell one-liner that also skips files already converted:

Get-ChildItem -Filter *.aea -Recurse | ForEach-Object {
    $outFile = Join-Path $_.DirectoryName "$($_.BaseName).flac"
    if (-Not (Test-Path $outFile)) {
        ffmpeg -i $_.FullName -vn -hide_banner -c:a flac -sample_fmt s16 -ar 44100 $outFile
    } else {
        Write-Host "Skipping $($_.FullName) → already exists."
    }
}

How it works:

  • Test-Path $outFile → checks if the .flac already exists.
  • If yes → it prints Skipping…
  • If no → it runs ffmpeg normally.

 


 

 

 

 

 

Read 39 times Last modified on Sunday, 31 August 2025 14:59