Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --convert-dvb-subs option. #155

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion bin/other-transcode
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -2272,7 +2281,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')
]

Expand All @@ -2284,6 +2293,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 = ''
Expand Down