summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Kocialkowski2022-10-28 15:30:35 +0200
committerPaul Kocialkowski2022-10-28 15:40:14 +0200
commit54399b6bf0810f4d3eab6aa8fc17df1f835b6de3 (patch)
tree517e6931ff35b0ac13ce2b9bf2cc2367fe2a5a7d
parent22a87b7a561a50681b90540cc69849cf6eacdb3e (diff)
capture-pipeline: Update from ytp-alimentation
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rwxr-xr-xcapture-pipeline55
1 files changed, 38 insertions, 17 deletions
diff --git a/capture-pipeline b/capture-pipeline
index 85e663f..0c85e85 100755
--- a/capture-pipeline
+++ b/capture-pipeline
@@ -7,6 +7,14 @@ import datetime
import subprocess
import yaml
+# utils
+
+def selection_skip(element):
+ if "selection" in element and element["selection"] == "skip":
+ return True
+
+ return False
+
# settings
settings = {}
@@ -164,15 +172,7 @@ def audio_ffmpeg_command(sequence, shot, take, part):
source_path = audio_source_path(sequence, shot, take)
output_path = audio_output_path(sequence, shot, take, part)
- ffmpeg_command = [ "ffmpeg", "-i", source_path ]
-
- encoder = settings_entry(shot, "audio-encoder")
- if encoder:
- ffmpeg_command += [ "-c:a", encoder ]
-
- filters = settings_entry(shot, "audio-filters")
- if filters:
- ffmpeg_command += [ "-filter:a", ",".join(filters) ]
+ ffmpeg_command = [ "ffmpeg" ]
if "audio-start" in part:
ffmpeg_command += [ "-ss", part["audio-start"] ]
@@ -194,6 +194,16 @@ def audio_ffmpeg_command(sequence, shot, take, part):
ffmpeg_command += [ "-to", timecode_string(audio_stop_seconds) ]
+ ffmpeg_command += [ "-i", source_path ]
+
+ encoder = settings_entry(shot, "audio-encoder")
+ if encoder:
+ ffmpeg_command += [ "-c:a", encoder ]
+
+ filters = settings_entry(shot, "audio-filters")
+ if filters:
+ ffmpeg_command += [ "-filter:a", ",".join(filters) ]
+
ffmpeg_command += [ output_path ]
return ffmpeg_command
@@ -220,6 +230,9 @@ def audio_process(sequence, shot, take, part):
audio_output_prepare(sequence)
audio_output_step(sequence, shot, take, part)
+ if selection_skip(take) or selection_skip(part):
+ return
+
print(" ".join(command))
if os.path.isfile(output_path):
@@ -327,7 +340,15 @@ def video_ffmpeg_command(sequence, shot, take, part):
source_path = video_source_path(sequence, shot, take)
output_path = video_output_path(sequence, shot, take, part)
- ffmpeg_command = [ "ffmpeg", "-i", source_path ]
+ ffmpeg_command = [ "ffmpeg" ]
+
+ if "video-start" in part:
+ ffmpeg_command += [ "-ss", part["video-start"] ]
+
+ if "video-stop" in part:
+ ffmpeg_command += [ "-to", part["video-stop"] ]
+
+ ffmpeg_command += [ "-i", source_path ]
width = settings_entry(shot, "video-width")
height = settings_entry(shot, "video-height")
@@ -364,12 +385,6 @@ def video_ffmpeg_command(sequence, shot, take, part):
if audio == "remove":
ffmpeg_command += [ "-an" ]
- if "video-start" in part:
- ffmpeg_command += [ "-ss", part["video-start"] ]
-
- if "video-stop" in part:
- ffmpeg_command += [ "-to", part["video-stop"] ]
-
ffmpeg_command += [ output_path ]
return ffmpeg_command
@@ -396,6 +411,9 @@ def video_process(sequence, shot, take, part):
video_output_prepare(sequence)
video_output_step(sequence, shot, take, part)
+ if selection_skip(take) or selection_skip(part):
+ return
+
print(" ".join(command))
if os.path.isfile(output_path):
@@ -466,7 +484,10 @@ def shot_name(shot):
label = shot_label(shot)
if label:
- return prefix + "-" + label
+ if prefix:
+ return prefix + "-" + label
+ else:
+ return label
else:
return prefix