Skip to content

Commit

Permalink
Add --no-attach-json opt
Browse files Browse the repository at this point in the history
  • Loading branch information
JuniorIsAJitterbug committed May 24, 2024
1 parent 72d873a commit adfc11e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/tbc_video_export/opts/opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class Opts(argparse.Namespace):
force_anamorphic: bool
force_black_level: tuple[int, int, int] | None
hwaccel_device: str | None
no_attach_json: bool
thread_queue_size: int
checksum: bool

Expand Down
7 changes: 7 additions & 0 deletions src/tbc_video_export/opts/opts_ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ def add_ffmpeg_opts(parent: argparse.ArgumentParser) -> None:
"\n\n",
)

ffmpeg_opts.add_argument(
"--no-attach-json",
action="store_true",
default=False,
help="Disable embedding the TBC json in the video file. (default: no).\n\n",
)

ffmpeg_opts.add_argument(
"--thread-queue-size",
type=int,
Expand Down
2 changes: 1 addition & 1 deletion src/tbc_video_export/process/wrapper/wrapper_ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def _get_metadata_opts(self) -> FlatList:
metadata_opts.append((f"-channel_layout:a:{idx}", f"{layout}"))

# attachment
if self._get_supports_attachments():
if self._get_supports_attachments() and not self._state.opts.no_attach_json:
metadata_opts.append(
(
"-attach",
Expand Down
26 changes: 26 additions & 0 deletions tests/test_wrappers_ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,32 @@ class TestWrappersFFmpeg:
input_opts=["--vbi"],
expected_str=["crop=iw:ih-19:0:17"],
),
WrapperTestCase(
id="embed tbc json",
input_tbc=f"{get_path('pal_svideo')}.tbc",
input_opts=[],
expected_opts=[
{
"-attach",
f"{get_path('pal_svideo')}.tbc.json",
"-metadata:s:t:0",
"mimetype=application/json",
}
],
),
WrapperTestCase(
id="disable embed tbc json",
input_tbc=f"{get_path('pal_svideo')}.tbc",
input_opts=["--no-attach-json"],
unexpected_opts=[
{
"-attach",
f"{get_path('pal_svideo')}.tbc.json",
"-metadata:s:t:0",
"mimetype=application/json",
}
],
),
]

test_cases = general_cases + hwaccel_cases + bitdepth_cases + filter_cases
Expand Down

0 comments on commit adfc11e

Please sign in to comment.