ffmpeg extract hdmv pgs subtitle from mkv to srt or ssa

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

ffmpeg extract hdmv pgs subtitle from mkv to srt or ssa

Ramon Brea
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


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg extract hdmv pgs subtitle from mkv to srt or ssa

Carl Zwanzig
On 7/19/2020 9:05 AM, Ramon Brea wrote:
> Please help. Thanks

Please include the complete command line and all of the output. That will help.

(and as a pre-reminder, do not "top post" on this mailing list)

z!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg extract hdmv pgs subtitle from mkv to srt or ssa

Ramon Brea
Sorry, here is the complete command line

Brea@Ramons-MacBook-Pro ~ % ffmpeg -i /Users/Brea/Desktop/Need\ To\ Convert/Video\ Files/Video\ 4\ \(1080p\).mkv -map 0:4 VideoEnglish1.srt
ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.8)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[matroska,webm @ 0x7f993d00be00] 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
Input #0, matroska,webm, from '/Users/Brea/Desktop/Need To Convert/Video Files/Video 4 (1080p).mkv':
  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           : Signs / Songs
      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
Stream mapping:
  Stream #0:4 -> #0:0 (hdmv_pgs_subtitle (pgssub) -> subrip (srt))
Subtitle encoding currently only possible from text to text or bitmap to bitmap
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg extract hdmv pgs subtitle from mkv to srt or ssa

Carl Eugen Hoyos-2
Am So., 19. Juli 2020 um 18:46 Uhr schrieb Ramon Brea <[hidden email]>:

>   Stream #0:4 -> #0:0 (hdmv_pgs_subtitle (pgssub) -> subrip (srt))
> Subtitle encoding currently only possible from text to text or bitmap to bitmap

What is unclear about this error message?

pgssub are bitmap subtitles while srt is a text format.
FFmpeg does not yet support automatic character recognition.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg extract hdmv pgs subtitle from mkv to srt or ssa

Ramon Brea
I’ve also tried extracting the subtitle in it’s original form (HDMV_PGS) but don’t know how to input the command to even get the subtitle extracted. Any ideas? Thanks
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg extract hdmv pgs subtitle from mkv to srt or ssa

Gema Grueso
El lun., 20 jul. 2020 a las 3:57, Ramon Brea (<[hidden email]>)
escribió:

> I’ve also tried extracting the subtitle in it’s original form (HDMV_PGS)
> but don’t know how to input the command to even get the subtitle extracted.
> Any ideas? Thanks
>

Dear Ramon,
As Eugen says, ffmpeg can not "read" your subtitles. If you need to convert
them into text you need to use another tool. For your case I've used
Subtitle edit https://www.nikse.dk/subtitleedit/
It has optical character recognition so you only need to check if the
result makes sense and then you can export them to any text based file you
need. Here is a video about the process too
https://www.youtube.com/watch?v=SJvU6WOBMkQ
Hope it helps
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".