2

Setup: I have a RPi 4 with miniDLNA (ReadyMedia) and samba each running in a docker, a SSD connected via USB3 to the RPi and a TV connected via WiFi. All devices are in my locale network. The SSD is formatted as ext4. I have access via samba to a folder on my SSD which also functions as the miniDLNA volume.

I have transfer speeds of around 90MB/s via LAN and WiFi to my samba share. But the issue is when streaming videos via miniDLNA I notice long buffering times and it usually gets stuck after watching for just a few seconds (both on TV [WiFi] as well as on a Win10 machine [LAN]). Until now, I didn't notice this behaviour with .mp4 files, only with .mkv files. The video files are 1080p.

The two docker files I use are from dperson/samba and ypopovych/readymedia, respectively.

I do not think this is an issue with my docker-compose file, rather than an encoding issue, but nevertheless here is my docker-compose file:

version: '3.4'

services:
 samba:
   image: dperson/samba
   environment:
     TZ: 'Europe/Berlin'
     USER: 'username;password'
     SHARE: 'share;/mnt/transit;yes;no;yes'
   ports:
     - "137:137/udp"
     - "138:138/udp"
     - "139:139/tcp"
     - "445:445/tcp"
   restart: unless-stopped
   volumes:
     - "/mnt/transit:/mnt/transit"
   command: '-p'
   
 dlna:
   image: ypopovych/readymedia
   network_mode: "host"
   environment:
     FRIENDLY_NAME: "DLNA4B"
     VIDEO_DIR1: "/media"
   volumes:
     - "/mnt/transit/videos:/media"
     - "readymediacache:/cache"
   ports:
     - 8200:8200
   restart: unless-stopped
   depends_on:
     - "samba"

volumes:
 readymediacache:

Does anybody have some pointers or experienced similar behaviours?

Edit: After some further testing I can rule out miniDLNA and samba. I created a share on the SD-card on my RPi and played a mkv video from there. No buffering problems at all. As soon as I play it from my SSD connected via USB3, I get the buffering problems every few seconds. When that happens the SSD does not respond at all for a couple of seconds. This is strange, because reading and writing from the SSD works with constant 90-100MB/s via network.

  • Something that could be helpful is to describe how you're playing them, I mean for ex. using the SMB mounted on windows and VLC. I'm gonna update my answer with more scenarios I tried yesterday, although no good news.. :/ – FC.Araujo Oct 16 '20 at 02:45
  • Just curious, when you tested the SD against the SSD - have you used the same files? I'm thinking here another thing that could help is to test minidlna isolated, without using SMB. Because - correct if I'm wrong - the minidlna is not depending on the SMB service neither using the SMB path or protocol (just mounting the same directory as a volume path). IDK if it would change something but in your case you mentioned that different paths have difference and IDK maybe some was in use and affect the test. – FC.Araujo Oct 16 '20 at 03:19
  • Any update on this? – FC.Araujo Nov 09 '20 at 07:33
  • Sorry for the delayed response, I did not get the chance to get back to this project yet. The only thing I was able to single out until now, is that minidlna and samba are not the problem. SD with samba worked, while SSD with samba did not (ofc, with the same video file). I recon that there is a problem how I mount my SSD or the throughput of the shared USB 3 / LAN controller (or is it not shared with the RPi 4 anymore? not sure). I will try to get back to this issue and report my findings in the near future. – landmann123 Nov 10 '20 at 14:58
  • @landmann123 if you have more info on this, it would be highly appreciated. Thanks ! – Ciprian Tomoiagă Jul 10 '23 at 20:44

1 Answers1

0

Hey @landmann123 I have exactly the same issue here! I'm gonna add some details to double-check with your scenario.

I'm running docker through the x64 terminal ds64-shell using raspbian-nspawn-64. How are you running your docker? And here are my docker info:

pi@debian-buster-64:~ $ sudo docker --version
Docker version 19.03.13, build 4484c46
pi@debian-buster-64:~ $ sudo docker-compose --version
docker-compose version 1.21.0, build unknown

Have you checked minidlna logs? I tried several images before - one of them I've found an error upnphttp.c:1272: debug: sendfile error :: error no. 32 [Broken pipe] which seems to be some broken connection though there's no documented solution on their project page.

I tested using some avi files and this mp4 sample. I faced the same issue, the only difference is the mp4 plays 0.5s than buffer for other 10s, while the .avi (around 180MB) it takes 1 or 2 min to buffer and play a 0.5 sec, then both randomly got stuck or play another 0.5s.

I suspect it could be a network issue (maybe related just w/ docker) although I have a fibre 100/20 and I use to have minidlna in another raspbian image working really well, so I need to clarify a little bit this theory. By the way, if you use network_mode: host the ports are ignored.

Edit: I tried ypopovych/readymedia image and got the same issue, comparing the images I noticed this one has just warn log level, perhaps it could be hiding some debug/hint in your case. The minidlna version is the same as my image, and it was using tini, I removed just to double check, although it's something rarely would change something.

All these changes drove to the same result. Another thing, you can enable debug and verbose mode on the minidlna command w/ respective arguments -d and -v. Please find below one log showing the arguments I'm using and the minidlna version:

++ /usr/sbin/minidlnad -d -v -P /minidlna/minidlna.pid -S
minidlna.c:1048: warn: Starting MiniDLNA version 1.2.1.
Server: 5.4.27-0-lts DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.2.1

Using ypopovych/readymedia I tried with/without the named volume for caching, nothing different happened. One of the tests I paused the video for several minutes (just to check if it would buffer everything, who knows) but got the same error. I'm suspecting it's probably around some rendering stuff before the transfer, VLC was showing a golden bar while stuck, as it was waiting for something, like this:
golden bar

P.S.: all the tests I tried using a windows machine and iPad - both with VLC. I have mounted an SD path and an external HD, all with the same issue. Although using just SMB I'm able to play on both devices and both paths. Ah and I haven't tried to play locally in the raspberry to see if it's something on the network, it would be another thing to give a try.

Update: Running on Raspberry's VLC on DLNA worked on both images and both paths! That brings me to the network again, BTW the broken pipe error appeared in the logs even when it worked like a charm:

minidlna.c:1309: debug: HTTP connection from 192.168.1.11:46616
upnphttp.c:259: debug: Range Start-End: 10117400 - -1
clients.c:331: debug: Client found in cache. [Generic UPnP 1.0/entry 0]
upnphttp.c:889: debug: HTTP REQUEST: GET /MediaItems/9074.avi HTTP/1.1
Host: 192.168.1.11:8200

Accept: */*
Accept-Language: en_US
User-Agent: VLC/3.0.11 LibVLC/3.0.11
Range: bytes=10117400-
upnphttp.c:1937: info: Serving DetailID: 9074 [/media/animes/bleach 2004/S01E030.avi]
upnphttp.c:1281: debug: sendfile error :: error no. 32 [Broken pipe]
FC.Araujo
  • 303
  • 2
  • 11
  • I could not find anything out of the ordinary in the minidlna logs. I really think my problem lies with the .mkv files. I ran a mp4 file with a bitrate of 1.7MB/s with no problems, while a mkv file with a bitrate of 1MB/s stopped and buffered every few seconds for atleast 10sec. – landmann123 Oct 14 '20 at 14:54
  • I also noticed, that while the video is stuck buffering, I cannot access the samba share which at the same time is the miniDLNA share. – landmann123 Oct 14 '20 at 15:16
  • @landmann123 have you checked if you have the debug enabled? In my scenario, I'm using the volume from my SD and I'm not able to play anything at all... I noticed I haven't mounted a cache volume as well, I'm gonna try it on my own image and test this image you're using as well, let's see what happens. – FC.Araujo Oct 14 '20 at 22:41