使用 FFMpeg 刻录的外部 PGS 字幕 (.SUP) 轨道不同步

发布于 2025-01-09 02:49:26 字数 2788 浏览 0 评论 0原文

这是场景。我有一个系列的 2160p(HDR) 文件,带有我想要的 SUP 字幕,以及该系列的 1080p 文件。我想以硬编码方式将 SUP 字幕刻录到 1080p 文件上。文件夹“1”中的文件是 1080p 文件,我将其更改为与 2160p 相同的名称以执行 .sh 命令。

    ./
├── 1
│   ├── mp4.sh
│   ├── The.Series.S01E01.1080p.WEB.H264-SEQ.mkv
│   ├── The.Series.S01E02.1080p.WEB.H264-SEQ.mkv
│   ├── The.Series.S01E03.1080p.WEB.H264-SEQ.mkv
│   ├── The.Series.S01E04.1080p.WEB.H264-SEQ.mkv
│   ├── The.Series.S01E05.1080p.WEB.H264-SEQ.mkv
│   ├── The.Series.S01E06.1080p.WEB.H264-SEQ.mkv
│   └── The.Series.S01E07.1080p.WEB.H264-SEQ.mkv
├── The.Series.S01E01.2160p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E02.2160p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E03.2160p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E04.2160p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E05.2160p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E06.2160p.WEB.HDR.H265-SEQ.mkv
└── The.Series.S01E07.2160p.WEB.HDR.H265-SEQ.mkv

mp4.sh的内容如下。

for i in ./*.mkv
  do
    ffmpeg -i "$i" -i "../$i" -vcodec libx264 -crf 20 \
      -filter_complex "[0:v:0][1:s:0]overlay[v]" \
      -map "[v]" -map 0:a \
      -c:a aac -ac 2 -b:v 6000k -bufsize 2500k $i.mp4 
done
Stream mapping:
  Stream #0:0 (h264) -> overlay:main (graph 0)
  Stream #1:2 (pgssub) -> overlay:overlay (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (eac3 (native) -> aac (native))

我想将 2160p 文件中的第一个字幕(PGS)刻录为硬编码样式,因此使用 -filter_complex 选项。但我收到了这个错误。

[graph 0 input from stream 1:2 @ 0x55621d6316c0] Changing frame properties on the fly is not supported by all filters.

如果我使用以下命令将 PGS 字幕提取为外部 .sup 文件,则字幕和视频不同步。

for i in ./*.mkv
  do
    ffmpeg -i "$i" -i "$i.sup" -vcodec libx264 -crf 19 \
      -filter_complex "[0:v][1:s]overlay[v]" \
      -map "[v]" -map 0:a \
      -c:a aac -b:v 8000k -bufsize 4500k $i.mp4 
done

看起来字幕是从 0:00:00 开始的,而不是原来的起点。

./
├── mp4.sh
├── The.Series.S01E01.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E01.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E02.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E02.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E03.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E03.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E04.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E04.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E05.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E05.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E06.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E06.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E07.1080p.WEB.HDR.H265-SEQ.mkv
└── The.Series.S01E07.1080p.WEB.HDR.H265-SEQ.mkv.sup

请帮帮我。谢谢。

Here is the scenario. I have 2160p(HDR) files of one series with the SUP subtitles I want, and 1080p files of that series. I want to burn the SUP subtitle onto the 1080p files in hardcoded style. The files in folder '1' is the 1080p files which I change names the same as 2160p for executing the .sh command.

    ./
├── 1
│   ├── mp4.sh
│   ├── The.Series.S01E01.1080p.WEB.H264-SEQ.mkv
│   ├── The.Series.S01E02.1080p.WEB.H264-SEQ.mkv
│   ├── The.Series.S01E03.1080p.WEB.H264-SEQ.mkv
│   ├── The.Series.S01E04.1080p.WEB.H264-SEQ.mkv
│   ├── The.Series.S01E05.1080p.WEB.H264-SEQ.mkv
│   ├── The.Series.S01E06.1080p.WEB.H264-SEQ.mkv
│   └── The.Series.S01E07.1080p.WEB.H264-SEQ.mkv
├── The.Series.S01E01.2160p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E02.2160p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E03.2160p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E04.2160p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E05.2160p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E06.2160p.WEB.HDR.H265-SEQ.mkv
└── The.Series.S01E07.2160p.WEB.HDR.H265-SEQ.mkv

The content of the mp4.sh is as follows.

for i in ./*.mkv
  do
    ffmpeg -i "$i" -i "../$i" -vcodec libx264 -crf 20 \
      -filter_complex "[0:v:0][1:s:0]overlay[v]" \
      -map "[v]" -map 0:a \
      -c:a aac -ac 2 -b:v 6000k -bufsize 2500k $i.mp4 
done
Stream mapping:
  Stream #0:0 (h264) -> overlay:main (graph 0)
  Stream #1:2 (pgssub) -> overlay:overlay (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (eac3 (native) -> aac (native))

I want to burn the first subtitle(PGS) in 2160p files into hardcoded style, so use -filter_complex option. But I got this error.

[graph 0 input from stream 1:2 @ 0x55621d6316c0] Changing frame properties on the fly is not supported by all filters.

If I extract the PGS subtitle as external .sup files, using the following command, the subtitle and video is not synced.

for i in ./*.mkv
  do
    ffmpeg -i "$i" -i "$i.sup" -vcodec libx264 -crf 19 \
      -filter_complex "[0:v][1:s]overlay[v]" \
      -map "[v]" -map 0:a \
      -c:a aac -b:v 8000k -bufsize 4500k $i.mp4 
done

It seems the subtitle begins from 0:00:00, not as its origianl initial point.

./
├── mp4.sh
├── The.Series.S01E01.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E01.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E02.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E02.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E03.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E03.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E04.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E04.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E05.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E05.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E06.1080p.WEB.HDR.H265-SEQ.mkv
├── The.Series.S01E06.1080p.WEB.HDR.H265-SEQ.mkv.sup
├── The.Series.S01E07.1080p.WEB.HDR.H265-SEQ.mkv
└── The.Series.S01E07.1080p.WEB.HDR.H265-SEQ.mkv.sup

Please help me out. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文