-
-
Notifications
You must be signed in to change notification settings - Fork 81
/
generate_screenshot_of_video.yml
48 lines (45 loc) · 1.56 KB
/
generate_screenshot_of_video.yml
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
# This example shows how to fill an image field with a 'screenshot' taken from a video field of the same content.
# In doing so, it makes use of an external tool, via executing it on the command-line.
#
# It is based on the 'video' content class having 3 fields:
# - 'file': the video file itself (type: media)
# - 'screenshot': the field that will hold the screenshot (type: image)
# - 'screenshot_frame': an integer field, used to specify the time in the video at which the screenshot is taken (type: integer)
# set references to the video-specific fields
-
type: content
mode: load
match:
content_id: 1234567890
references:
-
identifier: video_path
attribute: attributes.file.path
-
identifier: screenshot_path
attribute: attributes.screenshot.path
-
identifier: screenshot_frame
attribute: attributes.screenshot_frame
# run 'avconv' to generate the screenshot (avconv is a fork of ffmpeg, available by default on debian 8)
-
type: process
mode: run
command: avconv
arguments:
- '-i'
- 'reference:video_path'
- '-y'
- '-ss'
- 'reference:screenshot_frame'
# in real-life you should add a unique token to the filename, eg. the content id. See `eval: `
- '/tmp/test.jpg'
# upload the generated file to the screenshot field and re-publish the content
-
type: content
mode: update
match:
content_id: 1234567890
attributes:
screenshot:
path: "/tmp/test.jpg"