Creating a fifo-based ffmpeg service

- Posted in Linux by

I needed an encoder-service waiting to handle ffmpeg-workloads, and decided to use systemctl and a fifo pipe, so jobs could be queued without the need of RabbitMQ/other.

I'm aware of DLQ and fancy scaling, however this does the trick and hasn't failed for years.

1) Create script for initiating the fifo pipe, save it at /opt/

# pipe location

trap "rm -f $pipe" EXIT

# Initiate pipe
[[ -p $pipe ]] || mkfifo $pipe

while true; do
    exec 3<> $pipe
    read line < $pipe
    bash <<< "/opt/ $line"

2) Create your ffmpeg-worker, with your ffmpeg args, at /opt/

# Do ffmpeg stuff
/usr/bin/ffmpeg -y input.avi [yourargs] output.mp4

3) Create service file at /etc/systemd/system/ffmpeg-encoder.service:

Description=ffmpeg encoder service



3) Reload systemctl daemon: systemctl daemon-reload

4) Enable service: systemctl enable ffmpeg-encoder.service

Verify the service state with: systemctl status ffmpeg-encoder.service

Verifying service status programatially can be done by running:

systemctl is-active --quiet ffmpeg-encoder.service

where exitcode 0 is the active state of the service.

I also wrote a simple ffmpeg-log-parser for polling state via PHP, but that's for another post.

Wasabi API, polling active storage

- Posted in Uncategorized by

Programatically fetching your quota/active utilization, etc. from Wasabi ( is pretty straightforward with their API.

1) Create a user at with API-access

2) Create access keys for new subuser and assign permissions via policies. My user has the following policies assigned: WasabiReadOnlyAccess, WasabiViewAuditLogs, WasabiViewBillingAccess and WasabiViewEventNotifications

Query their API like so:

curl -H "Authorization: ACCESS-KEY:SECRET-KEY"

Note that no type of Authorization is set, no "Basic", "Digest", etc.

Getting this via jQuery is trivial, I've written a simple script for it you can try out.

Replace ACCESS-KEY and SECRETKEY on line 7 with your credentials.