From 6e79a939cbd991292c748e02a22d8d1a9d55a0f3 Mon Sep 17 00:00:00 2001 From: Yukio Nozawa Date: Fri, 22 Mar 2024 23:19:21 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=93=E3=83=87=E3=82=AA=E3=82=AB=E3=83=83?= =?UTF-8?q?=E3=83=88=E7=B7=A8=E9=9B=86=E3=81=A7=E3=80=81=E8=A4=87=E6=95=B0?= =?UTF-8?q?=E3=81=AE=E3=82=B9=E3=83=88=E3=83=AA=E3=83=BC=E3=83=A0=E3=81=8C?= =?UTF-8?q?=E3=81=82=E3=82=8B=E3=81=A8=E3=81=8D=E3=81=AB=E6=9C=80=E5=88=9D?= =?UTF-8?q?=E3=81=AE1=E3=81=A4=E3=81=9A=E3=81=A4=E3=81=97=E3=81=8B?= =?UTF-8?q?=E6=8E=A1=E7=94=A8=E3=81=95=E3=82=8C=E3=81=AA=E3=81=8B=E3=81=A3?= =?UTF-8?q?=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/ffmpegCommand.py | 4 ++++ test/domain_test/testFfmpegCommand.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/domain/ffmpegCommand.py b/domain/ffmpegCommand.py index fb38bd9..271c303 100644 --- a/domain/ffmpegCommand.py +++ b/domain/ffmpegCommand.py @@ -118,6 +118,8 @@ def cutVideoCommand(task): "0", "-i", os.path.join(tempdirRoot(), "concats", "%s_parts.txt" % withoutExtension), + "-map", + "0", "-c", "copy", task.nthStep(3).getValue() @@ -141,6 +143,8 @@ def makeCutCommand(input, start, end, part): withoutExtension = os.path.basename(input).split(".")[0] extension = os.path.basename(input).split(".")[1] cmd.extend([ + "-map", + "0", "-c", "copy", os.path.join(root, "concats", "%s_part%d.%s" % (withoutExtension, part, extension)) diff --git a/test/domain_test/testFfmpegCommand.py b/test/domain_test/testFfmpegCommand.py index 5e0669b..6401f20 100644 --- a/test/domain_test/testFfmpegCommand.py +++ b/test/domain_test/testFfmpegCommand.py @@ -28,9 +28,9 @@ def test_cutVideoCommand(self): set = chain.nthCommandSet(1) self.assertEqual(set.countCommands(), 2) cmd = " ".join(set.nthCommand(1).command) - self.assertEqual(cmd, "ffmpeg -y -i test.mp4 -ss 00:00:00.000 -to 00:00:01.000 -c copy %s" % os.path.join(concatDir, "test_part1.mp4")) + self.assertEqual(cmd, "ffmpeg -y -i test.mp4 -ss 00:00:00.000 -to 00:00:01.000 -map 0 -c copy %s" % os.path.join(concatDir, "test_part1.mp4")) cmd = " ".join(set.nthCommand(2).command) - self.assertEqual(cmd, "ffmpeg -y -i test.mp4 -ss 00:00:02.000 -c copy %s" % os.path.join(concatDir, "test_part2.mp4")) + self.assertEqual(cmd, "ffmpeg -y -i test.mp4 -ss 00:00:02.000 -map 0 -c copy %s" % os.path.join(concatDir, "test_part2.mp4")) def test_cutVideoCommand_cuttingFromTop(self): task = domain.CutVideoTask() @@ -45,4 +45,4 @@ def test_cutVideoCommand_cuttingFromTop(self): set = chain.nthCommandSet(1) self.assertEqual(set.countCommands(), 1) cmd = " ".join(set.nthCommand(1).command) - self.assertEqual(cmd, "ffmpeg -y -i test.mp4 -ss 00:00:02.000 -c copy %s" % os.path.join(concatDir, "test_part1.mp4")) + self.assertEqual(cmd, "ffmpeg -y -i test.mp4 -ss 00:00:02.000 -map 0 -c copy %s" % os.path.join(concatDir, "test_part1.mp4"))