1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
From 67308d8af542816f88f7500ed076fe8ecead2501 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Sat, 27 Jan 2018 14:25:27 +0100
Subject: [PATCH 3/3] timelapse: pick container and suffix based on setting
---
src/octoprint/timelapse.py | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/octoprint/timelapse.py b/src/octoprint/timelapse.py
index 0e01972..a1e59f7 100644
--- a/src/octoprint/timelapse.py
+++ b/src/octoprint/timelapse.py
@@ -42,7 +42,7 @@ current_render_job = None
# filename formats
_capture_format = "{prefix}-%d.jpg"
-_output_format = "{prefix}.mpg"
+_output_format = "{prefix}"
# old capture format, needed to delete old left-overs from
# versions <1.2.9
@@ -741,7 +741,7 @@ class TimelapseRenderJob(object):
render_job_lock = threading.RLock()
def __init__(self, capture_dir, output_dir, prefix, postfix=None, capture_glob="{prefix}-*.jpg",
- capture_format="{prefix}-%d.jpg", output_format="{prefix}{postfix}.mpg", fps=25, threads=1,
+ capture_format="{prefix}-%d.jpg", output_format="{prefix}{postfix}", fps=25, threads=1,
videocodec="mpeg2video", on_start=None, on_success=None, on_fail=None, on_always=None):
self._capture_dir = capture_dir
self._output_dir = output_dir
@@ -785,6 +785,11 @@ class TimelapseRenderJob(object):
output = os.path.join(self._output_dir,
self._output_format.format(prefix=self._prefix,
postfix=self._postfix if self._postfix is not None else ""))
+ if self._videocodec == 'mpeg2video':
+ suffix = ".mpg"
+ else:
+ suffix = ".mp4"
+ output = output + suffix
for i in range(4):
if os.path.exists(input % i):
@@ -858,10 +863,16 @@ class TimelapseRenderJob(object):
logger = logging.getLogger(__name__)
+ ### Not all players can handle non-mpeg2 in VOB format
+ if videocodec == 'mpeg2video':
+ containerformat = "vob"
+ else:
+ containerformat = "mp4"
+
command = [
ffmpeg, '-framerate', str(fps), '-loglevel', 'error', '-i', '"{}"'.format(input), '-vcodec', videocodec,
'-threads', str(threads), '-r', "25", '-y', '-b', str(bitrate),
- '-f', 'vob']
+ '-f', containerformat]
filter_string = cls._create_filter_string(hflip=hflip,
vflip=vflip,
--
2.0.1
|