FFmpeg PGS Extraction Guide
How to Extract PGS Subtitles from MKV with FFmpeg
Use FFmpeg to identify and extract an image-based PGS subtitle track from an MKV file without re-encoding it. The selected stream is commonly saved as a .sup file. FFmpeg performs the extraction only. Converting the subtitle images into editable SRT text requires a separate OCR step.
Use this only after confirming that the first subtitle stream is the PGS track you want.
ffmpeg -i input.mkv -map 0:s:0 -c:s copy output.sup The 0:s:0 selector chooses the first subtitle stream, which may not always be PGS. Run ffmpeg -i input.mkv first, identify the HDMV PGS stream, and adjust the mapping when necessary. FFmpeg only extracts the subtitle stream. It does not perform OCR.
FFmpeg extracts the PGS subtitle stream but does not perform OCR. Upload output.sup to the converter to recognize the subtitle images and create an editable SRT file.
FFmpeg PGS Extraction Workflow
Identify the correct PGS track, extract it as a SUP file, and then use OCR to create and review the SRT.
- 01 Identify the PGS Track
Inspect the MKV and locate the
hdmv_pgs_subtitlestream. - 02 Extract PGS as SUP
Copy the selected stream without re-encoding.
- 03 Convert SUP with OCR
Recognize the subtitle images as editable text.
- 04 Review and Save SRT
Correct OCR errors and verify the timing.
Before You Start
- MKV or compatible source containing an embedded PGS subtitle track.
- Current FFmpeg build with FFprobe.
- Read access to the source file.
- Write access and sufficient storage for the SUP output.
- Permission to process the media and subtitle track.
If FFmpeg is not installed, download FFmpeg from the official website. The official FFmpeg documentation explains input files, mapping and stream copy behavior.
These instructions explain subtitle extraction from accessible media files. They do not provide instructions for bypassing access controls.
Identify the PGS Subtitle Track
Inspect the file before extraction. The first subtitle stream may not be PGS, several tracks may share the same language, and a file can contain full, forced, SDH and commentary subtitles. Language metadata can also be missing or inaccurate. A text subtitle track should not be extracted into a .sup filename.
Inspect Streams with FFmpeg
Run FFmpeg without an output file to inspect the input streams:
ffmpeg -i input.mkv Representative output may look like this:
Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle
Stream #0:3(spa): Subtitle: hdmv_pgs_subtitle In this example, 0:2 and 0:3 are absolute stream indexes. The eng and spa values are language tags when present. The hdmv_pgs_subtitle codec label identifies PGS subtitle images. These values are examples and must not be copied without inspecting your own file.
Inspect Subtitle Metadata with FFprobe
The official FFprobe documentation covers stream inspection. This cross-platform command lists subtitle indexes, codec names and language/title metadata without requiring grep:
ffprobe -v error -select_streams s -show_entries stream=index,codec_name:stream_tags=language,title -of default=noprint_wrappers=1 input.mkv index=2
codec_name=hdmv_pgs_subtitle
TAG:language=eng
TAG:title=English PGS | Field | What it tells you |
|---|---|
index | The absolute stream index used with selectors such as 0:3. |
codec_name | The subtitle codec. For Blu-ray PGS, look for hdmv_pgs_subtitle. |
TAG:language | A language tag when the source provides one. It may be missing or incorrect. |
TAG:title | An optional track title that may describe full, forced, SDH or commentary content. |
Confirm the PGS Codec Label
hdmv_pgs_subtitle is FFmpeg's codec label for image-based Blu-ray PGS subtitles. It confirms that the selected stream contains PGS subtitle images rather than ordinary text captions. For more background, read how PGS subtitles work.
Extract PGS as SUP with FFmpeg
Use a Relative Subtitle Selector
ffmpeg -i input.mkv -map 0:s:0 -c:s copy output.sup | Command part | Meaning |
|---|---|
-i input.mkv | Opens the MKV source. |
-map 0:s:0 | Selects the first subtitle stream from input 0. |
-c:s copy | Copies the subtitle stream without subtitle re-encoding. |
output.sup | Writes the selected PGS stream to a standalone SUP file. |
This selects the first subtitle stream, not automatically the first PGS stream. Confirm that the selected stream is labelled hdmv_pgs_subtitle.
Use an Absolute Stream Index
If inspection shows this example stream:
Stream #0:3: Subtitle: hdmv_pgs_subtitle Use this example command after replacing the stream index with the one from your file:
ffmpeg -i input.mkv -map 0:3 -c:s copy English-PGS.sup The 0:3 value is only an example. The first number identifies the input. The second identifies the absolute stream index. Your actual stream number must come from your inspection output.
Relative and Absolute Selectors Compared
| Selector | Meaning | Use when |
|---|---|---|
0:3 | Absolute stream 3 from input 0. | You confirmed the exact stream index. |
0:s:0 | First subtitle stream from input 0. | You confirmed the first subtitle stream is PGS. |
0:s:1 | Second subtitle stream from input 0. | You confirmed the second subtitle stream is the desired PGS track. |
These selector styles are not interchangeable. The FFmpeg stream mapping guide is a useful practical reference after you understand the inspected stream list.
Windows, macOS and Linux Commands
The core FFmpeg syntax is the same across supported operating systems, but file paths and shell quoting differ. Quote paths containing spaces, replace 0:3 with the inspected PGS stream, and treat file paths as examples.
Windows PowerShell
ffmpeg -i "C:\Videos\Movie File.mkv" -map 0:3 -c:s copy "C:\Videos\English-PGS.sup" If Windows reports ffmpeg is not recognized, FFmpeg is not installed or its executable directory is not available through PATH. Install FFmpeg from a trusted source or use the correct executable path.
macOS and Linux
ffmpeg -i "/path/to/Movie File.mkv" -map 0:3 -c:s copy "/path/to/English-PGS.sup" File paths can be case-sensitive on macOS and Linux. Do not add distribution-specific package-manager commands unless you are following current instructions from a trusted source.
What the Extracted SUP File Contains
The output SUP file carries the selected PGS subtitle data, including subtitle images and timing information from the stream. It does not contain editable dialogue text. Renaming output.sup to output.srt does not convert the format; OCR is still required.
Stream copy preserves the selected subtitle stream without OCR or subtitle-image re-encoding.
Verify the Extracted SUP File
- Confirm FFmpeg completed without a fatal error.
- Confirm the output exists and is not empty.
- Optionally inspect the opening bytes.
- Preview or process the track to confirm actual content.
On Linux and macOS, you can inspect the file size with:
ls -lh output.sup Windows users can inspect file properties. Do not rely on a fixed valid size because a short or forced subtitle track can be small.
On Linux and macOS, this optional sanity check inspects the beginning of the file:
xxd -l 16 output.sup A typical PGS SUP stream commonly begins with a PG packet signature. This can confirm that the file resembles PGS data, but it cannot prove that the correct language, full/forced track or complete subtitle content was extracted.
Once the SUP file is verified, it is ready for OCR conversion.
Convert the Extracted SUP File to SRT
After extraction, the SUP file still contains subtitle images. Open the SUP to SRT converter, select the language shown in the subtitles, run OCR and review the recognized text before downloading the SRT.
- Open the SUP to SRT converter.
- Select the extracted
.supfile. - Choose the language shown in the subtitle images.
- Select an appropriate OCR profile.
- Start conversion.
- Review names, punctuation and uncertain characters.
- Download and test the SRT.
Extracting Forced PGS Subtitles
Forced captions often cover foreign-language dialogue, signs or essential translations. They may exist as a separate track, or they may be flagged within a larger track. Several tracks may share the same language, and language metadata alone does not reliably identify a forced track.
- Inspect language, title, default and forced metadata.
- Treat metadata as a clue rather than proof.
- Extract plausible tracks to different filenames.
- Preview or OCR each track.
- Keep the track matching the desired content.
File size can be a clue, but it is not proof. FFmpeg stream copy preserves the selected stream but does not decide which captions are semantically forced.
Common FFmpeg Errors and Solutions
ffmpeg: command not found or ffmpeg is not recognized
FFmpeg may not be installed, the executable may not be in PATH, or the terminal may need to be reopened after installation. Verify the install or use the full executable path.
Output format not recognized
Possible causes include selecting a non-PGS stream, using an output extension that does not match the selected codec, choosing the wrong stream index, or using an FFmpeg build that cannot determine the output format from the filename.
- Inspect the streams again.
- Confirm the selected stream is
hdmv_pgs_subtitle. - Confirm the stream index.
- Use stream copy.
- Add explicit SUP format only when needed.
ffmpeg -i input.mkv -map 0:3 -c:s copy -f sup output.sup The 0:3 selector is only an example. Explicit -f sup is a fallback when normal format detection from the output name does not work as expected. It does not fix a wrong source stream.
The SUP file is empty
The wrong stream may have been selected, the source may be damaged or unusual, the mapping may be incorrect, the track may have little or no subtitle content, or FFmpeg may have ended with an error. OCR has not started at this stage, so OCR is not the cause of an extraction failure.
The wrong language was extracted
Check the absolute stream index, relative subtitle index, language tag, track title, forced/default metadata and other PGS tracks.
Several tracks use the same language
They may represent full subtitles, forced captions, SDH captions, commentary or alternate translations. Select and test deliberately.
Permission denied or cannot write output
Choose a writable output folder, quote paths containing spaces, confirm the source is readable and make sure another application is not locking the destination file.
The SUP file converts poorly with OCR
Extraction can be correct while OCR still struggles. Recheck the subtitle language, try a more accurate OCR profile and manually review names, accents, punctuation and similar-looking characters.
Why the FFmpeg output is SUP instead of SRT
This is expected. PGS subtitles are images. FFmpeg can extract the image-based stream but cannot recognize the words inside it. OCR is required to create SRT text.
Frequently Asked Questions
Can FFmpeg convert PGS or SUP directly to SRT?
No. FFmpeg can identify and extract the image based PGS stream, but OCR is required to recognize the images as editable text and create SRT.
What does hdmv_pgs_subtitle mean in FFmpeg output?
It is FFmpeg's codec label for image based Blu-ray PGS subtitles. A stream with this codec can commonly be extracted to a standalone SUP file.
How do I identify the correct PGS stream?
Inspect subtitle streams with FFmpeg or FFprobe. Confirm the codec is hdmv_pgs_subtitle, then compare language, title and forced/default metadata before selecting the stream.
What is the difference between 0:3 and 0:s:0?
0:3 is an absolute stream index. 0:s:0 means the first subtitle stream from the first input. They may point to the same stream in some files, but this is not guaranteed.
Why is my extracted SUP file empty?
The wrong stream may have been selected, the track may contain little content, or FFmpeg may have reported an extraction error. Inspect the input and command output again.
Can FFmpeg extract forced subtitles only?
Forced subtitles may be stored separately or flagged within a larger PGS track. FFmpeg can copy a selected stream, but the exact forced-caption workflow depends on how the source stores and flags those captions.
Can FFmpeg extract several PGS tracks at once?
Multiple tracks can be processed, but each verified PGS stream should be mapped to an appropriate explicit output. Do not assume every subtitle stream is PGS or use an unverified filename-pattern command.
Is FFmpeg required if I already have a SUP file?
No. If the PGS subtitle is already available as a standalone SUP file, open the homepage converter directly.
Why can I not rename SUP to SRT?
SUP contains subtitle images, while SRT contains text and timestamps. Renaming the extension does not perform OCR or change the data format.
Do the commands work on Windows, macOS and Linux?
The core FFmpeg commands work across supported operating systems. File paths, installation methods and shell quoting may differ.
Ready to Convert the Extracted SUP File?
Upload the SUP file, select the subtitle language, run OCR and review the generated SRT before using it.
Open the SUP to SRT Converter