mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-24 09:55:12 +00:00
Deployed 8b10b79 with MkDocs version: 1.6.1
This commit is contained in:
+74
-72
@@ -1035,10 +1035,10 @@
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#what-each-backend-actually-preserves" class="md-nav__link">
|
||||
<a href="#what-each-backend-preserves" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What each backend actually preserves
|
||||
What each backend preserves
|
||||
|
||||
</span>
|
||||
</a>
|
||||
@@ -2268,10 +2268,10 @@
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#what-each-backend-actually-preserves" class="md-nav__link">
|
||||
<a href="#what-each-backend-preserves" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
What each backend actually preserves
|
||||
What each backend preserves
|
||||
|
||||
</span>
|
||||
</a>
|
||||
@@ -2353,18 +2353,19 @@
|
||||
|
||||
|
||||
<h1 id="subtitles">Subtitles<a class="headerlink" href="#subtitles" title="Permanent link">¶</a></h1>
|
||||
<p>Subtitles are first-class tracks in unshackle. When you download a title, subtitle
|
||||
tracks are parsed from the manifest alongside video and audio, downloaded, cleaned up,
|
||||
optionally converted to the format you want, and then either muxed into the final
|
||||
Matroska file or written out as sidecar files next to it. The sections below cover the
|
||||
supported formats, how tracks are normalized after download, how to select and filter
|
||||
subtitles, and every subtitle-related configuration option.</p>
|
||||
<p>Most of this is controlled with a handful of <code>dl</code> flags and a small <code>subtitle</code> block in
|
||||
your <a href="../../getting-started/configuration-file/">configuration file</a>. See
|
||||
<p>Subtitles are first-class tracks in unshackle. When you download a title, unshackle
|
||||
parses the subtitle tracks from the manifest alongside video and audio. It downloads
|
||||
them, cleans them up, and optionally converts them to the format you want. It then muxes
|
||||
them into the final Matroska file, or writes them out as sidecar files next to it. The
|
||||
sections below cover the supported formats, how unshackle normalizes tracks after
|
||||
download, how to select and filter subtitles, and every subtitle-related configuration
|
||||
option.</p>
|
||||
<p>A handful of <code>dl</code> flags and a small <code>subtitle</code> block in your
|
||||
<a href="../../getting-started/configuration-file/">configuration file</a> control most of this. See
|
||||
<a href="../downloading/">Downloading</a> for how subtitle flags fit into a full download command.</p>
|
||||
<h2 id="supported-formats">Supported formats<a class="headerlink" href="#supported-formats" title="Permanent link">¶</a></h2>
|
||||
<p>unshackle understands the following subtitle codecs. The <strong>Format</strong> column is the value
|
||||
shown in track listings; the <strong>Extension</strong> column is the file extension used on disk.</p>
|
||||
shown in track listings. The <strong>Extension</strong> column is the file extension used on disk.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -2450,29 +2451,29 @@ DASH and HLS deliver. You never keep these as-is: right after download they are
|
||||
unwrapped into their plain counterparts (<code>fTTML</code> becomes TTML and <code>fVTT</code> becomes
|
||||
WebVTT), so you always end up with an editable text subtitle. Note that this is a
|
||||
one-way, source-only relationship: you can convert <em>from</em> these boxed formats, but no
|
||||
backend can produce them as an output target, so they can never be a conversion
|
||||
backend can write them as an output target, so they can never be a conversion
|
||||
destination.</p>
|
||||
</div>
|
||||
<h2 id="what-happens-to-a-subtitle-after-download">What happens to a subtitle after download<a class="headerlink" href="#what-happens-to-a-subtitle-after-download" title="Permanent link">¶</a></h2>
|
||||
<p>A subtitle download does more than save a file. Once the bytes are on disk, unshackle runs
|
||||
format-appropriate clean-up to produce a single, valid file:</p>
|
||||
format-appropriate clean-up to make a single, valid file:</p>
|
||||
<ul>
|
||||
<li><strong>Encoding</strong>: non-boxed subtitles are forced to UTF-8, and stray <code>&lrm;</code> / <code>&rlm;</code>
|
||||
bidirectional entities are unescaped.</li>
|
||||
<li><strong>Encoding</strong>: unshackle forces non-boxed subtitles to UTF-8, and unescapes stray
|
||||
<code>&lrm;</code> / <code>&rlm;</code> bidirectional entities.</li>
|
||||
<li><strong>Segment merging</strong>: when a WebVTT or boxed subtitle arrives as many DASH/HLS
|
||||
segments, the segments are stitched back into one continuous document with correct
|
||||
timing.</li>
|
||||
segments, unshackle merges the segments back into one continuous document with
|
||||
correct timing.</li>
|
||||
<li><strong>WebVTT sanitization</strong>: merged WebVTT runs through a repair pipeline that clamps
|
||||
negative timestamps to <code>00:00:00.000</code>, removes stray cue identifiers (like <code>Q0</code>, <code>Q1</code>)
|
||||
that confuse downstream parsers, and merges multi-line cues that a service split into
|
||||
separate overlapping cues. By default the original styling and layout are preserved
|
||||
separate overlapping cues. By default unshackle keeps the original styling and layout
|
||||
(see <a href="#subtitle-configuration"><code>preserve_formatting</code></a>).</li>
|
||||
<li><strong>TTML for muxing</strong>: Matroska cannot carry TTML. If you do not request a specific
|
||||
output format, any plain TTML track is automatically converted to WebVTT before
|
||||
output format, unshackle automatically converts any plain TTML track to WebVTT before
|
||||
muxing (the closest lossless equivalent). Boxed <code>fTTML</code> is likewise unwrapped to TTML
|
||||
first.</li>
|
||||
</ul>
|
||||
<p>You normally do not need to think about any of this. It just produces a clean file.</p>
|
||||
<p>You normally do not need to think about any of this. It gives a clean file.</p>
|
||||
<h2 id="selecting-and-filtering-subtitles">Selecting and filtering subtitles<a class="headerlink" href="#selecting-and-filtering-subtitles" title="Permanent link">¶</a></h2>
|
||||
<p>Subtitle selection happens through <code>dl</code> flags. The most important is language selection.</p>
|
||||
<table>
|
||||
@@ -2526,7 +2527,7 @@ format-appropriate clean-up to produce a single, valid file:</p>
|
||||
To narrow it down, pass a comma-separated list of language tags:</p>
|
||||
<div class="language-shell highlight"><span class="filename">English and Spanish subtitles only</span><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a>unshackle<span class="w"> </span>dl<span class="w"> </span>--s-lang<span class="w"> </span>en,es<span class="w"> </span>EXAMPLE<span class="w"> </span><span class="m">81234567</span>
|
||||
</span></code></pre></div>
|
||||
<p>Language matching is fuzzy by default: <code>en</code> will match <code>en-US</code>, <code>en-GB</code>, and similar
|
||||
<p>Language matching is fuzzy by default: <code>en</code> matches <code>en-US</code>, <code>en-GB</code>, and similar
|
||||
variants. If a requested language is missing but others were found, unshackle continues
|
||||
with whatever remains and tells you which languages it dropped.</p>
|
||||
<p>For strict matching, where <code>es-419</code> matches only <code>es-419</code> and never <code>es-ES</code>, add
|
||||
@@ -2535,9 +2536,9 @@ with whatever remains and tells you which languages it dropped.</p>
|
||||
</span></code></pre></div>
|
||||
<h3 id="requiring-languages-before-downloading">Requiring languages before downloading<a class="headerlink" href="#requiring-languages-before-downloading" title="Permanent link">¶</a></h3>
|
||||
<p><code>--require-subs</code> is a gate rather than a filter. It downloads <strong>all</strong> available
|
||||
subtitles, but only if every language you list is present; if any is missing the title
|
||||
errors out. This is useful for batch jobs where a title without your must-have language
|
||||
should fail loudly rather than silently produce a partial result.</p>
|
||||
subtitles, but only if every language you name is present. If any is missing, the title
|
||||
errors out. This is useful for batch jobs where you want a title without your must-have
|
||||
language to fail loudly, and not to silently give a partial result.</p>
|
||||
<div class="language-shell highlight"><span class="filename">Fail unless both English and French subs exist, then grab everything</span><pre><span></span><code><span id="__span-2-1"><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a>unshackle<span class="w"> </span>dl<span class="w"> </span>--require-subs<span class="w"> </span>en,fr<span class="w"> </span>EXAMPLE<span class="w"> </span>B0ABCDEFGH
|
||||
</span></code></pre></div>
|
||||
<div class="admonition warning">
|
||||
@@ -2547,7 +2548,7 @@ combined with <code>--s-lang</code>. Choose one or the other.</p>
|
||||
</div>
|
||||
<h3 id="forced-subtitles">Forced subtitles<a class="headerlink" href="#forced-subtitles" title="Permanent link">¶</a></h3>
|
||||
<p>Forced tracks carry only the important on-screen signs and foreign-dialogue lines meant
|
||||
to display even when you are watching in your own language. They are <strong>excluded by
|
||||
to display even when you watch in your own language. They are <strong>excluded by
|
||||
default</strong>. Add <code>-fs</code> / <code>--forced-subs</code> to include them:</p>
|
||||
<div class="language-shell highlight"><span class="filename">Include forced tracks alongside full subtitles</span><pre><span></span><code><span id="__span-3-1"><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a>unshackle<span class="w"> </span>dl<span class="w"> </span>--s-lang<span class="w"> </span>en<span class="w"> </span>--forced-subs<span class="w"> </span>EXAMPLE<span class="w"> </span><span class="m">81234567</span>
|
||||
</span></code></pre></div>
|
||||
@@ -2563,9 +2564,9 @@ track, same as plain <code>-fs</code>).</p>
|
||||
<p>Every subtitle track carries flags describing what kind of captions it holds. These
|
||||
flags drive selection, sort order, output filenames, and the Matroska track flags.</p>
|
||||
<ul>
|
||||
<li><strong>Forced</strong>: only signs and foreign dialogue; meant to play when the audio language
|
||||
matches. Off by default; enable with <code>--forced-subs</code>.</li>
|
||||
<li><strong>SDH</strong> (Subtitles for the Deaf and Hard-of-Hearing; also called HOH): a full
|
||||
<li><strong>Forced</strong>: only signs and foreign dialogue, meant to play when the audio language
|
||||
matches. Off by default. Enable it with <code>--forced-subs</code>.</li>
|
||||
<li><strong>SDH</strong> (Subtitles for the Deaf and Hard-of-Hearing, also called HOH): a full
|
||||
transcript that includes both dialogue and non-speech sound cues.</li>
|
||||
<li><strong>CC</strong> (Closed Captions): captions originating from an EIA-608/708 broadcast stream,
|
||||
often uppercase with <code>>>></code> speaker markers and sound cues.</li>
|
||||
@@ -2573,8 +2574,8 @@ flags drive selection, sort order, output filenames, and the Matroska track flag
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">SDH and CC are treated together for sorting and stripping</p>
|
||||
<p>unshackle orders subtitles from fewest to most captions: <strong>Forced → Normal → SDH/CC</strong>.
|
||||
For the purposes of hearing-impaired handling, SDH and CC tracks are grouped as the
|
||||
"most captions" variant.</p>
|
||||
For hearing-impaired handling, unshackle groups SDH and CC tracks as the "most
|
||||
captions" variant.</p>
|
||||
<p>By default this type order is the primary sort, so all forced tracks come first, then
|
||||
all normal tracks, then all SDH/CC tracks, each block sorted by language. To keep each
|
||||
language next to its own variants instead, set
|
||||
@@ -2582,27 +2583,27 @@ language next to its own variants instead, set
|
||||
<a href="../../reference/configuration/download/#subtitle"><code>subtitle.type_priority</code></a> to change the
|
||||
Forced → Normal → SDH/CC order itself.</p>
|
||||
</div>
|
||||
<p>A single track cannot be both CC and SDH, and a forced track cannot also be flagged
|
||||
CC or SDH. These combinations are rejected as invalid.</p>
|
||||
<p>A single track cannot be both CC and SDH, and a forced track cannot also carry the CC or
|
||||
SDH flag. unshackle rejects these combinations as invalid.</p>
|
||||
<h3 id="closed-captions-embedded-in-video">Closed captions embedded in video<a class="headerlink" href="#closed-captions-embedded-in-video" title="Permanent link">¶</a></h3>
|
||||
<p>Some services do not ship subtitles as separate tracks but instead embed EIA-608/708
|
||||
captions inside the video stream. After a video track is downloaded and decrypted,
|
||||
unshackle probes it for these captions and, when found, extracts them into a SubRip
|
||||
captions inside the video track. After unshackle downloads and decrypts a video track,
|
||||
it probes the track for these captions and, when it finds them, extracts them into a SubRip
|
||||
(<code>SRT</code>) subtitle flagged as CC. This runs automatically unless you disabled subtitles
|
||||
(<code>--no-subs</code>) or video (<code>--no-video</code> / <code>--video-only</code> semantics), and it requires the
|
||||
CCExtractor tool on your <code>PATH</code>.</p>
|
||||
<h2 id="automatic-sdh-stripping">Automatic SDH stripping<a class="headerlink" href="#automatic-sdh-stripping" title="Permanent link">¶</a></h2>
|
||||
<p>When a language has an SDH track but <strong>no</strong> plain (non-SDH, non-forced) track, unshackle
|
||||
can generate a clean non-SDH version for you by stripping the hearing-impaired cues:
|
||||
can make a clean non-SDH version for you by stripping the hearing-impaired cues:
|
||||
sound effects, speaker labels, music notes, and similar. This is on by default and
|
||||
controlled by the <a href="#subtitle-configuration"><code>strip_sdh</code></a> config key.</p>
|
||||
<p>The check is deliberately loose: if a close-enough plain track already exists (for
|
||||
example an <code>en-GB</code> non-SDH track when the SDH track is <code>en-US</code>), no stripped copy is
|
||||
created. When a stripped copy <em>is</em> created, the original SDH track is kept as well, so
|
||||
you end up with both.</p>
|
||||
<p>The stripping engine itself is chosen by the <a href="#subtitle-configuration"><code>sdh_method</code></a>
|
||||
config key. The default (<code>auto</code>) prefers the <code>subby</code> cleaner for SRT, falls back to
|
||||
SubtitleEdit when it is installed, and otherwise uses the built-in <code>filter-subs</code>
|
||||
<p>The <a href="#subtitle-configuration"><code>sdh_method</code></a> config key selects the stripping engine
|
||||
itself. The default (<code>auto</code>) prefers the <code>subby</code> cleaner for SRT, falls back to
|
||||
SubtitleEdit when you install it, and otherwise uses the built-in <code>filter-subs</code>
|
||||
approach.</p>
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">Why <code>convert_before_strip</code> exists</p>
|
||||
@@ -2610,7 +2611,7 @@ approach.</p>
|
||||
silently without stripping anything, not an error but a no-op that leaves the SDH
|
||||
cues in place. This is the whole reason for <a href="#subtitle-configuration"><code>convert_before_strip</code></a>:
|
||||
non-SubtitleEdit engines need the subtitle converted to SRT first, or the
|
||||
hearing-impaired cues survive the strip untouched.</p>
|
||||
hearing-impaired cues stay in the file.</p>
|
||||
</div>
|
||||
<h2 id="converting-subtitle-formats">Converting subtitle formats<a class="headerlink" href="#converting-subtitle-formats" title="Permanent link">¶</a></h2>
|
||||
<p>By default unshackle keeps each subtitle in its downloaded format (only auto-converting
|
||||
@@ -2629,10 +2630,10 @@ all conversion:</p>
|
||||
<p class="admonition-title">Down-converting styled subtitles is lossy</p>
|
||||
<p>Converting styled SSA/ASS subtitles to SRT throws away positioning, colours, and
|
||||
italics. unshackle never does this automatically. It only happens when you
|
||||
explicitly ask for it via <code>--sub-format</code>. If you want to preserve styling, convert
|
||||
explicitly ask for it with <code>--sub-format</code>. If you want to preserve styling, convert
|
||||
to a format that supports it (or keep <code>original</code>).</p>
|
||||
<p>Note that this automatic protection guards <strong>only the default muxed track</strong>: there the
|
||||
conversion is skipped and the styled original is kept. It does <strong>not</strong> cover sidecars.
|
||||
<p>Note that this automatic protection guards <strong>only the default muxed track</strong>: there
|
||||
unshackle skips the conversion and keeps the styled original. It does <strong>not</strong> cover sidecars.
|
||||
A <code>sidecar_format: srt</code> will still lossily flatten styled subtitles, dropping
|
||||
positioning, colours, and styling, and a per-download <code>--sub-format srt</code> forces the
|
||||
muxed track to convert as well. To keep raw styled sidecars, set
|
||||
@@ -2676,11 +2677,11 @@ formats involved:</p>
|
||||
</table>
|
||||
<p>With <code>conversion_method: auto</code>, unshackle ranks these automatically per conversion.
|
||||
Setting it to a specific value pins that backend as the first choice, falling back to
|
||||
others only if the pin cannot handle the pair.</p>
|
||||
<h4 id="what-each-backend-actually-preserves">What each backend actually preserves<a class="headerlink" href="#what-each-backend-actually-preserves" title="Permanent link">¶</a></h4>
|
||||
others only if the pin cannot convert the pair.</p>
|
||||
<h4 id="what-each-backend-preserves">What each backend preserves<a class="headerlink" href="#what-each-backend-preserves" title="Permanent link">¶</a></h4>
|
||||
<p>The table below comes from round-tripping a subtitle that carries italics, bold,
|
||||
underline, positioning, and colour through every backend. Each cell lists the
|
||||
styling that survives; <code>—</code> means the backend cannot handle that pair.</p>
|
||||
underline, positioning, and colour through every backend. Each cell shows the
|
||||
styling that survives. <code>—</code> means that the backend cannot convert that pair.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -2748,14 +2749,14 @@ styling that survives; <code>—</code> means the backend cannot handle that pai
|
||||
<li><strong><code>pysubs2</code></strong>: keeps inline italic/underline on every pair, and bold except when
|
||||
writing SRT or WebVTT. It never carries positioning or colour. SSA/ASS is its native
|
||||
model, which makes it the best pick for SSA↔ASS.</li>
|
||||
<li><strong><code>subby</code></strong>: reads only WebVTT/fVTT/SAMI (never ASS) and is tuned for → SRT, where it
|
||||
uniquely converts WebVTT cue settings into <code>{\an8}</code> positioning. Its
|
||||
<li><strong><code>subby</code></strong>: reads only WebVTT/fVTT/SAMI (never ASS), and it is best for → SRT, where
|
||||
it uniquely converts WebVTT cue settings into <code>{\an8}</code> positioning. Its
|
||||
<code>CommonIssuesFixer</code> may also drop near-duplicate cues.</li>
|
||||
<li><strong><code>pycaption</code></strong>: strips all styling; last-resort fallback only.</li>
|
||||
<li><strong><code>pycaption</code></strong>: removes all styling. Last-resort fallback only.</li>
|
||||
</ul>
|
||||
<div class="admonition tip">
|
||||
<p class="admonition-title">What <code>auto</code> picks</p>
|
||||
<p><code>auto</code> prefers <code>subtitleedit</code> first when it is installed, then falls back to <code>subby</code>
|
||||
<p><code>auto</code> prefers <code>subtitleedit</code> first when you install it, then falls back to <code>subby</code>
|
||||
for → SRT and <code>pysubs2</code> otherwise. The one exception comes from the table above:
|
||||
for ASS/SSA → TTML or WebVTT it picks <code>pysubs2</code> even when SubtitleEdit is
|
||||
installed, since SubtitleEdit flattens inline styling on those pairs. Most installs
|
||||
@@ -2769,10 +2770,10 @@ highest → SRT fidelity.</p>
|
||||
it ships subtitles that a particular backend handles best). An explicit
|
||||
<code>conversion_method</code> in <code>unshackle.yaml</code> always overrides that per-track preference, so
|
||||
your config takes precedence. This only matters when a service ships a non-default
|
||||
preference; leave <code>conversion_method</code> at <code>auto</code> to let the service's hint stand.</p>
|
||||
preference. Leave <code>conversion_method</code> at <code>auto</code> to let the service's hint stand.</p>
|
||||
</div>
|
||||
<h2 id="muxed-vs-sidecar-output">Muxed vs. sidecar output<a class="headerlink" href="#muxed-vs-sidecar-output" title="Permanent link">¶</a></h2>
|
||||
<p>By default subtitles are muxed <strong>into</strong> the final <code>.mkv</code>. You can instead (or
|
||||
<p>By default unshackle muxes subtitles <strong>into</strong> the final <code>.mkv</code>. You can instead (or
|
||||
additionally) write them as separate sidecar files next to the video, controlled by the
|
||||
<a href="#subtitle-configuration"><code>output_mode</code></a> config key:</p>
|
||||
<div class="tabbed-set tabbed-alternate" data-tabs="1:3"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><input id="__tabbed_1_2" name="__tabbed_1" type="radio" /><input id="__tabbed_1_3" name="__tabbed_1" type="radio" /><div class="tabbed-labels"><label for="__tabbed_1_1">mux (default)</label><label for="__tabbed_1_2">sidecar</label><label for="__tabbed_1_3">both</label></div>
|
||||
@@ -2781,34 +2782,35 @@ additionally) write them as separate sidecar files next to the video, controlled
|
||||
<div class="language-yaml highlight"><span class="filename">unshackle.yaml</span><pre><span></span><code><span id="__span-7-1"><a id="__codelineno-7-1" name="__codelineno-7-1" href="#__codelineno-7-1"></a><span class="nt">subtitle</span><span class="p">:</span>
|
||||
</span><span id="__span-7-2"><a id="__codelineno-7-2" name="__codelineno-7-2" href="#__codelineno-7-2"></a><span class="w"> </span><span class="nt">output_mode</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">mux</span>
|
||||
</span></code></pre></div>
|
||||
<p>Subtitles are embedded in the Matroska file. Nothing is written separately.</p>
|
||||
<p>unshackle embeds the subtitles in the Matroska file. It writes nothing separately.</p>
|
||||
</div>
|
||||
<div class="tabbed-block">
|
||||
<div class="language-yaml highlight"><span class="filename">unshackle.yaml</span><pre><span></span><code><span id="__span-8-1"><a id="__codelineno-8-1" name="__codelineno-8-1" href="#__codelineno-8-1"></a><span class="nt">subtitle</span><span class="p">:</span>
|
||||
</span><span id="__span-8-2"><a id="__codelineno-8-2" name="__codelineno-8-2" href="#__codelineno-8-2"></a><span class="w"> </span><span class="nt">output_mode</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">sidecar</span>
|
||||
</span><span id="__span-8-3"><a id="__codelineno-8-3" name="__codelineno-8-3" href="#__codelineno-8-3"></a><span class="w"> </span><span class="nt">sidecar_format</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">srt</span>
|
||||
</span></code></pre></div>
|
||||
<p>Subtitles are written as standalone files and <strong>not</strong> muxed into the video (when
|
||||
there is a video or audio track to sit beside).</p>
|
||||
<p>unshackle writes the subtitles as standalone files and does <strong>not</strong> mux them into
|
||||
the video (when there is a video or audio track to sit beside).</p>
|
||||
</div>
|
||||
<div class="tabbed-block">
|
||||
<div class="language-yaml highlight"><span class="filename">unshackle.yaml</span><pre><span></span><code><span id="__span-9-1"><a id="__codelineno-9-1" name="__codelineno-9-1" href="#__codelineno-9-1"></a><span class="nt">subtitle</span><span class="p">:</span>
|
||||
</span><span id="__span-9-2"><a id="__codelineno-9-2" name="__codelineno-9-2" href="#__codelineno-9-2"></a><span class="w"> </span><span class="nt">output_mode</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">both</span>
|
||||
</span><span id="__span-9-3"><a id="__codelineno-9-3" name="__codelineno-9-3" href="#__codelineno-9-3"></a><span class="w"> </span><span class="nt">sidecar_format</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">srt</span>
|
||||
</span></code></pre></div>
|
||||
<p>Subtitles are muxed into the video <strong>and</strong> written as sidecar files.</p>
|
||||
<p>unshackle muxes the subtitles into the video <strong>and</strong> writes them as sidecar files.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>Sidecar files are named after the output file with the language and flags encoded in the
|
||||
name, so players and media managers can match them automatically:</p>
|
||||
<p>unshackle names sidecar files after the output file, with the language and flags encoded
|
||||
in the name, so players and media managers can match them automatically:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code><span id="__span-10-1"><a id="__codelineno-10-1" name="__codelineno-10-1" href="#__codelineno-10-1"></a>Show.S01E01.1080p.WEB.en.srt
|
||||
</span><span id="__span-10-2"><a id="__codelineno-10-2" name="__codelineno-10-2" href="#__codelineno-10-2"></a>Show.S01E01.1080p.WEB.en.forced.srt
|
||||
</span><span id="__span-10-3"><a id="__codelineno-10-3" name="__codelineno-10-3" href="#__codelineno-10-3"></a>Show.S01E01.1080p.WEB.en.sdh.srt
|
||||
</span></code></pre></div>
|
||||
<p>The pattern is <code>{base}.{language}[.forced][.sdh].{extension}</code>. The sidecar file format
|
||||
is set by <a href="#subtitle-configuration"><code>sidecar_format</code></a>; use a format name like <code>srt</code> or
|
||||
<code>vtt</code>, or <code>original</code> to keep each subtitle in its downloaded format.</p>
|
||||
<p>The pattern is <code>{base}.{language}[.forced][.sdh].{extension}</code>. The
|
||||
<a href="#subtitle-configuration"><code>sidecar_format</code></a> config key sets the sidecar file format. Use
|
||||
a format name like <code>srt</code> or <code>vtt</code>, or <code>original</code> to keep each subtitle in its downloaded
|
||||
format.</p>
|
||||
<h2 id="fonts-for-styled-subtitles">Fonts for styled subtitles<a class="headerlink" href="#fonts-for-styled-subtitles" title="Permanent link">¶</a></h2>
|
||||
<p>Styled SSA/ASS subtitles reference specific fonts by name. When unshackle muxes such a
|
||||
subtitle it scans it for the fonts it uses and attaches the matching font files to the
|
||||
@@ -2816,7 +2818,7 @@ Matroska output so the styling renders correctly on playback. If a referenced fo
|
||||
not available locally, unshackle logs the missing font names and suggests installing the
|
||||
relevant font packages.</p>
|
||||
<h2 id="subtitle-configuration">Subtitle configuration<a class="headerlink" href="#subtitle-configuration" title="Permanent link">¶</a></h2>
|
||||
<p>All of the behaviour above can be defaulted in the <code>subtitle</code> block of your
|
||||
<p>You can set defaults for all of the behaviour above in the <code>subtitle</code> block of your
|
||||
<a href="../../getting-started/configuration-file/">configuration file</a>:</p>
|
||||
<div class="language-yaml highlight"><span class="filename">unshackle.yaml</span><pre><span></span><code><span id="__span-11-1"><a id="__codelineno-11-1" name="__codelineno-11-1" href="#__codelineno-11-1"></a><span class="nt">subtitle</span><span class="p">:</span>
|
||||
</span><span id="__span-11-2"><a id="__codelineno-11-2" name="__codelineno-11-2" href="#__codelineno-11-2"></a><span class="w"> </span><span class="nt">strip_sdh</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span>
|
||||
@@ -2896,7 +2898,7 @@ relevant font packages.</p>
|
||||
<div class="admonition tip">
|
||||
<p class="admonition-title">SubtitleEdit is optional but recommended</p>
|
||||
<p>Several high-fidelity paths (the best-quality conversions and the SubtitleEdit SDH
|
||||
stripper) only activate when the SubtitleEdit CLI is installed and on your <code>PATH</code>.
|
||||
stripper) only activate when you install the SubtitleEdit CLI and put it on your <code>PATH</code>.
|
||||
See <a href="../../getting-started/installation/">Installation</a> for how to add it. Without it,
|
||||
unshackle falls back to its built-in Python backends.</p>
|
||||
</div>
|
||||
@@ -2911,25 +2913,25 @@ can stop here.</p>
|
||||
knowing when working with subtitle tracks in code:</p>
|
||||
<ul>
|
||||
<li><strong>Flags and validation</strong>: <code>Subtitle(codec=..., cc=..., sdh=..., forced=...)</code>. A track
|
||||
cannot be both <code>cc</code> and <code>sdh</code>, and <code>forced</code> cannot be combined with either; both raise
|
||||
cannot be both <code>cc</code> and <code>sdh</code>, and you cannot combine <code>forced</code> with either. Both raise
|
||||
<code>ValueError</code> at construction.</li>
|
||||
<li><strong><code>convert(codec, *, forced=False)</code></strong>: converts the downloaded file in place through
|
||||
the backend chain in <code>subtitle_convert.run_conversion</code>. <code>forced=True</code> (what
|
||||
<code>--sub-format</code> sets) is the only way lossy styled down-converts such as
|
||||
ASS→SRT are permitted. Raises <code>NotImplementedError</code> if no backend supports the pair and
|
||||
<code>--sub-format</code> sets) is the only way to permit lossy styled down-converts such as
|
||||
ASS→SRT. Raises <code>NotImplementedError</code> if no backend supports the pair and
|
||||
<code>RuntimeError</code> if all attempts fail.</li>
|
||||
<li><strong><code>strip_hearing_impaired()</code></strong>: removes SDH cues using the engine selected by
|
||||
<code>config.subtitle["sdh_method"]</code>.</li>
|
||||
<li><strong><code>reverse_rtl()</code></strong>: fixes right-to-left sentence-ending positioning via SubtitleEdit
|
||||
<li><strong><code>reverse_rtl()</code></strong>: fixes right-to-left sentence-ending positioning with SubtitleEdit
|
||||
(requires the binary).</li>
|
||||
<li><strong><code>parse(data, codec)</code></strong>: the central parser, returning a <code>pycaption.CaptionSet</code>; it
|
||||
<li><strong><code>parse(data, codec)</code></strong>: the central parser, returning a <code>pycaption.CaptionSet</code>. It
|
||||
handles the boxed DASH formats, SAMI, and the WebVTT repair helpers.</li>
|
||||
<li><strong><code>extract_fonts(text)</code></strong>: returns the set of font names referenced by an ASS/SSA
|
||||
subtitle, used to decide which fonts to attach at mux time.</li>
|
||||
</ul>
|
||||
<p>The conversion backends (<code>SubtitleEditBackend</code>, <code>SubbyBackend</code>, <code>Pysubs2Backend</code>,
|
||||
<code>PycaptionBackend</code>) each implement a small protocol (<code>is_available()</code>, <code>can_convert()</code>,
|
||||
<code>rank()</code>, <code>convert()</code>) and are tried in rank order, lowest rank first. See
|
||||
<code>PycaptionBackend</code>) each have a small protocol (<code>is_available()</code>, <code>can_convert()</code>,
|
||||
<code>rank()</code>, <code>convert()</code>), and unshackle tries them in rank order, lowest rank first. See
|
||||
<a href="../../reference/api/tracks/">the Tracks API reference</a> for the full model.</p>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user