Skip to content

Commit

Permalink
update history and add cmdline arg to skip framerate ratio inference
Browse files Browse the repository at this point in the history
  • Loading branch information
smacke committed Jan 18, 2021
1 parent c01c3c3 commit e33f117
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,10 @@ History
* Add experimental section for using golden section search to find framerate ratio;
* Restore ability to read stdin and write stdout after buggy permissions check;
* Exceptions that occur during syncing were mistakenly suppressed; this is now fixed;

0.4.10 (2021-01-18)
-------------------
* Reduce max_offset_seconds (improves sync in most cases);
* Filter out metadata in subtitles when extracting speech;
* Add experimental --golden-section-search over framerate ratio (off by default);
* Try to improve sync by inferring framerate ratio based on relative duration of synced vs unsynced;
11 changes: 7 additions & 4 deletions ffsubsync/ffsubsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ def try_sync(args, reference_pipe, result):
continue
else:
srt_pipe.fit(srtin)
inferred_framerate_ratio_from_length = float(reference_pipe[-1].num_frames) / srt_pipes[0][-1].num_frames
logger.info('inferred frameratio ratio: %.3f' % inferred_framerate_ratio_from_length)
srt_pipes.append(srt_pipe_maker(inferred_framerate_ratio_from_length).fit(srtin))
logger.info('...done')
if not args.skip_infer_framerate_ratio:
inferred_framerate_ratio_from_length = float(reference_pipe[-1].num_frames) / srt_pipes[0][-1].num_frames
logger.info('inferred frameratio ratio: %.3f' % inferred_framerate_ratio_from_length)
srt_pipes.append(srt_pipe_maker(inferred_framerate_ratio_from_length).fit(srtin))
logger.info('...done')
logger.info('computing alignments...')
if args.skip_sync:
best_score = 0.
Expand Down Expand Up @@ -389,6 +390,8 @@ def add_cli_only_args(parser):
'(default=%d seconds).' % DEFAULT_APPLY_OFFSET_SECONDS)
parser.add_argument('--frame-rate', type=int, default=DEFAULT_FRAME_RATE,
help='Frame rate for audio extraction (default=%d).' % DEFAULT_FRAME_RATE)
parser.add_argument('--skip-infer-framerate-ratio', action='store_true',
help='If set, do not try to infer framerate ratio based on duration ratio.')
parser.add_argument('--output-encoding', default='utf-8',
help='What encoding to use for writing output subtitles '
'(default=utf-8). Can indicate "same" to use same '
Expand Down

0 comments on commit e33f117

Please sign in to comment.