feat: add stream-copy exports

This commit is contained in:
2026-08-16 09:29:47 +02:00
parent 8f354254b2
commit d5d74066b0
6 changed files with 264 additions and 47 deletions
+21
View File
@@ -54,6 +54,27 @@ def test_workers_spinbox_in_export_tab(win):
assert win._spn_workers in win._tab_export.findChildren(QSpinBox)
def test_clip_duration_allows_long_exports(win):
assert win._spn_clip_dur.maximum() >= 86400.0
def test_stream_copy_mode_disables_transforms(win):
win._file_path = "/x/source.mkv"
win._cmb_format.setCurrentText("WebP sequence")
win._chk_stream_copy.setChecked(True)
try:
assert win._stream_copy_active()
assert win._source_container_extension() == ".mkv"
assert win._cmb_format.currentText() == "MP4"
assert win._cmb_format.isHidden()
assert not win._chk_hw.isEnabled()
assert not win._spn_resize.isEnabled()
assert not win._cmb_portrait.isEnabled()
assert not win._chk_track.isEnabled()
finally:
win._chk_stream_copy.setChecked(False)
def test_scan_button_in_audio_tab(win):
from PyQt6.QtWidgets import QPushButton
assert win._btn_scan in win._tab_audio.findChildren(QPushButton)
+34
View File
@@ -18,6 +18,10 @@ def test_build_export_path_sub():
assert build_export_path("/out", "clip", 1, sub=0) == "/out/clip_001_0.mp4"
assert build_export_path("/out", "clip", 1, sub=2) == "/out/clip_001_2.mp4"
def test_build_export_path_custom_extension():
assert build_export_path("/out", "clip", 1, sub=0, extension=".mkv") == "/out/clip_001_0.mkv"
assert build_export_path("/out", "clip", 1, extension="mov") == "/out/clip_001.mov"
def test_build_sequence_dir_sub():
assert build_sequence_dir("/out", "clip", 1, sub=0) == "/out/clip_001_0"
assert build_sequence_dir("/out", "clip", 1, sub=1) == "/out/clip_001_1"
@@ -54,6 +58,36 @@ def test_ffmpeg_command_with_resize():
assert "scale" in vf_value
assert cmd[-1] == "/out/clip_001.mp4"
def test_ffmpeg_command_stream_copy():
cmd = build_ffmpeg_command(
"/in/video.mkv", 12.5, "/out/clip_001.mkv",
duration=3600.0, stream_copy=True,
)
assert cmd[cmd.index("-ss") + 1] == "12.5"
assert cmd[cmd.index("-t") + 1] == "3600.0"
assert cmd.index("-ss") < cmd.index("-i")
assert "-copyts" in cmd
assert "-start_at_zero" in cmd
assert cmd[cmd.index("-c") + 1] == "copy"
assert "-c:v" not in cmd
assert "-c:a" not in cmd
assert cmd[-1] == "/out/clip_001.mkv"
def test_ffmpeg_command_stream_copy_rejects_transforms():
import pytest
with pytest.raises(ValueError, match="Stream copy"):
build_ffmpeg_command(
"/in/video.mkv", 0.0, "/out/clip.mkv",
short_side=256, stream_copy=True,
)
def test_ffmpeg_command_stream_copy_mp4_uses_normal_timestamp_rebasing():
cmd = build_ffmpeg_command(
"/in/video.mp4", 12.5, "/out/clip.mp4", stream_copy=True,
)
assert "-copyts" not in cmd
assert "-start_at_zero" not in cmd
def test_audio_clip_command_exact_length():
cmd = build_audio_clip_command("/in/video.mp4", 12.5, 3.2, "/out/clip.wav")