[FFmpeg-user] ffmpeg extract hdmv pgs subtitle from mkv to srt or ssa
Ramon Brea
ramon.brea001 at gmail.com
Sun Jul 19 19:05:22 EEST 2020
I’ve been trying to extract a hdmv pgs subtitle from an mkv file and convert it to a .srt or .ssa file to then use it with a different .mkv file
I am new at this. I’ve been searching the archives for help but don’t find anything useful. Can I get help with the command I’m supposed to put into terminal. I’m using a mac and subtitle extracting options are limited. I’ve also tried using MKVToolnix/mkvextract and vobsub2srt but I get unusable binary code files. I’ve tried converting the .sup binary files but get messed up timing and positioning on the subtitles. I know hdmv pgs subtitles are image based and not text based subtitles and that's what is probably causing the issues or errors. It there a way to extract the subtitle somehow in any format and convert it to a .srt file?
Here is an example of what I’m trying to extract
Input #0, matroska,webm, from ‘FILE PATH':
Metadata:
encoder : libebml v1.3.6 + libmatroska v1.4.9
creation_time : 2018-10-22T23:45:00.000000Z
Duration: 00:23:51.97, start: 0.000000, bitrate: 8538 kb/s
Chapter #0:0: start 0.000000, end 45.045000
Metadata:
title : Chapter 01
Chapter #0:1: start 45.045000, end 135.010000
Metadata:
title : Chapter 02
Chapter #0:2: start 135.010000, end 898.064000
Metadata:
title : Chapter 03
Chapter #0:3: start 898.064000, end 1303.052000
Metadata:
title : Chapter 04
Chapter #0:4: start 1303.052000, end 1393.017000
Metadata:
title : Chapter 05
Chapter #0:5: start 1393.017000, end 1416.081000
Metadata:
title : Chapter 06
Chapter #0:6: start 1416.081000, end 1431.931000
Metadata:
title : Chapter 07
Stream #0:0(eng): Video: hevc (Main 10), yuv420p10le(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
Metadata:
BPS-eng : 4287652
DURATION-eng : 00:23:51.972000000
NUMBER_OF_FRAMES-eng: 34333
NUMBER_OF_BYTES-eng: 767474792
_STATISTICS_WRITING_APP-eng: mkvmerge v28.0.0 ('Voice In My Head') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2018-10-22 23:45:00
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(eng): Audio: truehd, 48000 Hz, 5.1(side), s32 (24 bit) (default)
Metadata:
BPS-eng : 2299565
DURATION-eng : 00:23:51.973000000
NUMBER_OF_FRAMES-eng: 1718367
NUMBER_OF_BYTES-eng: 411614490
_STATISTICS_WRITING_APP-eng: mkvmerge v28.0.0 ('Voice In My Head') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2018-10-22 23:45:00
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:2(jpn): Audio: truehd, 48000 Hz, stereo, s32 (24 bit)
Metadata:
BPS-eng : 837766
DURATION-eng : 00:23:51.973000000
NUMBER_OF_FRAMES-eng: 1718367
NUMBER_OF_BYTES-eng: 149957394
_STATISTICS_WRITING_APP-eng: mkvmerge v28.0.0 ('Voice In My Head') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2018-10-22 23:45:00
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:3(eng): Audio: truehd, 48000 Hz, stereo, s32 (24 bit)
Metadata:
BPS-eng : 911424
DURATION-eng : 00:23:51.973000000
NUMBER_OF_FRAMES-eng: 1718367
NUMBER_OF_BYTES-eng: 163141996
_STATISTICS_WRITING_APP-eng: mkvmerge v28.0.0 ('Voice In My Head') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2018-10-22 23:45:00
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:4(eng): Subtitle: hdmv_pgs_subtitle (default)
Metadata:
title : EngSub1
BPS-eng : 7215
DURATION-eng : 00:22:43.946000000
NUMBER_OF_FRAMES-eng: 96
NUMBER_OF_BYTES-eng: 1230263
_STATISTICS_WRITING_APP-eng: mkvmerge v28.0.0 ('Voice In My Head') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2018-10-22 23:45:00
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:5(eng): Subtitle: hdmv_pgs_subtitle, 1920x1080
Metadata:
title : Dialogue
BPS-eng : 47996
DURATION-eng : 00:23:47.009000000
NUMBER_OF_FRAMES-eng: 769
NUMBER_OF_BYTES-eng: 8561475
_STATISTICS_WRITING_APP-eng: mkvmerge v28.0.0 ('Voice In My Head') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2018-10-22 23:45:00
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
This is the command I’m using in terminal
ffmpeg -i “FILE PATH”.mkv -map 0:4 “OUT PUT NAME”.srt
I’ve tried other command variations as well and get these error messages.
Subtitle encoding currently only possible from text to text or bitmap to bitmap
Could not find codec parameters for stream 4 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize’ options
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
And other errors
Please help. Thanks
More information about the ffmpeg-user
mailing list