MCDFsteve / NipaPlay

Nipaplay 一款跨平台(Windows Linux macOS)本地弹幕视频播放器。弹弹play 的mac代餐。主要平台为macOS,也是基于macOS开发,其他平台仅做移植。
GNU General Public License v3.0
73 stars 2 forks source link

提取 hdmv_pgs_subtitle 格式字幕失败报错 #10

Open yuygfgg opened 3 months ago

yuygfgg commented 3 months ago

如题。

"/opt/homebrew/bin/ffmpeg" -ss 0 -i "/Users/a1/Downloads/轻音少女.se2.ep21.mkv" -map 0:5 -c:s srt -y "/Users/a1/Library/Application Support/NipaPlay/nipaplay/sub/se2ep21.srt"
ffmpeg version 7.0.1 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.3.9.4)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
Input #0, matroska,webm, from '/Users/a1/Downloads/轻音少女.se2.ep21.mkv':
  Metadata:
    encoder         : libebml v1.4.2 + libmatroska v1.6.4
    creation_time   : 2022-03-12T09:46:55.000000Z
  Duration: 00:24:11.76, start: 0.000000, bitrate: 4929 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 90.007000
      Metadata:
        title           : Chapter 01
    Chapter #0:1: start 90.007000, end 179.888000
      Metadata:
        title           : Chapter 02
    Chapter #0:2: start 179.888000, end 696.905000
      Metadata:
        title           : Chapter 03
    Chapter #0:3: start 696.905000, end 1329.870000
      Metadata:
        title           : Chapter 04
    Chapter #0:4: start 1329.870000, end 1419.877000
      Metadata:
        title           : Chapter 05
    Chapter #0:5: start 1419.877000, end 1451.755000
      Metadata:
        title           : Chapter 06
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709/unknown/unknown), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn (default)
      Metadata:
        BPS             : 2626800
        DURATION        : 00:24:11.742000000
        NUMBER_OF_FRAMES: 34807
        NUMBER_OF_BYTES : 476679628
        _STATISTICS_WRITING_APP: mkvmerge v65.0.0 ('Too Much') 64-bit
        _STATISTICS_WRITING_DATE_UTC: 2022-03-12 09:46:55
        _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1(jpn): Audio: flac, 48000 Hz, stereo, s32 (24 bit) (default)
      Metadata:
        title           : Main Track
        BPS             : 1435360
        DURATION        : 00:24:11.745000000
        NUMBER_OF_FRAMES: 17013
        NUMBER_OF_BYTES : 260472252
        _STATISTICS_WRITING_APP: mkvmerge v65.0.0 ('Too Much') 64-bit
        _STATISTICS_WRITING_DATE_UTC: 2022-03-12 09:46:55
        _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:2(jpn): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
      Metadata:
        BPS             : 174982
        DURATION        : 00:24:11.755000000
        NUMBER_OF_FRAMES: 68051
        NUMBER_OF_BYTES : 31753885
        _STATISTICS_WRITING_APP: mkvmerge v65.0.0 ('Too Much') 64-bit
        _STATISTICS_WRITING_DATE_UTC: 2022-03-12 09:46:55
        _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:3(jpn): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
      Metadata:
        BPS             : 172916
        DURATION        : 00:24:11.755000000
        NUMBER_OF_FRAMES: 68051
        NUMBER_OF_BYTES : 31379018
        _STATISTICS_WRITING_APP: mkvmerge v65.0.0 ('Too Much') 64-bit
        _STATISTICS_WRITING_DATE_UTC: 2022-03-12 09:46:55
        _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:4(jpn): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
      Metadata:
        BPS             : 173992
        DURATION        : 00:24:11.754000000
        NUMBER_OF_FRAMES: 68051
        NUMBER_OF_BYTES : 31574352
        _STATISTICS_WRITING_APP: mkvmerge v65.0.0 ('Too Much') 64-bit
        _STATISTICS_WRITING_DATE_UTC: 2022-03-12 09:46:55
        _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:5(jpn): Subtitle: hdmv_pgs_subtitle (pgssub), 1920x1080 (default)
      Metadata:
        BPS             : 395635
        DURATION        : 00:24:06.570000000
        NUMBER_OF_FRAMES: 2399
        NUMBER_OF_BYTES : 71539339
        _STATISTICS_WRITING_APP: mkvmerge v65.0.0 ('Too Much') 64-bit
        _STATISTICS_WRITING_DATE_UTC: 2022-03-12 09:46:55
        _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:6(eng): Subtitle: hdmv_pgs_subtitle (pgssub), 1920x1080
      Metadata:
        BPS             : 457578
        DURATION        : 00:24:05.611000000
        NUMBER_OF_FRAMES: 1948
        NUMBER_OF_BYTES : 82685123
        _STATISTICS_WRITING_APP: mkvmerge v65.0.0 ('Too Much') 64-bit
        _STATISTICS_WRITING_DATE_UTC: 2022-03-12 09:46:55
        _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[sost#0:0/srt @ 0x14e60abe0] Subtitle encoding currently only possible from text to text or bitmap to bitmap
Error opening output file /Users/a1/Library/Application Support/NipaPlay/nipaplay/sub/se2ep21.srt.
Error opening output files: Invalid argument

会出现一个巨大的无法关闭的框,整个播放器卡死

MCDFsteve commented 3 months ago

可以提供原视频吗。只是下载的url/磁力链接 就可以

MCDFsteve commented 3 months ago

似乎是因为字幕本身是bitmap格式的,我目前的代码只考虑了srt ass/ssa vtt格式字幕的加载

yuygfgg commented 3 months ago

可以提供原视频吗。只是下载的url/磁力链接 就可以

VCB studio的轻音少女 S02E21; 我简单改了一下,现在这个位图字幕好了但是ASS乱码

MCDFsteve commented 3 months ago

ass也是通过javascript模仿的libass的加载,一些ass格式确实可能会导致乱码,尝试使用第三方工具将ass字幕烧录进视频作为硬字幕?

MCDFsteve commented 3 months ago

或者使用chatgpt等ai将ass字幕进行整理后手动装载?

yuygfgg commented 3 months ago

或者使用chatgpt等ai将ass字幕进行整理后手动装载?

所有ass字幕里面的非ascii字符显示问号。然后你的意见是用户自己解决这些问题?

MCDFsteve commented 3 months ago

你将视频发给我试试?我看看修复方法

yuygfgg commented 3 months ago

你将视频发给我试试?我看看修复方法

怎么发给你?GitHub限制10MB

MCDFsteve commented 3 months ago

主流的网盘服务(或者个人网盘)都可以,直接提供给我你下载的来源链接也是足够的

MCDFsteve commented 3 months ago

如果都没有的话,可以在 https://dfsteve.top/wp-content/kod/ 内上传文件,这是我的私人网盘

yuygfgg commented 3 months ago

主流的网盘服务(或者个人网盘)都可以,直接提供给我你下载的来源链接也是足够的

https://bangumi.moe/torrent/6247f0bc172667000785a41c

MCDFsteve commented 3 months ago

我需要一些时间(或许是一天以上)来下载文件(顺便一提这也是我想想要的东西,轻音少女的收藏级资源)。在这之前你可以尝试使用 https://www.github.com/mcdfsteve/fnipaplay 来播放这些视频,这是我另一个播放器项目,虽然还在初期阶段,但是其内部是完整支持各种字幕格式的libass,应该可以正常渲染这些字幕。弹幕也是一样有的

yuygfgg commented 3 months ago

我需要一些时间(或许是一天以上)来下载文件(顺便一提这也是我想想要的东西,轻音少女的收藏级资源)。在这之前你可以尝试使用 https://www.github.com/mcdfsteve/fnipaplay 来播放这些视频,这是我另一个播放器项目,虽然还在初期阶段,但是其内部是完整支持各种字幕格式的libass,应该可以正常渲染这些字幕。弹幕也是一样有的

OK感谢。我自己也再调调看

MCDFsteve commented 3 months ago

好的,等我下载下来视频以后会查看关于bitmap字幕的装载方法。这个issue在问题解决之前会保持开启

yuygfgg commented 3 months ago

可以考虑换用libass-wasm

MCDFsteve commented 3 months ago

后面看看

yuygfgg commented 3 months ago

https://github.com/yuygfgg/NipaPlay 我弄了一个简单的patch。 然后ass到问题应该是我自己装了坏掉的字体一类的导致的,可以不用管

MCDFsteve commented 3 months ago

等我视频下载完毕以后亲自验证一下是否得到改善

MCDFsteve commented 2 weeks ago

可以考虑换用libass-wasm

1.6.4版本已将字幕加载器更换为了libass(连带着srt字幕一起,现在srt字幕的显示效果跟ass一样好了)