I use Handbrake to encode recordings from the DVB-T2 broadcast. When Handbrake re-encodes the video and audio stream, the subtitle track is altered and no longer works. In the documentation it is indicated that Handbrake supports subtitles in bitmap form but does Handbrake support DVB-T Subtitles (as per ETSI EN 300 743) ?
Steps to reproduce the problem (If Applicable):
To record TV (DVB-T2), I use TVHeadend which generates MKV files with the following streams:
Code: Select all
Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
Stream #0:1(fre): Audio: eac3, 48000 Hz, stereo, fltp, 128 kb/s (default) [French]
Stream #0:2(qaa): Audio: eac3, 48000 Hz, stereo, fltp, 128 kb/s (default) [Original audio]
Stream #0:3(qaa): Audio: eac3, 48000 Hz, stereo, fltp, 96 kb/s (default) [French - Visual-impaired]
Stream #0:4(fre): Subtitle: dvb_subtitle (default) [French - Hearing impaired]
Stream #0:5(fre): Subtitle: dvb_subtitle (default) [French]
Code: Select all
Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
Stream #0:1(fre): Audio: eac3, 48000 Hz, stereo, fltp, 128 kb/s (default)
Stream #0:2(qaa): Audio: eac3, 48000 Hz, stereo, fltp, 128 kb/s (default)
Stream #0:3(fre): Subtitle: dvb_subtitle (default)
I re-encode this file (again as an MKV) with Handbrake to reduce the size with the following settings:
- Crop the video from 140px top and bottom to remove the black bands (and at the same time get rid of the the TV channel logo) to 1920x800
- Encoding of the video in h264 with Q=21
- Encoding of the two audio streams with a stereo downmix in AAC
- Integration of the subtitle track as a pass-through
In the output file, the subtitles no longer work: the player offers to display subtitles but nothing is displayed.
By extracting the subtitle tracks (in the form of an MKS file) before and after encoding by Handbrake I notice that the size has been greatly reduced:
- Original file before encoding by HB: 6.1 MB in the subtitle stream
- File after encoding by HB: only 101,2 Kb in the subtitle stream
A possible workaround is to request Handbrake not to integrate the subtitles and to integrate them later by extracting the subtitle stream from the original file and muxing it into the file produced by Handbrake (tested with mkvextract and mkvmerge)
In the activity log, there are a large number of errors concerning the subtitles (for example here by encoding 5 minutes in the middle of the film):
Code: Select all
[23:16:30] encx264: encoding at constant RF 21,000000
[23:16:30] encx264: unparsed options: ref=5:bframes=5:level=4.0:b-adapt=2:direct=auto:deblock=-1,-1:analyse=all:me=umh:merange=24:subme=10:trellis=2:psy-rd=1,0,15:vbv-bufsize=31250:vbv-maxrate=25000:rc-lookahead=60
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x264 [info]: profile High, level 4.0, 4:2:0, 8-bit
[23:16:31] sync: first pts audio 0x1 is 0
[23:16:31] sync: first pts audio 0x2 is 0
[23:16:31] sync: first pts video is 450
[23:16:31] sync: first pts subtitle 0x3 is 50850
[23:16:36] sync: subtitle 0x3 duration <= 0, PTS 587250
[b][23:16:48] sync: subtitle 0x3 duration <= 0, PTS 1278450[/b]
[23:16:55] sync: subtitle 0x3 duration <= 0, PTS 1667250
[23:16:59] sync: subtitle 0x3 duration <= 0, PTS 1847250[...]
20230305065846-4b497cbd0-master (x86_64) compiled from last available source
Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
KDE neon 5.27 (based on Ubuntu 22.04 LTS)