Welcome to FFsubsync’s documentation!

Indices and tables

Synchronize subtitles with video.

usage: ffsubsync [-h] [-i [SRTIN [SRTIN ...]]] [-o SRTOUT]
                 [--merge-with-reference] [--make-test-case]
                 [--reference-stream REFERENCE_STREAM] [-v]
                 [--overwrite-input] [--encoding ENCODING]
                 [--max-subtitle-seconds MAX_SUBTITLE_SECONDS]
                 [--start-seconds START_SECONDS]
                 [--max-offset-seconds MAX_OFFSET_SECONDS]
                 [--apply-offset-seconds APPLY_OFFSET_SECONDS]
                 [--frame-rate FRAME_RATE] [--skip-infer-framerate-ratio]
                 [--non-speech-label NON_SPEECH_LABEL]
                 [--output-encoding OUTPUT_ENCODING]
                 [--reference-encoding REFERENCE_ENCODING]
                 [--vad {subs_then_webrtc,webrtc,subs_then_auditok,auditok,subs_then_silero,silero}]
                 [--no-fix-framerate] [--serialize-speech]
                 [--extract-subs-from-stream EXTRACT_SUBS_FROM_STREAM]
                 [--suppress-output-if-offset-less-than SUPPRESS_OUTPUT_IF_OFFSET_LESS_THAN]
                 [--ffmpeg-path FFMPEG_PATH] [--log-dir-path LOG_DIR_PATH]
                 [--gss] [--strict]
                 [reference]

Positional Arguments

reference Reference (video, subtitles, or a numpy array with VAD speech) to which to synchronize input subtitles.

Named Arguments

-i, --srtin Input subtitles file (default=stdin).
-o, --srtout Output subtitles file (default=stdout).
--merge-with-reference, --merge
 

Merge reference subtitles with synced output subtitles.

Default: False

--make-test-case, --create-test-case
 

If specified, serialize reference speech to a numpy array, and create an archive with input/output subtitles and serialized speech.

Default: False

--reference-stream, --refstream, --reference-track, --reftrack
 Which stream/track in the video file to use as reference, formatted according to ffmpeg conventions. For example, 0:s:0 uses the first subtitle track; 0:a:3 would use the third audio track. You can also drop the leading 0:; i.e. use s:0 or a:3, respectively. Example: ffs ref.mkv -i in.srt -o out.srt –reference-stream s:2
-v, --version show program’s version number and exit
--overwrite-input
 

If specified, will overwrite the input srt instead of writing the output to a new file.

Default: False

--encoding

What encoding to use for reading input subtitles (default=infer).

Default: “infer”

--max-subtitle-seconds
 

Maximum duration for a subtitle to appear on-screen (default=10.000 seconds).

Default: 10

--start-seconds
 

Start time for processing (default=0 seconds).

Default: 0

--max-offset-seconds
 

The max allowed offset seconds for any subtitle segment (default=60 seconds).

Default: 60

--apply-offset-seconds
 

Apply a predefined offset in seconds to all subtitle segments (default=0 seconds).

Default: 0

--frame-rate

Frame rate for audio extraction (default=48000).

Default: 48000

--skip-infer-framerate-ratio
 

If set, do not try to infer framerate ratio based on duration ratio.

Default: False

--non-speech-label
 

Label to use for frames detected as non-speech (default=0.000000)

Default: 0.0

--output-encoding
 

What encoding to use for writing output subtitles (default=utf-8). Can indicate “same” to use same encoding as that of the input.

Default: “utf-8”

--reference-encoding
 What encoding to use for reading / writing reference subtitles (if applicable, default=infer).
--vad

Possible choices: subs_then_webrtc, webrtc, subs_then_auditok, auditok, subs_then_silero, silero

Which voice activity detector to use for speech extraction (if using video / audio as a reference, default=subs_then_webrtc).

--no-fix-framerate
 

If specified, subsync will not attempt to correct a framerate mismatch between reference and subtitles.

Default: False

--serialize-speech
 

If specified, serialize reference speech to a numpy array.

Default: False

--extract-subs-from-stream, --extract-subtitles-from-stream
 If specified, do not attempt sync; instead, just extract subtitles from the specified stream using the reference.
--suppress-output-if-offset-less-than
 If specified, do not produce output if offset below provided threshold.
--ffmpeg-path, --ffmpegpath
 Where to look for ffmpeg and ffprobe. Uses the system PATH by default.
--log-dir-path If provided, will save log file ffsubsync.log to this path (must be an existing directory).
--gss

If specified, use golden-section search to try to findthe optimal framerate ratio between video and subtitles.

Default: False

--strict

If specified, refuse to parse srt files with formatting issues.

Default: False