Add a media role for image/video viewers/editors.
This commit is contained in:
parent
ef6a89042f
commit
1c41d23474
@ -28,3 +28,4 @@
|
||||
- autofs
|
||||
- exfat
|
||||
- bhyve
|
||||
- media
|
||||
|
11
ansible/roles/media/files/cast_file_intel
Normal file
11
ansible/roles/media/files/cast_file_intel
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
|
||||
ffmpeg -re -vaapi_device /dev/dri/renderD128 -i "$1" -vf 'format=nv12,hwupload' -c:v h264_vaapi -r 30 -g 30 -loop -1 -c:a aac -b:a 160k -ar 44100 -strict -2 -f flv rtmp:172.16.16.44/live/test &
|
||||
ffmpegpid=$!
|
||||
|
||||
sleep 1
|
||||
castnow --exit 'https://broadcast.fizz.buzz/hls/hls/test.m3u8'
|
||||
wait "$ffmpegpid"
|
||||
|
||||
sleep 10
|
11
ansible/roles/media/files/cast_file_nvidia
Normal file
11
ansible/roles/media/files/cast_file_nvidia
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
|
||||
ffmpeg -re -i "$1" -vcodec h264_nvenc -r 30 -g 30 -loop -1 -c:a aac -b:a 160k -ar 44100 -strict -2 -f flv rtmp:172.16.16.44/live/test &
|
||||
ffmpegpid=$!
|
||||
|
||||
sleep 1
|
||||
castnow --exit 'https://broadcast.fizz.buzz/hls/hls/test.m3u8'
|
||||
wait "$ffmpegpid"
|
||||
|
||||
sleep 10
|
25
ansible/roles/media/files/mpv.conf
Normal file
25
ansible/roles/media/files/mpv.conf
Normal file
@ -0,0 +1,25 @@
|
||||
# To debug hardware video acceleration:
|
||||
# mpv --hwdec=auto --msg-level=vd=v,vo=v,vo/gpu/vaapi-egl=trace
|
||||
|
||||
# GPU Decoding
|
||||
hwdec=auto
|
||||
# Allow CPU processing via filters:
|
||||
#hwdec=auto-copy
|
||||
|
||||
# Use higher quality gpu rendering
|
||||
profile=gpu-hq
|
||||
scale=ewa_lanczossharp
|
||||
cscale=ewa_lanczossharp
|
||||
|
||||
# Instead of dropping frames, re-sample audio which may cause a slight pitch change
|
||||
# ISSUE: caused frame stutter on Louie S01E03
|
||||
# video-sync=display-resample
|
||||
|
||||
# Make motion smoother when video frame rate != monitor refresh rate
|
||||
interpolation
|
||||
tscale=oversample
|
||||
|
||||
# Load a lot of the file into memory
|
||||
# cache=yes
|
||||
# demuxer-max-bytes=123400KiB
|
||||
# demuxer-readahead-secs=20
|
2
ansible/roles/media/meta/main.yaml
Normal file
2
ansible/roles/media/meta/main.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- users
|
32
ansible/roles/media/tasks/common.yaml
Normal file
32
ansible/roles/media/tasks/common.yaml
Normal file
@ -0,0 +1,32 @@
|
||||
- name: Install packages
|
||||
package:
|
||||
name:
|
||||
- ffmpeg # for cast_file
|
||||
state: present
|
||||
|
||||
- name: Install packages
|
||||
when: install_graphics
|
||||
package:
|
||||
name:
|
||||
- mpv
|
||||
- evince
|
||||
- gimp
|
||||
- imv # image viewer
|
||||
state: present
|
||||
|
||||
- include_tasks: "tasks/{{graphics_driver}}.yaml"
|
||||
|
||||
- import_tasks: tasks/freebsd.yaml
|
||||
when: 'os_flavor == "freebsd"'
|
||||
|
||||
- import_tasks: tasks/linux.yaml
|
||||
when: 'os_flavor == "linux"'
|
||||
|
||||
- include_tasks:
|
||||
file: tasks/peruser.yaml
|
||||
apply:
|
||||
become: yes
|
||||
become_user: "{{ initialize_user }}"
|
||||
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}"
|
||||
loop_control:
|
||||
loop_var: initialize_user
|
7
ansible/roles/media/tasks/freebsd.yaml
Normal file
7
ansible/roles/media/tasks/freebsd.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
- name: Install packages
|
||||
package:
|
||||
name:
|
||||
# Have to use yt-dlp instead of youtube_dl because of mpv
|
||||
# - youtube_dl
|
||||
- yt-dlp
|
||||
state: present
|
10
ansible/roles/media/tasks/intel.yaml
Normal file
10
ansible/roles/media/tasks/intel.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
- name: Install scripts
|
||||
copy:
|
||||
src: "files/{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: wheel
|
||||
loop:
|
||||
- src: cast_file_intel
|
||||
dest: /usr/local/bin/cast_file
|
5
ansible/roles/media/tasks/linux.yaml
Normal file
5
ansible/roles/media/tasks/linux.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
- name: Install packages
|
||||
package:
|
||||
name:
|
||||
- youtube-dl
|
||||
state: present
|
1
ansible/roles/media/tasks/main.yaml
Normal file
1
ansible/roles/media/tasks/main.yaml
Normal file
@ -0,0 +1 @@
|
||||
- import_tasks: tasks/common.yaml
|
29
ansible/roles/media/tasks/peruser.yaml
Normal file
29
ansible/roles/media/tasks/peruser.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
- include_role:
|
||||
name: per_user
|
||||
|
||||
- name: Create directories
|
||||
file:
|
||||
name: "{{ account_homedir.stdout }}/{{ item }}"
|
||||
state: directory
|
||||
mode: 0700
|
||||
owner: "{{ account_name.stdout }}"
|
||||
group: "{{ group_name.stdout }}"
|
||||
loop:
|
||||
- ".config/mpv"
|
||||
|
||||
- name: Copy files
|
||||
copy:
|
||||
src: "files/{{ item.src }}"
|
||||
dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
|
||||
mode: 0600
|
||||
owner: "{{ account_name.stdout }}"
|
||||
group: "{{ group_name.stdout }}"
|
||||
loop:
|
||||
- src: mpv.conf
|
||||
dest: .config/mpv/mpv.conf
|
||||
|
||||
- import_tasks: tasks/peruser_freebsd.yaml
|
||||
when: 'os_flavor == "freebsd"'
|
||||
|
||||
- import_tasks: tasks/peruser_linux.yaml
|
||||
when: 'os_flavor == "linux"'
|
0
ansible/roles/media/tasks/peruser_freebsd.yaml
Normal file
0
ansible/roles/media/tasks/peruser_freebsd.yaml
Normal file
0
ansible/roles/media/tasks/peruser_linux.yaml
Normal file
0
ansible/roles/media/tasks/peruser_linux.yaml
Normal file
Loading…
Reference in New Issue
Block a user