0

I am trying to encode A Quiet Place... I know for a fact there are forced subs, but when trying to encode it from 4K (native) to either 4K (x265) or 1080 (x264), the forced subs are not burned in on the resulting file.

The same command worked fine with burning in the forced subtitles for another movie. When I use Handbrake, it does burn in the forced subtitles.

This is the command I am using:

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

This is my mkv file:

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 10@L5.1@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 Answers1

0

What -forced_subs_only does is tell the PGS decoder to only decode subs marked as forced. You need to overlay these subs, which are image-based, to have them visible in the output video. So,

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

The overlay filter will burn the forced subs from the first subtitle stream onto the video. Depending on subtitle frame size, you may want to scale that stream before overlaying it.

Gyan
  • 34,439
  • 6
  • 56
  • 98
  • Thanks, that did the trick. One thing I noticed is that the subs are 1080p. The 4K encoded file displayed the subs at a weird spot. Found this solution, seems to work - does this look right to you: `ffmpeg -y -probesize 4096M -analyzeduration 4096M -forced_subs_only 1 -canvas_size 3840x2160 -i ../in/A Quiet Place (2018).mkv -c:v libx265 -preset slower -pix_fmt yuv420p10le -profile:v main10 -level 5.1 -crf:v 20 -filter_complex null[v];[0:s:1][v]scale2ref[sub][ref];[ref][sub]overlay -x265-params -c:a aac -ac 6 ../temp/A Quiet Place (2018) - 4K.mkv` – Van Nguyen Jul 11 '19 at 15:39
  • Ok, but `null[v]` is not needed. Start with the scale2ref: `[0:s:1][0:v]scale2ref` – Gyan Jul 11 '19 at 16:03
  • OK, so it doesn't appear to work for 4K videos. I always get this error at the very end `Starting new cluster due to timestamp`. I have only found one instance of this on the interweb, but doesn't contain a solution: https://www.reddit.com/r/ffmpeg/comments/57iusa/burning_subtitles_issue/ – Van Nguyen Jul 29 '19 at 23:05
  • Well, other than using another tool =| – Van Nguyen Jul 29 '19 at 23:12
  • I think I found a solution: using the -t flag and setting it to the length of the movie. Appears to have worked on A Quiet Place. Trying on another movie now. – Van Nguyen Aug 01 '19 at 15:22