Skip to content

Commit

Permalink
Make sure .mp4 can have subtitles
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Aug 16, 2024
1 parent a855e6f commit 3bbe9ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion auto_editor/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ def make_media(tl: v3, output: str) -> None:
apply_later = False

ensure = Ensure(ffmpeg, bar, samplerate, log)

if ctr.default_sub != "none" and not args.sn:
sub_output = make_new_subtitles(tl, ensure, log.temp)

Expand Down
8 changes: 8 additions & 0 deletions auto_editor/subcommands/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,13 @@ def import_v1_tests():
def premiere_named_export():
run.main(["example.mp4"], ["--export", 'premiere:name="Foo Bar"'])

def export_subtitles():
cn = fileinfo(run.main(["resources/subtitle.mp4"], []))

assert len(cn.videos) == 1
assert len(cn.audios) == 1
assert len(cn.subtitles) == 1

def resolution_and_scale():
cn = fileinfo(run.main(["example.mp4"], ["--scale", "1.5"]))

Expand Down Expand Up @@ -743,6 +750,7 @@ def palet_scripts():
track_tests,
codec_tests,
premiere_named_export,
export_subtitles,
export,
motion,
resolution_and_scale,
Expand Down
2 changes: 2 additions & 0 deletions auto_editor/utils/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def container_constructor(ext: str) -> Container:
vdefault = container.default_video_codec
adefault = container.default_audio_codec
sdefault = container.default_subtitle_codec
if sdefault == "none" and ext == "mp4":
sdefault = "srt"

vcodecs = set()
acodecs = set()
Expand Down

0 comments on commit 3bbe9ab

Please sign in to comment.