1 parent
7e37569613
commit
983dd4d437
5 files changed
+23
-21
No files matched your search
@@ -548,6 +548,13 @@ def _saveSettings(data):
|
||||
s.set(["webcam", "ffmpeg"], data["webcam"]["ffmpegPath"])
|
||||
if "ffmpegCommandline" in data["webcam"]:
|
||||
commandline = data["webcam"]["ffmpegCommandline"]
|
||||
if not all(
|
||||
map(lambda x: "{" + x + "}" in commandline, ("ffmpeg", "input", "output"))
|
||||
):
|
||||
abort(
|
||||
400,
|
||||
description="Invalid webcam.ffmpegCommandline setting, lacks mandatory {ffmpeg}, {input} or {output}",
|
||||
)
|
||||
try:
|
||||
commandline.format(
|
||||
ffmpeg="ffmpeg",
|
||||
@@ -558,6 +565,7 @@ def _saveSettings(data):
|
||||
output="output",
|
||||
videocodec="videocodec",
|
||||
containerformat="containerformat",
|
||||
filters="filters",
|
||||
)
|
||||
except Exception:
|
||||
# some invalid data we'll refuse to set
|
||||
|
||||
@@ -256,7 +256,7 @@ default_settings = {
|
||||
"flipH": False,
|
||||
"flipV": False,
|
||||
"rotate90": False,
|
||||
"ffmpegCommandline": '{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y',
|
||||
"ffmpegCommandline": '{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y {filters} "{output}"',
|
||||
"timelapse": {
|
||||
"type": "off",
|
||||
"options": {},
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: webcam_ffmpegCommandline" id="settings-webcamFfmpegCommandline">
|
||||
<span class="help-block">{% trans %}
|
||||
FFMPEG command line to use. You can adjust the full FFMPEG command here that
|
||||
You can adjust the full FFMPEG command line here that
|
||||
is used to generate the timelapse recordings, e.g. to add additional command line
|
||||
parameters as needed. Supported placeholders are:
|
||||
<code>{ffmpeg}</code> (configured path to ffmpeg), <code>{fps}</code> (configured framerate),
|
||||
<code>{input}</code> (input files), <code>{videocodec}</code> (configured video codec to use),
|
||||
<code>{threads}</code> (configured number of threads to use), <code>{bitrate}</code> (configured bitrate to use),
|
||||
<code>{containerformat}</code> (configured container format to use).
|
||||
<code>{containerformat}</code> (configured container format to use), <code>{filters}</code> (filter chain for flip/rotate & watermark),
|
||||
<code>{output}</code> (output file).
|
||||
{% endtrans %}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1166,30 +1166,23 @@ class TimelapseRenderJob(object):
|
||||
else:
|
||||
containerformat = "mp4"
|
||||
|
||||
filter_string = cls._create_filter_string(
|
||||
hflip=hflip, vflip=vflip, rotate=rotate, watermark=watermark
|
||||
)
|
||||
placeholders = {
|
||||
"ffmpeg": ffmpeg,
|
||||
"fps": str(fps),
|
||||
"input": input,
|
||||
"output": output,
|
||||
"videocodec": videocodec,
|
||||
"threads": str(threads),
|
||||
"bitrate": str(bitrate),
|
||||
"containerformat": containerformat,
|
||||
"filters": "-vf " + sarge.shell_quote(filter_string) if filter_string else "",
|
||||
}
|
||||
|
||||
command = commandline.format(**placeholders)
|
||||
|
||||
filter_string = cls._create_filter_string(
|
||||
hflip=hflip, vflip=vflip, rotate=rotate, watermark=watermark
|
||||
)
|
||||
if filter_string is not None:
|
||||
logger.debug("Applying videofilter chain: {}".format(filter_string))
|
||||
command += " -vf " + sarge.shell_quote(filter_string)
|
||||
|
||||
# finalize command with output file
|
||||
logger.debug("Rendering movie to {}".format(output))
|
||||
command += ' "{}"'.format(output)
|
||||
|
||||
return command
|
||||
return commandline.format(**placeholders)
|
||||
|
||||
@classmethod
|
||||
def _create_filter_string(
|
||||
|
||||
@@ -16,7 +16,7 @@ class TimelapseRenderJobTest(unittest.TestCase):
|
||||
@data(
|
||||
(
|
||||
(
|
||||
'{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y',
|
||||
'{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y {filters} "{output}"',
|
||||
"/path/to/ffmpeg",
|
||||
25,
|
||||
"10000k",
|
||||
@@ -30,7 +30,7 @@ class TimelapseRenderJobTest(unittest.TestCase):
|
||||
),
|
||||
(
|
||||
(
|
||||
'{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y -g 5',
|
||||
'{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y -g 5 {filters} "{output}"',
|
||||
"/path/to/ffmpeg",
|
||||
25,
|
||||
"10000k",
|
||||
@@ -44,7 +44,7 @@ class TimelapseRenderJobTest(unittest.TestCase):
|
||||
),
|
||||
(
|
||||
(
|
||||
'{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y',
|
||||
'{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y {filters} "{output}"',
|
||||
"/path/to/ffmpeg",
|
||||
25,
|
||||
"10000k",
|
||||
@@ -58,7 +58,7 @@ class TimelapseRenderJobTest(unittest.TestCase):
|
||||
),
|
||||
(
|
||||
(
|
||||
'{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y',
|
||||
'{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y {filters} "{output}"',
|
||||
"/path/to/ffmpeg",
|
||||
25,
|
||||
"10000k",
|
||||
@@ -72,7 +72,7 @@ class TimelapseRenderJobTest(unittest.TestCase):
|
||||
),
|
||||
(
|
||||
(
|
||||
'{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y',
|
||||
'{ffmpeg} -r {fps} -i "{input}" -vcodec {videocodec} -threads {threads} -b {bitrate} -f {containerformat} -y {filters} "{output}"',
|
||||
"/path/to/ffmpeg",
|
||||
25,
|
||||
"20000k",
|
||||
|
||||
Reference in new issue
Block a user