--- # looks like ffmpeg can do it # Create service Folder - name: "video_capture - streamer - create {{ streaming_working_folder }} folder" file: path: "{{ streaming_working_folder }}" state: directory mode: '0755' owner: root group: root # this service shouldn't stay running - name: video_capture - streamer - stop stream_service if running systemd: name: stream_service.service state: stopped ignore_errors: yes # gonna try to automatically find the audio info # the card is MS201 - name: video_capture - get card ID shell: "arecord -l | grep {{ capture_device_ID_string }} | cut -d: -f1 | rev | cut -b 1" register: sound_ID_0 - name: video_capture - get device ID shell: "arecord -l | grep {{ capture_device_ID_string }} | cut -d: -f2 | rev | cut -b 1" register: sound_ID_1 - name: video_capture - set audio_device set_fact: audio_device: "hw:{{ sound_ID_0.stdout_lines[0] }},{{ sound_ID_1.stdout_lines[0] }}" # same with video, the lsusb ID is 534d:0021 - name: video_capture - get video device shell: "v4l2-ctl --list-devices -z {{ lsusb_device_ID }} | grep video | head -n 1 | awk '{print $1}'" register: video_ID_0 - name: video_capture - set video_device set_fact: video_device: "{{ video_ID_0.stdout_lines[0] }}" - name: video_capture - show results debug: msg: - "Audio Device: {{ audio_device }}" - "Video Device: {{ video_device }}" - name: video_capture - streamer - copy service script template: src: stream_service.sh dest: "{{ streaming_working_folder }}/stream_service.sh" mode: 0755 - name: video_capture - streamer - create service file template: src: stream_service.service dest: /etc/systemd/system/stream_service.service mode: 0644 - name: video_capture - streamer - daemon reload systemd: daemon_reload: yes ...