Skip to content

Commit

Permalink
Provide nginx example for advanced transcoding
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlStraussberger committed Jul 10, 2023
1 parent 5b7cb3f commit 0c78ef3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ Nginx

* Restart Nginx service

Reverse proxies can also be used to handle really old devices and convert their request, e.g. to enable transcoding on http 1.0 protocol.
The example only works in conjunction with the respective gerbera configuration and `iptables` settings.

.. literalinclude:: ../scripts/nginx/gerbera-transcode.conf


.. index:: Sqlite

Using Sqlite Database (Default)
Expand Down
43 changes: 43 additions & 0 deletions scripts/nginx/gerbera-transcode.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# iptables -t nat -A PREROUTING \
# -i <incoming network interface> \
# -p tcp --dport GERBERA_PORT \
# --src <client's IP> \
# --dst GERBERA_IP> \
# -j REDIRECT --to-port NGINX_PORT

server {
listen GERBERA_IP:NGINX_PORT;

location / {
proxy_pass http://GERBERA_IP:GERBERA_PORT/;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent "imperial DABMAN i250 (proxied by nginx)"; # Used for client filtering in Gerbera

proxy_http_version 1.1; # This is important :)
}
}

# <clients enabled="yes">
# <client userAgent="imperial DABMAN i250" flags="TRANSCODING1" />
# <!-- Identify the requests by User-Agent string and flag them accordingly -->
# </clients>
# <transcoding enabled="yes">
# <mimetype-profile-mappings>
# <transcode mimetype="audio/ogg" client-flags="TRANSCODING1" using="profile"/>
# </mimetype-profile-mappings>
# <profiles>
# <profile name="profile" enabled="yes" type="external">
# <mimetype>audio/mpeg</mimetype>
# <dlna-profile>MP3</dlna-profile>
# <accept-url>no</accept-url>
# <first-resource>yes</first-resource>
# <accept-ogg-theora>no</accept-ogg-theora>
# <agent command="<path to shell script that does the actual transcoding>" arguments="%in %out" />
# <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
# </profile>
# </profiles>
# </transcoding>

0 comments on commit 0c78ef3

Please sign in to comment.