Add a media role for image/video viewers/editors.

This commit is contained in:
Tom Alexander 2022-11-26 18:41:41 -05:00
parent ef6a89042f
commit 1c41d23474
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
13 changed files with 134 additions and 0 deletions

View File

@ -28,3 +28,4 @@
- autofs
- exfat
- bhyve
- media

View 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

View 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

View 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

View File

@ -0,0 +1,2 @@
dependencies:
- users

View 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

View 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

View 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

View File

@ -0,0 +1,5 @@
- name: Install packages
package:
name:
- youtube-dl
state: present

View File

@ -0,0 +1 @@
- import_tasks: tasks/common.yaml

View 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"'