Skip to content

Commit

Permalink
ビデオカット編集で、複数のストリームがあるときに最初の1つずつしか採用されなかったのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
yncat committed Mar 22, 2024
1 parent dbb10ce commit 6e79a93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions domain/ffmpegCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions test/domain_test/testFfmpegCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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"))

0 comments on commit 6e79a93

Please sign in to comment.