Code Monkey home page Code Monkey logo

stremio-docker's Introduction

Easy stremio on Docker

Introduction

Stremio is a free application which lets you stream your favorite shows and movies.

The Docker images in this repository bundle stremio-server, ffmpeg and web player for you, ready to use in a small Alpine image.

My motivation for doing this is having it running on my RPi5 and couldn't find something that has both player and server but also the official image seemed too big but also lacks the Web Player and doesn't work out of the box if no HTTPS is configured.

Features

Idea here is to have both Stremio web player and server run on the same container and if IPADDRESS env variable is setup generate a certificate and use it for both.

The Web player runs on port 8080 and server runs on both ports 11470 ( plain http ) and 12470 (https).


  1. If you exposed the ports 8080, 11470 for HTTP just point your streaming server (http://{LAN IP}:8080/) in settings to the lan ip address and set the server to be http://{LAN IP}:11470/ and enjoy. Make sure you set NO_CORS=1 with this option.

This is the easy option since there is no need to setup dns or have an external ip. Do not set the IPADDRESS env variable if you just want HTTP. You do not need to expose port 12470 with this option but you will only be able to use the webplayer with HTTP.


  1. If you set your public IP address for the IPADDRESS environment variable, then the Stremio server should automatically set the certificate to the wildcard *.519b6502d940.stremio.rocks and should generate an A record for your public IP address. You should then expose ports 8080 and 12470 to your servers and then setup port forwarding to your router to point these two ports to your server. Once this is done you can point the WebPlayer to your streaming server on port 12470.

To find the FQDN that the certificate is pointing to, look at the folder you mounted for a file with a .pem extension. The filename is the domain you need to add your your hosts in case of local ip address.


  1. If you set IPADDRESS to your private ip address then the server should still set the certificate to the wildcard *.519b6502d940.stremio.rocks and have the subdomain set as 192-168-1-10 assuming your private is 192.168.1.10. Full domain should look like 192-168-1-10.519b6502d940.stremio.rocks. You can then setup your /etc/hosts in Linux or c:\Windows\System32\Drivers\etc\hosts in windows to point that host to your lan address like :
192.168.1.10    192-168-1-10.519b6502d940.stremio.rocks # this is an example. set your own ip and fqnd here.

Then you can point your browser to https://192-168-1-10.519b6502d940.stremio.rocks:8080 and setup Streaming server to https://192-168-1-10.519b6502d940.stremio.rocks:12470 .

To find the FQDN that the certificate is pointing to, look at the folder you mounted for a file with a .pem extension. The filename is the domain you need to add your your hosts in case of local ip address.


Thoughts

You don't need to have both Stremio Server and Web Player running. One could use the Stremio web player (https://app.strem.io/#/). Stremio's web player should also work for options 2 and 3 above because the web player requires that the server's URL is in HTTPS.

You can also use the native clients for options 2-3 since they use https but those clients also run a server so there is no point doing this.

Another option is to use an External Media player like VLC or any other supported by stremio to avoid transcoding on the docker container. This would help if you don't have GPU transcoding or some other good CPU.

Shell

I added stremio shell html files under http(s)://{Your stremio url}:{port}/shell/ . One should be able to get the old online stremio version of the files that are in app.stremio.io. Defaults to the normal webplayer on the root "/". I have had issues playing youtube videos with these files though and I assume so will you.

Requirements

  • A host with Docker installed.

Installation

1. Install Docker

If you haven't installed Docker yet, install it by running:

$ curl -sSL https://get.docker.com | sh
$ sudo usermod -aG docker $(whoami)
$ exit

And log in again.

2. Run Stremio Web + Server

To automatically run stremio web player and server in http, simply run:

$ docker run -d \
  --name=stremio-docker \
  -e NO_CORS=1 \
  -v ~/.stremio-server:/root/.stremio-server \
  -p 8080:8080/tcp \
  -p 11470:11470/tcp \
  --restart unless-stopped \
  tsaridas/stremio-docker:latest

The Web UI will now be available on http://YOUR_SERVER_IP:8080. Set streaming server to http://YOUR_SERVER_IP:11470 add your add ons and start watching your favourite movie.

πŸ’‘ Your configuration files and cache will be saved in ~/.stremio-server

Options

These options can be configured by setting environment variables using -e KEY="VALUE" in the docker run command.

Env Default Example Description
IPADDRESS - 192.168.1.10 Set this to enable https
NO_CORS - 1 Set to disable server's cors
CASTING_DISABLED - 1 Set to disable casting
WEBUI_LOCATION - http://192.168.1.10:8080 Sets the redirect page for web player and automatically sets up streaming server for you when one tries to access server at port 11470 or 12470. Default is https://app.strem.io/shell-v4.4/
FFMPEG_BIN - /usr/bin/ Set for custom ffmpeg bin path
FFPROBE_BIN - /usr/bin/ Set for custom ffprobe bin path
APP_PATH - /srv/stremio-path/ Set for custom path for stremio server. Server will always save cache to /root/.stremio-server though so its only for its config files.

There are multiple other options defined but probably best not settings any.

Updating

To update to the latest version, simply run:

docker stop stremio-docker
docker rm stremio-docker
docker pull tsaridas/stremio-docker:latest

And then run the docker run -d \ ... command above again.

FFMPEG

We build our own ffmpeg from jellyfin repo with version 4.4.1-4 This plays well and its what stremio officially supports.

FFMPEG add configure options

You could build your own image with extra ffmpeg configure options. Your new option will probably require that you have the -dev libraries installed for alpine.

If you cannot find the -dev libraries in the alpine repo then you might need to compile them as well.

  xvidcore-dev \
  fdk-aac-dev \
  libva-dev \
  git \
  x264 `ADD-DEV-PACKAGE-HERE` && \

Add your extra options at the end line before the && :

--prefix=/usr/lib/jellyfin-ffmpeg --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-shared --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-gmp --enable-gnutls --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265  --enable-libzimg --enable-small --enable-nonfree --enable-libxvid --enable-libaom --enable-libfdk_aac --enable-vaapi --enable-hwaccel=h264_vaapi --toolchain=hardened `ADD-OPTION-HERE` &&

You also add the dev libraries to the above line from configure where you see lots of -dev packages installed. Those packages are purged later so you will also need to install the normal library (not the headers) in the end.

apk add --no-cache libwebp libvorbis x265-libs x264-libs libass opus libgmpxx lame-libs gnutls libvpx libtheora libdrm libbluray zimg libdav1d aom-libs xvidcore fdk-aac curl libva `ADD-NON-DEV-PACKAGE-HERE` && \

The lines shown above might have changed so just try to use common sense on where to add your package. If you want hardware acceleration you might need to compile it with the driver for your hardware. The version of ffmpeg that we compile comes with (VA-API)[https://en.wikipedia.org/wiki/Video_Acceleration_API]. You will probably need to expose your hardware device inside the container in order to make it work. Server tries to see if it can use any devices on first start. You can see those log messages to see if it worked for you.

Builds

Builds are setup to make images for the below archs :

  • linux/arm/v6
  • linux/amd64
  • linux/arm64/v8
  • linux/arm/v7

I can add more build archs if you require them and you can ask but I doubt anybody ever will need to install these containers in anything else.

Build tags

  • latest -> Builds automatically when new version of server or WebPlayer is released. Builds WebPlayer only from release tags.
  • nightly -> Builds automatically daily from development branch of web player and gets latest version of server.
  • release version (example v1.0.0) -> to have old releases available in case there is something wrong with new release.

Images saved in Docker Hub

Build your own

You can build your own image by running the below command. By default it will build from development branch of web player and latest version of the server. If you want to build from latest release of web please you can add --build-arg BRANCH=release or the branch that you want.

docker build -t stremio:myserver .

Common Use Cases

Useful links

Stremio addons

Suggestions

I recommend setting up dnsmasq or similar to cache your dns queries since Stremio seems to be spamming with requests to trackers.

The config option you need with dnsmasq is :

cache-size=10000

then you set your dns server to the ip address of your dns caching server and you are set.

Last words

I don't intend to spend much time on this and tried to automate as much as I had time to. PRs and Issues are welcome. You can also fork and do as you like with the code but if you find some issue please do let me know.

stremio-docker's People

Contributors

tsaridas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

stremio-docker's Issues

failed to fetch

no matter what i do i cant stream any movie I'm accessing the server via a different network and PC I'm hosting the server on a VPS, I made sure to allow all the ports just to check if that gonna solve the issue or not but whenever I try to play something I get the field to fetch error here is what I get in the network tap

image

from what I've read on the internet about the Mixed block it seems like I need https cer for my sever but didn't see anything about that on this page.

adding to that, accessing the stremio webpage via port 8080 and then adding the server from settings will allow me to play movies but without any video I just hear sounds

Featured on Stremio Official Site

Hi @tsaridas , i'm the dev lead at Stremio.

I came across ur project and think it's pretty cool, we'd feature it on the main downloads page as a "Docker" download as it includes a complete solution. (both Stremio Web as client and Stremio Server)

We just need to know if u agree to this and if you are interested in maintaining it for the long run so we can be assured of the project's longevity.

We would also like to offer the option to move the repo under the Stremio organization on GitHub (if you wish to ofc, you will still have maintainer access to the repo), this will give it more visibility and probably more community development assistance.

Good job! Looking forward to hearing ur reply. πŸ™‚

Nvidia h264_nvenc support

I have tried every option I could possibly think of to get hardware acceleration for my RTX1060 to work. I have switched the base image to use the CUDA one from Nvidia. Compiled from source using these flags (and just trying from the toolkit) https://trac.ffmpeg.org/wiki/HWAccelIntro#NVENC additionally I followed all official Nvidia instructions yet I still get the Unknown encoder 'h264_nvenc ffmpeg' error. Any help would be greatly appreciated. Also even without hardware acceleration no Transcode profile is available it default to "Disabled" while using stremio-service I have the option for nvenc-win (i'm not sure but getting hardware acceleration may enable that as an option?)

Failure playback youtube video

Used youtube to test whether this works, and it gave warning in logs and error in player

stremio         | WARNING: ytdl-core is out of date! Update with "npm install ytdl-core@latest".

The fix was as it old:

docker exec -it stremio sh
npm install ytdl-core@latest

Server Url

First of all, thanks for the wonderful job, i had problems using the oficial stremio-server on a SOC Orange Pi 5 (similar to RPI5) and your solution works flawlessly.

Is it possible to set automatic the streaming server url?

Facebook login and Casting

It was great to come accross yout stremio docker server/client. I've been trying for a while to make Stremio available for UmbrelOS, but not having a server/client running all in one container defeated the cause of having Stremio running on a home server.
Thanks a lot!
That being said, wanted to address this to issues which I would like to overcome to be able to streamline this for Umbrel OS (all the credits will be given to you, I just want this tool to be available for Umbrel users).
The client/server works like a charm in my RPI 4 (kind of standard HW for UmbrelOS, excluding their own developed HW).
The only two features that wouldn't work are FB login and Casting to a device.
FB login throws the following error: JSSDK unknown host domain
The domain where you host the Facebook SDK for Javascript is in your app's Javascript SDK host domain list. Specify your host domain in the login settings in the app dashboard.
I believe it might have to do with the fact I'm accessing http webui and not https (for Umbrel porpose, https is not an option, that is why I want it to work on http, if that is the problem, and is actually possible).
On casting to a device, I haven't disabled in the options it when running the container, but still in the player the button is greyed out (I have a running chromecast on my network), so I assumed it is disabled by default, or simply not working.
Any help with this issues or at least the reasons for them would be awesome.
In any case, great job and thanks once again!

Running in a Synology NAS

Hi,
was able to compile on a synology NAS (arch: appollolake) but I get the following when web interface connects to the server:
hls-converter - Tests for hardware accelerated transcoding finished, no viable acceleration profiles detected

I suspect, ffmpeg compilation didn't go well.
Is it possible to configure the docker in order to use ffmpeg binary which are already available on the synology NAS?
Or do you have any suggestion?

thank you

more than one Docker.

I am a layperson in this. How do I change the ports? I want to create more than one different Docker. I tried to change it in the .yaml, but the web UI would not open.

server seems to die without logs

Not sure how to verify this as the webapp seems to keep running but the stremio-server parts seems to die without any error in the container logs.

https://*.519b6502d940.stremio.rocks:8080 is still working but says server offline

https://*.519b6502d940.stremio.rocks:12470 doesn't work

I've also tried with https://localhost:11470 seems to keep dying.

restarting the container makes it work for a minute but then it is unreachable again.

Network Error

Running docker in Ubuntu; Hitting http://YOUR_SERVER_IP:8080 in host machine and it is working.

Hitting streaming server to http://YOUR_SERVER_IP:11470 on host and IPad is not working, it is throwing below error

image

Stream is not supported

image
Using http only on a local container.
I've tried with different browsers with the same result.
The machine where Docker is running is a VM over Proxmox, and no GPU passtrough.
I also have Jellyfin running on another containr and it works well with no GPU hardware.
Do I need GPU hardware to stream?

get-https from localhost:11470 fails

I am running the server on a Odroid-HC4. I am using a self-signed URL which works great on everything but my TV. The *.stremio.rocks url from my PC works on the TV. I tried your repo in the hopes that it could generate a signed cert from stremio for the HC4.
However, if I specify a public or private IP, the container immediately crashes.

curl: (7) Failed to connect to localhost port 11470 after 1 ms: Couldn't connect to server

Can't find .pem file

Thanks for tour work. I can't find .pem file and I can't know what my FQDM is. I search in ~/.stremio-server and it's empty. Thank you in advance

Playback error

Hi,

Thanks a lot for your work, I was looking into something similar recently!

I tried to setup stremio using your guidelines but I'm facing a playback error when starting a stream.

You'll find my config and logs below:

services:
  stremio:
    image: tsaridas/stremio-docker:latest
    restart: unless-stopped
    environment:
      NO_CORS: 1
      IPADDRESS: "192.168.0.12" # Setup your ip address here
    ports:
      - "8080:8080"
      - "11470:11470" # Just one of the two should be enough
      - "12470:12470"
    volumes:
      - "./stremio/:/root/.stremio-server" # set the first part to your local folder. Its not required though
image
stremio-1  | Node.js v18.20.0
stremio-1  | hls executables located ->  {
stremio-1  |   ffmpeg: '/usr/bin/ffmpeg',
stremio-1  |   ffsplit: null,
stremio-1  |   ffprobe: '/usr/bin/ffprobe'
stremio-1  | }
stremio-1  | Using app path -> /root/.stremio-server
stremio-1  | Enabling casting...
stremio-1  | (node:7) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
stremio-1  | (Use `node --trace-deprecation ...` to show where the warning was created)
stremio-1  | EngineFS server started at http://127.0.0.1:11470
stremio-1  | EngineFS HTTPS endpoint at https://local.strem.io:12470
stremio-1  |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
stremio-1  |                                  Dload  Upload   Total   Spent    Left  Speed
stremio-1  | -> GET /get-https??authKey=&ipAddress=192.168.0.12
100    92  100    92    0     0    283      0 --:--:-- --:--:-- --:--:--   283
stremio-1  | {"ipAddress":"192.168.0.12","domain":"192-168-0-12.519b6502d940.stremio.rocks","port":12470}Starting up http-server, serving build/ through https
stremio-1  |
stremio-1  | http-server version: 14.1.1
stremio-1  |
stremio-1  | http-server settings:
stremio-1  | CORS: disabled
stremio-1  | Cache: 3600 seconds
stremio-1  | Connection Timeout: 120 seconds
stremio-1  | Directory Listings: not visible
stremio-1  | AutoIndex: visible
stremio-1  | Serve GZIP Files: false
stremio-1  | Serve Brotli Files: false
stremio-1  | Default File Extension: none
stremio-1  |
stremio-1  | Available on:
stremio-1  |   https://127.0.0.1:8080
stremio-1  |   https://172.30.0.2:8080
stremio-1  | Hit CTRL-C to stop the server
stremio-1  |
stremio-1  | -> GET /settings
image
stremio-1  | -> GET /casting
stremio-1  | -> GET /opensubHash?videoUrl=https%3A%2F%2F192-168-0-12.519b6502d940.stremio.rocks%3A12470%2Fe797fe3be07c17a60fae0b8e2f278d0389aa2391%2F0
stremio-1  | -> HEAD /e797fe3be07c17a60fae0b8e2f278d0389aa2391/0
stremio-1  | Engine created for e797fe3be07c17a60fae0b8e2f278d0389aa2391
stremio-1  | -> GET /e797fe3be07c17a60fae0b8e2f278d0389aa2391/0 bytes=0-
stremio-1  | /srv/stremio-server/server.js:33726
stremio-1  |                 return parseFloat(value.replace(/([\d.]+)(\w?)/, (function(_, val, unit) {
stremio-1  |                                         ^
stremio-1  |
stremio-1  | TypeError: Cannot read properties of undefined (reading 'replace')
stremio-1  |     at parseValue (/srv/stremio-server/server.js:33726:41)
stremio-1  |     at /srv/stremio-server/server.js:33741:31
stremio-1  |     at ChildProcess.exithandler (node:child_process:414:7)
stremio-1  |     at ChildProcess.emit (node:events:517:28)
stremio-1  |     at ChildProcess.emit (node:domain:489:12)
stremio-1  |     at maybeClose (node:internal/child_process:1098:16)
stremio-1  |     at Socket.<anonymous> (node:internal/child_process:450:11)
stremio-1  |     at Socket.emit (node:events:517:28)
stremio-1  |     at Socket.emit (node:domain:489:12)
stremio-1  |     at Pipe.<anonymous> (node:net:350:12)
stremio-1  |
stremio-1  | Node.js v18.20.0

Thanks a lot in advance!

Unspported media

I keep getting an "unsupported media" playback error when trying to play files using the web player. I have successfully connected to the service using HTTPS.

The specific error is "Video is not supported" when using the V5 client (web.stremio.com).

When using the V4.4 client and hosted web player, the errror is "Playback error, please try again".

player not working

I installed the docker image and setup the streming server to my Lan IP and it's showing that the server is online

I installed Torrentio addon but when ever I want to stream the player error out with "Video is not supported".
I can use an extrnal player with m3u and vlc just fine.

I get this error in the logs when I try to play anything:

SSDP error: {
  type: 'ssdp',
  error: {
    type: 'send',
    error: Error: send EPERM 239.255.255.250:1900
        at doSend (node:dgram:718:16)
        at defaultTriggerAsyncIdScope (node:internal/async_hooks:462:18)
        at afterDns (node:dgram:664:5)
        at process.processTicksAndRejections (node:internal/process/task_queues:83:21) {
      errno: -1,
      code: 'EPERM',
      syscall: 'send',
      address: '239.255.255.250',
      port: 1900
    }
  }
}

Subtitles takes about two minutes to load

I'm using your docker container and this works great. The only thing is that subtitles won't show up or are available after two minutes, when playing a movie or series episode. Is there something that I can do about this ?

Automatic server url connection?

Hey @tsaridas,

Thanks for making this combined container solution.

It’s really helpful, particularly for iPhone users like me who can’t stream torrents. I can now host my web and server in the Raspberry Pi and I can stream from my mobile without any Cors/https issues.

one thing I wanted to know, Can we not configure the server IP address automatically? By default it is always 127.0.0.1

When I use it on my home network it's 192.168.. again when I switch to its VPN network it's 10.140.. and for the public its random IP address.

Is there any way we can configure the container so that it can automatically pick up the IP and resolve it based on the network we are in?

configure torrentio

How to configure torrentio utility, when I click on configure but it keeps asking to open stremio client application

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.