Skip to content

Commit

Permalink
chore: fix typo (mli#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
hezhizhen authored Nov 15, 2022
1 parent 3e45222 commit 69b6a39
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions autocut/cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def write_md(self, videos):
for f in videos:
md_fn = utils.change_ext(f, 'md')
video_md = utils.MD(md_fn, self.args.encoding)
# select a few workds to scribe the video
# select a few words to scribe the video
desc = ''
if len(video_md.tasks()) > 1:
for _, t in video_md.tasks()[1:]:
Expand All @@ -36,7 +36,7 @@ def write_md(self, videos):
desc += m[0] + ' '
if len(desc) > 50:
break
md.add_task(False, f'[{base(f)}]({base(md_fn)}) {"[Editted]" if video_md.done_editing() else ""} {desc}')
md.add_task(False, f'[{base(f)}]({base(md_fn)}) {"[Edited]" if video_md.done_editing() else ""} {desc}')
md.write()

def run(self):
Expand Down Expand Up @@ -110,7 +110,7 @@ def run(self):

video = editor.VideoFileClip(fns['video'])

# Add a fade between two clips. Not quite necesary. keep code here for reference
# Add a fade between two clips. Not quite necessary. keep code here for reference
# fade = 0
# segments = _expand_segments(segments, fade, 0, video.duration)
# clips = [video.subclip(
Expand All @@ -125,6 +125,6 @@ def run(self):
final_clip = final_clip.without_audio().set_audio(aud)
final_clip = final_clip.fx(editor.afx.audio_normalize)

# an alterantive to birate is use crf, e.g. ffmpeg_params=['-crf', '18']
# an alternative to birate is use crf, e.g. ffmpeg_params=['-crf', '18']
final_clip.write_videofile(output_fn, audio_codec='aac', bitrate=self.args.bitrate)
logging.info(f'Saved video to {output_fn}')
8 changes: 4 additions & 4 deletions autocut/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def main():
action=argparse.BooleanOptionalAction)
parser.add_argument('-c', '--cut', help='Cut a video based on subtitles',
action=argparse.BooleanOptionalAction)
parser.add_argument('-d', '--daemon', help='Monitor a folder to trascribe and cut',
parser.add_argument('-d', '--daemon', help='Monitor a folder to transcribe and cut',
action=argparse.BooleanOptionalAction)
parser.add_argument('-s', help='Convert .srt to a compact format for easier editting',
parser.add_argument('-s', help='Convert .srt to a compact format for easier editing',
action=argparse.BooleanOptionalAction)
parser.add_argument('-m', '--to-md', help='Convert .srt to .md for easier editting',
parser.add_argument('-m', '--to-md', help='Convert .srt to .md for easier editing',
action=argparse.BooleanOptionalAction)
parser.add_argument('--lang', type=str, default='zh',
choices=['zh', 'en'],
Expand All @@ -42,7 +42,7 @@ def main():
help='Document encoding format')
parser.add_argument('--device', type=str, default=None,
choices=['cpu', 'cuda'],
help='Force to CPU or GPU for trascribing. In default automatically use GPU if available.')
help='Force to CPU or GPU for transcribing. In default automatically use GPU if available.')

args = parser.parse_args()

Expand Down
4 changes: 2 additions & 2 deletions autocut/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def run(self):

audio = whisper.load_audio(input, sr=self.sampling_rate)
speech_timestamps = self._detect_voice_activity(audio)
transcribe_results = self._transcibe(audio, speech_timestamps)
transcribe_results = self._transcribe(audio, speech_timestamps)

output = name + '.srt'
self._save_srt(output, transcribe_results)
Expand Down Expand Up @@ -65,7 +65,7 @@ def _detect_voice_activity(self, audio):
logging.info(f'Done voice activity detection in {time.time() - tic:.1f} sec')
return speeches

def _transcibe(self, audio, speech_timestamps):
def _transcribe(self, audio, speech_timestamps):
tic = time.time()
if self.whisper_model is None:
self.whisper_model = whisper.load_model(self.args.whisper_model, self.args.device)
Expand Down
2 changes: 1 addition & 1 deletion autocut/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _parse_task_status(self, line):
def check_exists(output, force):
if os.path.exists(output):
if force:
logging.info(f'{output} exists. Will ovewrite it')
logging.info(f'{output} exists. Will overwrite it')
else:
logging.info(f'{output} exists, skipping... Use the --force flag to overwrite')
return True
Expand Down

0 comments on commit 69b6a39

Please sign in to comment.