I am new to docker and docker swarm and started dockerizing several services and am trying to get them running as docker swarm services. I ran into a road block with the linuxserver/ffmpeg image:
From my research up to now I assume that passing parameters is not implemented in docker create service, but maybe you can think of a workaround? (unfortunately the image does not process environment variables, or at least they are not documented)
This is how I start dockerized ffmpeg (working fine in standalone mode):
docker run -d /
--network="host" /
--device=/dev/video0:/dev/video0 / ### error: unknow flag
--name ffmpeg_streamer /
--restart always -it /
-v $(pwd)/video:/video /
linuxserver/ffmpeg / ### custom parameters below here
-stream_loop /
-1 -re -nostdin /
-i "/video/test.avi" /
-f pulse /
-vcodec libx264 /
-preset:v veryfast /
-b:v 400k /
-f flv rtmp://localhost:1935/live/streamkey
Many thanks for looking into this!
try this docker-compose file
version: '3.3'
services:
ffmpeg_streamer:
image: 'linuxserver/ffmpeg'
restart: always
devices:
- "/dev/video0:/dev/video0" #make sure the folde /dev/video0 exist in your host
command: ["-stream_loop", "-1", "-re", "-nostdin", "-i" ,"/video/test.avi", "-f", "pulse", "-vcodec", "libx264", "-preset:v", "veryfast", "-b:v", "400k", "-f", "flv", "rtmp://localhost:1935/live/streamkey"]
network_mode: host
volumes:
- './video:/video'
you can run it using this command: docker-compos up -d