Skip to content

Commit

Permalink
Do not use -aspect when exporting
Browse files Browse the repository at this point in the history
Fixes #48
  • Loading branch information
JuniorIsAJitterbug committed Feb 8, 2024
1 parent 192f77e commit 4546e4b
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 27 deletions.
8 changes: 2 additions & 6 deletions src/tbc_video_export/process/wrapper/wrapper_ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,8 @@ def _get_aspect_ratio_opt(self) -> FlatList | None:

return (
FlatList(("-aspect", "16:9"))
if (
self._state.file_helper.tbc_json.is_widescreen
or self._state.opts.force_anamorphic
or self._state.opts.letterbox
)
else FlatList(("-aspect", "4:3"))
if (self._state.opts.force_anamorphic or self._state.opts.letterbox)
else None
)

def _get_color_opts(self) -> FlatList | None:
Expand Down
38 changes: 38 additions & 0 deletions tests/test_wrappers_ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,44 @@ def test_ffmpeg_add_filter_profile_opt(self) -> None: # noqa: D102

self.assertTrue(any(",bwdif" in cmds for cmds in cmd))

def test_ffmpeg_letterbox_opt(self) -> None: # noqa: D102
_, opts = self.parse_opts([str(self.path), "pal_svideo", "--letterbox"])
self.files = FileHelper(opts, self.config)
state = ProgramState(opts, self.config, self.files)

ffmpeg_wrapper = WrapperFFmpeg(
state,
WrapperConfig[tuple[Pipe], None](
state.current_export_mode,
TBCType.CHROMA,
input_pipes=(self.pipe, self.pipe),
output_pipes=None,
),
)

cmd = ffmpeg_wrapper.command.data

self.assertTrue({"-aspect", "16:9"}.issubset(cmd))

def test_ffmpeg_anamorphic_opt(self) -> None: # noqa: D102
_, opts = self.parse_opts([str(self.path), "pal_svideo", "--force-anamorphic"])
self.files = FileHelper(opts, self.config)
state = ProgramState(opts, self.config, self.files)

ffmpeg_wrapper = WrapperFFmpeg(
state,
WrapperConfig[tuple[Pipe], None](
state.current_export_mode,
TBCType.CHROMA,
input_pipes=(self.pipe, self.pipe),
output_pipes=None,
),
)

cmd = ffmpeg_wrapper.command.data

self.assertTrue({"-aspect", "16:9"}.issubset(cmd))

def test_ffmpeg_add_invalid_filter_profile_opt(self) -> None: # noqa: D102
with self.assertRaises(InvalidFilterProfileError):
_, __ = self.parse_opts(
Expand Down
3 changes: 0 additions & 3 deletions tests/test_wrappers_ntsc_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ def test_ffmpeg_opts_ntsc_cvbs(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace smpte170m",
"-color_primaries smpte170m",
Expand Down Expand Up @@ -289,7 +288,6 @@ def test_ffmpeg_opts_ntsc_cvbs_luma(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace smpte170m",
"-color_primaries smpte170m",
Expand Down Expand Up @@ -407,7 +405,6 @@ def test_ffmpeg_opts_ntsc_cvbs_luma_4fsc(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace smpte170m",
"-color_primaries smpte170m",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_wrappers_ntsc_composite_ld.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ def test_ffmpeg_opts_ntsc_ld(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace smpte170m",
"-color_primaries smpte170m",
Expand Down Expand Up @@ -307,7 +306,6 @@ def test_ffmpeg_opts_ntsc_ld_luma(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace smpte170m",
"-color_primaries smpte170m",
Expand Down Expand Up @@ -425,7 +423,6 @@ def test_ffmpeg_opts_ntsc_ld_luma_4fsc(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace smpte170m",
"-color_primaries smpte170m",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_wrappers_ntsc_svideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def test_ffmpeg_opts_ntsc_svideo(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace smpte170m",
"-color_primaries smpte170m",
Expand Down Expand Up @@ -296,7 +295,6 @@ def test_ffmpeg_opts_ntsc_svideo_luma(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace smpte170m",
"-color_primaries smpte170m",
Expand Down Expand Up @@ -414,7 +412,6 @@ def test_ffmpeg_opts_ntsc_svideo_luma_4fsc(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace smpte170m",
"-color_primaries smpte170m",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_wrappers_pal_composite_.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ def test_default_ffmpeg_opts_cvbs_pal(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate pal",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down Expand Up @@ -288,7 +287,6 @@ def test_ffmpeg_opts_pal_cvbs_luma(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate pal",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down Expand Up @@ -406,7 +404,6 @@ def test_ffmpeg_opts_pal_cvbs_luma_4fsc(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate pal",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_wrappers_pal_composite_ld.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def test_ffmpeg_opts_pal_ld(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate pal",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down Expand Up @@ -295,7 +294,6 @@ def test_ffmpeg_opts_pal_ld_luma(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate pal",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down Expand Up @@ -413,7 +411,6 @@ def test_ffmpeg_opts_pal_ld_luma_4fsc(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate pal",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_wrappers_pal_svideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ def test_ffmpeg_opts_pal_svideo(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate pal",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down Expand Up @@ -294,7 +293,6 @@ def test_ffmpeg_opts_pal_svideo_luma(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate pal",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down Expand Up @@ -412,7 +410,6 @@ def test_ffmpeg_opts_pal_svideo_luma_4fsc(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate pal",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_wrappers_palm_svideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ def test_ffmpeg_opts_palm_svideo(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down Expand Up @@ -294,7 +293,6 @@ def test_ffmpeg_opts_palm_svideo_luma(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down Expand Up @@ -412,7 +410,6 @@ def test_ffmpeg_opts_palm_svideo_luma_4fsc(self) -> None:
"-map [v_output]",
"-timecode 00:00:00:00",
"-framerate ntsc",
"-aspect 4:3",
"-color_range tv",
"-colorspace bt470bg",
"-color_primaries bt470bg",
Expand Down

0 comments on commit 4546e4b

Please sign in to comment.