FFMPEG 使用 forced_subs_only 不会刻录强制订阅

FFMPEG 使用 forced_subs_only 不会刻录强制订阅

我正在尝试对《寂静之地》进行编码...我知道确实有强制字幕,但是当尝试将其从 4K(原生)编码为 4K(x265)或 1080(x264)时,强制字幕不会刻录在生成的文件中。

同一命令在刻录另一部电影的强制字幕时效果很好。当我使用 Handbrake 时,它​​确实刻录了强制字幕。

这是我正在使用的命令:

ffmpeg -y -probesize 2048M -analyzeduration 2048M -forced_subs_only 1 -i ../in/A Quiet Place.mkv -map 0:0 -map 0:1 -map 0:1 -c:v libx264 -preset slower -profile:v high -level 5.1 -crf:v 22 -vf scale=1920:-1 -x264-params ref=5:bframes=5:b_adapt=2:direct=auto:analyse=all:me=umh:merange=24:subme=10:trellis=2:vbv-bufsize=512000:vbv-maxrate=512000:rc-lookahead=60:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc -c:a:0 aac -ac 6 -c:a:1 ac3 -ac 6  -disposition:a:0 default -disposition:a:1 none ../temp/A Quiet Place - 1080p.mp4

这是我的 mkv 文件:

General
Unique ID                                : 23590760640855359557197555294735710745 (0x11BF6A4CB436978F1FFA81AF8C2C3A19)
Complete name                            : ../in/A Quiet Place (2018).mkv
Format                                   : Matroska
Format version                           : Version 2
File size                                : 45.1 GiB
Duration                                 : 1 h 30 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 71.5 Mb/s
Movie name                               : A Quiet Place
Encoded date                             : UTC 2018-08-03 16:35:34
Writing application                      : MakeMKV v1.12.3 win(x64-release)
Writing library                          : libmakemkv v1.12.3 (1.3.5/1.4.7) win(x64-release)

Video
ID                                       : 1
ID in the original source medium         : 4113 (0x1011)
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main [email protected]@High
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 1 h 30 min
Bit rate                                 : 66.3 Mb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 2)
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.333
Stream size                              : 41.8 GiB (93%)
Language                                 : English
Default                                  : No
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Original source medium                   : Blu-ray
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0001 cd/m2, max: 1000 cd/m2

Audio #1
ID                                       : 2
ID in the original source medium         : 4352 (0x1100)
Format                                   : TrueHD
Format profile                           : TrueHD+Atmos / TrueHD
Codec ID                                 : A_TRUEHD
Duration                                 : 1 h 30 min
Bit rate mode                            : Variable
Bit rate                                 : 3 890 kb/s
Maximum bit rate                         : 8 064 kb/s
Channel(s)                               : Object Based / 8 channels
Channel positions                        : Object Based / Front: L C R, Side: L R, Back: L R, LFE
Sampling rate                            :  / 48.0 kHz
Frame rate                               : 1 200.000 FPS (40 SPF)
Bit depth                                : 24 bits
Compression mode                         : Lossless
Stream size                              : 2.45 GiB (5%)
Title                                    : Surround 7.1
Language                                 : English
Default                                  : Yes
Forced                                   : No
Original source medium                   : Blu-ray

Audio #2
ID                                       : 3
ID in the original source medium         : 4352 (0x1100)
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Codec ID                                 : A_AC3
Duration                                 : 1 h 30 min
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 413 MiB (1%)
Title                                    : Surround 5.1
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No
Original source medium                   : Blu-ray

Audio #3
ID                                       : 4
ID in the original source medium         : 4353 (0x1101)
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Codec ID                                 : A_AC3
Duration                                 : 1 h 30 min
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 413 MiB (1%)
Title                                    : Surround 5.1
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No
Original source medium                   : Blu-ray

Text #1
ID                                       : 5
ID in the original source medium         : 4768 (0x12A0)
Format                                   : PGS
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Duration                                 : 1 h 11 min
Bit rate                                 : 1 932 b/s
Count of elements                        : 302
Stream size                              : 1 016 KiB (0%)
Language                                 : English
Default                                  : No
Forced                                   : No
Original source medium                   : Blu-ray

Text #2
ID                                       : 6
ID in the original source medium         : 4768 (0x12A0)
Format                                   : PGS
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Duration                                 : 1 h 11 min
Bit rate                                 : 1 252 b/s
Count of elements                        : 200
Stream size                              : 658 KiB (0%)
Language                                 : English
Default                                  : Yes
Forced                                   : No
Original source medium                   : Blu-ray

Text #3
ID                                       : 7
ID in the original source medium         : 4769 (0x12A1)
Format                                   : PGS
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Duration                                 : 1 h 22 min
Bit rate                                 : 3 951 b/s
Count of elements                        : 652
Stream size                              : 2.32 MiB (0%)
Language                                 : English
Default                                  : No
Forced                                   : No
Original source medium                   : Blu-ray

Menu
00:00:00.000                             : en:Chapter 01
00:10:19.118                             : en:Chapter 02
00:14:38.002                             : en:Chapter 03
00:21:52.894                             : en:Chapter 04
00:25:09.674                             : en:Chapter 05
00:31:05.029                             : en:Chapter 06
00:36:23.389                             : en:Chapter 07
00:43:47.124                             : en:Chapter 08
00:47:42.526                             : en:Chapter 09
00:53:48.058                             : en:Chapter 10
01:00:31.377                             : en:Chapter 11
01:05:55.326                             : en:Chapter 12
01:10:57.836                             : en:Chapter 13
01:15:29.066                             : en:Chapter 14
01:23:47.147                             : en:Chapter 15

答案1

-forced_subs_only的作用是告诉 PGS 解码器只解码标记为强制的字幕。您需要叠加这些基于图像的字幕,才能在输出视频中看到它们。因此,

ffmpeg -y -probesize 2048M -analyzeduration 2048M -forced_subs_only 1 -i ../in/A Quiet Place.mkv -map 0:0 -map 0:1 -map 0:1 -c:v libx264 -preset slower -profile:v high -level 5.1 -crf:v 22 -filter_complex [0:v]scale=1920:-1[v];[v][0:s:0]overlay -x264-params ref=5:bframes=5:b_adapt=2:direct=auto:analyse=all:me=umh:merange=24:subme=10:trellis=2:vbv-bufsize=512000:vbv-maxrate=512000:rc-lookahead=60:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc -c:a:0 aac -ac 6 -c:a:1 ac3 -ac 6 -disposition:a:0 default -disposition:a:1 none ../temp/A Quiet Place - 1080p.mp4

叠加滤镜会将第一个字幕流中的强制字幕刻录到视频中。根据字幕帧大小,您可能需要在叠加之前缩放该流。

相关内容