From 18d3794e007551d95bf4dd1fff9cd28a44f25a25 Mon Sep 17 00:00:00 2001 From: Alan Staniforth Date: Thu, 14 Apr 2022 17:48:01 +0100 Subject: [PATCH] Add `--convert-dvb-subs` option. --- bin/other-transcode | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/bin/other-transcode b/bin/other-transcode index f46d005..8dba2bd 100755 --- a/bin/other-transcode +++ b/bin/other-transcode @@ -319,6 +319,9 @@ Subtitle options: burn subtitle track by number into video or enable automatic burning of forced subtitle (only image-based subtitles are burned) + --convert-dvb-subs + convert "DVB Subtitle" format subtitles to + "DVD Subtitle" format Other options: -h, --help [more|full] @@ -407,6 +410,7 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`. @subtitle_selections = [] @auto_add_subtitle = false @burn_subtitle_track = 0 + @convert_dvb_subs = false end def run @@ -997,6 +1001,11 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`. @encoder = nil if @encoder == 'copy' end + + opts.on '--convert-dvb-subs' do + @convert_dvb_subs = true + end + end def resolve_time(arg) @@ -2270,7 +2279,7 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`. options += [ '-map', "0:#{subtitle['index']}", - "-c:s:#{index}", ((@format == :mp4 and subtitle['codec_name'] == 'subrip') ? 'mov_text' : 'copy'), + "-c:s:#{index}", get_subtitle_codec(subtitle), "-disposition:s:#{index}", (force ? 'default+forced' : '0') ] @@ -2282,6 +2291,16 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`. options end + def get_subtitle_codec(subtitle) + out_codec = ((@format == :mp4 and subtitle['codec_name'] == 'subrip') ? 'mov_text' : 'copy') + + if subtitle['codec_name'] == 'dvb_subtitle' and @convert_dvb_subs + out_codec = 'dvdsub' + end + + return out_codec + end + def assemble_log(log_path, output) Kernel.warn 'Assembling `.log` file...' content = ''