diff options
author | Christian Pointner <equinox@spreadspace.org> | 2021-04-04 23:11:24 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2021-04-04 23:11:24 +0200 |
commit | fb2a5231a69f753301ecf962a419e10893cd54bb (patch) | |
tree | 2ebcc1d433bc871c05342639e9ed751a99485ca0 /roles/streaming/recorder | |
parent | use path_join filter to build zfs mountpoints (diff) |
add new streaming recorder role
Diffstat (limited to 'roles/streaming/recorder')
-rw-r--r-- | roles/streaming/recorder/defaults/main.yml | 16 | ||||
-rw-r--r-- | roles/streaming/recorder/tasks/main.yml | 22 | ||||
-rw-r--r-- | roles/streaming/recorder/templates/pod-spec.yml.j2 | 72 |
3 files changed, 110 insertions, 0 deletions
diff --git a/roles/streaming/recorder/defaults/main.yml b/roles/streaming/recorder/defaults/main.yml new file mode 100644 index 00000000..6bcfde17 --- /dev/null +++ b/roles/streaming/recorder/defaults/main.yml @@ -0,0 +1,16 @@ +--- +# recorder_storage: +# type: (lvm|zfs) +# ... +recorder_base_path: /srv/recorder + +# recorder_inst_name: feed +# recorder_ffmpeg_image_version: 2021-02-24.7 +# recorder_decklink_card: "DeckLink Mini Recorder" +# recorder_decklink_format_code: Hp25 +recorder_audio_channels: 2 +recorder_audio_bitrate: 256k +recorder_video_crf: 16 + +recorder_segment_time: 3600 +recorder_segment_clocktime_offset: 0 diff --git a/roles/streaming/recorder/tasks/main.yml b/roles/streaming/recorder/tasks/main.yml new file mode 100644 index 00000000..ee682b89 --- /dev/null +++ b/roles/streaming/recorder/tasks/main.yml @@ -0,0 +1,22 @@ +--- +- name: prepare recorder storage volume + when: recorder_storage is defined + vars: + storage_volume: "{{ recorder_storage | combine({'dest': recorder_base_path}) }}" + include_role: + name: "storage/{{ recorder_storage.type }}/volume" + +- name: create recorder instance directory + file: + path: "{{ recorder_base_path }}/{{ recorder_inst_name }}" + state: directory + owner: app + group: app + +- name: install pod manifest + vars: + kubernetes_standalone_pod: + name: "recorder-{{ recorder_inst_name }}" + spec: "{{ lookup('template', 'pod-spec.yml.j2') }}" + include_role: + name: kubernetes/standalone/pod diff --git a/roles/streaming/recorder/templates/pod-spec.yml.j2 b/roles/streaming/recorder/templates/pod-spec.yml.j2 new file mode 100644 index 00000000..92f6ce36 --- /dev/null +++ b/roles/streaming/recorder/templates/pod-spec.yml.j2 @@ -0,0 +1,72 @@ +containers: +- name: record + image: registry.gitlab.com/spreadspace/docker/ffmpeg:{{ recorder_ffmpeg_image_version }} + imagePullPolicy: Always + command: + - /usr/bin/ffmpeg + args: + - -f + - decklink + - -format_code + - '{{ recorder_decklink_format_code }}' + - -ac + - '{{ recorder_audio_channels }}' + - -i + - '{{ recorder_decklink_card }}' + - -c:a + - aac + - -b:a + - '{{ recorder_audio_bitrate }}' + - -g + - '1' + - -c:v + - libx264 + - -crf + - '{{ recorder_video_crf }}' + - -x264-params + - 'colorprim=bt709:transfer=bt709:colormatrix=bt709:fullrange=off' + - -f + - segment + - -segment_atclocktime + - '1' + - -segment_time + - '{{ recorder_segment_time }}' + - -segment_clocktime_offset + - '{{ recorder_segment_clocktime_offset }}' + - -strftime + - '1' + - -reset_timestamps + - '1' + - '%Y-%m-%d_%H-%M-%S.mkv' + workingDir: /srv + securityContext: + privileged: true + volumeMounts: + - name: home + mountPath: /srv + - name: decklink-device + mountPath: /dev/blackmagic + - name: decklink-libs + subPath: libDeckLinkAPI.so + mountPath: /usr/lib/libDeckLinkAPI.so + readOnly: true + - name: decklink-libs + subPath: libDeckLinkPreviewAPI.so + mountPath: /usr/lib/libDeckLinkPreviewAPI.so + readOnly: true + - name: decklink-libs + subPath: blackmagic + mountPath: /usr/lib/blackmagic + readOnly: true + +volumes: +- name: home + hostPath: + path: "{{ recorder_base_path }}/{{ recorder_inst_name }}" +- name: decklink-device + hostPath: + path: /dev/blackmagic +- name: decklink-libs + hostPath: + type: Directory + path: /usr/lib/ |