Skip to content

How to Fix FFmpeg Subtitle Errors

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about How to Fix FFmpeg Subtitle Errors. We cover key concepts, practical examples, and best practices.

The Problem

FFmpeg fails to process subtitles with Subtitle encoding not supported, Fontconfig error: Cannot find default font, or Bitmap subtitles not supported by this muxer. Subtitles are either missing, garbled, or incorrectly formatted in the output.

Quick Fix

Fix 1: Bitmap Subtitles (PGS/DVD) Not Supported

WRONG — copying bitmap subtitles to output:

ffmpeg -i input.mkv -c copy output.mp4
# Could not write codec 'hdmv_pgs_subtitle': Bitmap subtitles codec not supported by muxer

RIGHT — remove the subtitle stream or convert to text:

# Remove subtitles:
ffmpeg -i input.mkv -c copy -sn output.mp4

# Convert to text-based (if SRT):
ffmpeg -i input.mkv -c:v copy -c:a copy -c:s mov_text output.mp4

Fix 2: Subtitle Encoding Issues (Corrupted Text)

ffmpeg -i input.mkv -c:s srt output.srt
# (output contains garbled characters)

RIGHT — specify the correct encoding:

ffmpeg -sub_charenc UTF-8 -i input.mkv -c:s srt output.srt
# (explicitly set UTF-8 encoding)

# For other encodings:
ffmpeg -sub_charenc CP1252 -i input.mkv -c:s srt output.srt

Fix 3: Hardcoding Subtitles (Burn-in)

ffmpeg -i input.mp4 -vf "subtitles=subtitles.srt" output.mp4

WRONG — fontconfig error:

# Fontconfig error: Cannot find default font

RIGHT — specify the font path:

ffmpeg -i input.mp4 -vf "subtitles=subtitles.srt:fontsdir=/usr/share/fonts" \
    -c:v libx264 -c:a aac output.mp4

Or use ass format with a font:

ffmpeg -i input.mp4 -vf "ass=subtitles.ass" output.mp4

Fix 4: Extract Subtitles

# Extract all subtitle streams:
ffmpeg -i input.mkv -map 0:s:0 subtitles.srt

WRONG — extracting from a format without text subtitles:

ffmpeg -i input.mkv -map 0:s:0 output.srt
# (if the subtitle stream is PGS/binary, the output is corrupted)

RIGHT — check the subtitle codec first:

ffprobe input.mkv -show_streams -select_streams s
# Check codec_name: subrip (text), hdmv_pgs_subtitle (bitmap)
# For bitmap subtitles, OCR is needed:

Fix 5: OCR Bitmap Subtitles to Text

# Extract as SUP, then OCR:
ffmpeg -i input.mkv -map 0:s:0 subs.sup

Then use subtitleedit (not FFmpeg) for OCR.

Fix 6: Multiple Subtitle Streams

ffmpeg -i input.mkv -map 0:v -map 0:a -map 0:s:1 -c copy output.mkv
# (keeps only the second subtitle stream)

Use DodaTech's Subtitle Manager to extract, convert, and synchronize subtitles across multiple video files.

Prevention

  • Check subtitle codec type with ffprobe before extracting.
  • Use -sn to strip subtitles when not needed.
  • Use -c:s mov_text for MP4 output, -c:s srt for MKV.
  • Specify font path for hardcoded subtitles.
  • Use the ass format for styled subtitles.

Common Mistakes with subtitle error

  1. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  2. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  3. Using return to exit a function early instead of wrapping a pure value in the monad

These mistakes appear frequently in real-world FFMPEG code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What subtitle formats does FFmpeg support for output?

Common output formats: mov_text (MP4), srt (SubRip), ass (Advanced SubStation Alpha), webvtt (WebVTT). For MKV, FFmpeg can copy most subtitle formats. For MP4, only mov_text (timed text) is supported.

How do I change subtitle colors or position?

Use the ASS subtitle format which supports styling (fonts, colors, position). Create an ASS file with the desired style, then burn it in: ffmpeg -i video.mp4 -vf "ass=styled.ass" output.mp4.

Why does my player show "No subtitle" during playback?

The subtitle stream may not be selected by default. In the player, manually select the subtitle track. Ensure the subtitle codec is supported by the player — some players do not support PGS or HDMV subtitles.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro