Way to change size of direct stream chunks in transcode folder?



Hi, my server is on raspberry pi 3, my client is samsung tv ks8000
raspberry pi has 100mb ethernet speed and it is connected with lan..
i can send 40 gb movies over dlna to tv with direct play, but 20 gb movies with plex are buffering with direct stream..

system is on sd card and speed is Write = 9.2 MB/s | Read = 27.4 MB/s and because plex and other programs are on sd card, that speed can go down..
My movies are on external hdd and speed is Write = 32.1 MB/s | Read = 32.8 MB/s so i put transcode folder on external hdd because it's faster and free from other proccesses

I don't think that issue is with lan speed or hdd write and read speed. Because when i watch at htop write and read speed it's not constant, and it never go to max level, which is 12 MB/s if plex is writing and reading at the same time, it goes to 7 or 8 MB/s top..
Is there a way to change chunks size so i can experiment a little?


In a word, “No”. The chunk size has been set to a fixed value to alleviate any possible issues with all the different bit rates for all the different codecs


I played 20 gb movie again which is 20 mb/s and this time is played fine (i wtatched about 10 minutes)
read and write was about from 2 mb to 6 mb… sometimes was at zero…
Why sometimes same movie buffer and sometimes it’s playing fine? when it buffer, i seeing in htop that plex transcoder it’s not forcing enough… it spike up speed, and when buffer dots are gone, his speed return to minimal or zero, and again problem start… i wish transcoder can be more constant…


The transcoder sends the data out directly to your player/TV. If it is sitting at zero and your playback has stalled, points the problem at your LAN or, especially, your WiFi. If WiFi , and 2.4 Ghz band, switch to 5 Ghz. 2.4 Ghz will always give problems


My raspberry pi is connected with ethernet cable (raspberry pi have very slow wifi) but tv is on wifi… and it don’t have problems playing very big files over wifi… but i will connect it with ethernet cable, to see if there will be any difference, and i will report to you…


I am moving this thread to the Raspberry Pi forum were UglyMagoo can help you if you need further assistance. Pi is his specialty


@boris9898989 Two problems:

(1) Shared USB bus on the RPi with 220 Mbps max throughput. That’s 220 Mbps for Ethernet AND your USB drive. And when direct streaming, you are reading from the USB drive, writing the chunks, reading the chunks and then transferring the data over Ethernet. That’s quadrupling the required throughput. You can reduce the strain on the USB bus by using a fast SD card for transcoding.

In theory, you could also use WiFi, that’s not connected to the USB bus. However, it’s too slow in the RPi3 Model B for your needs. I have read that the RPi 3 Model B+ has a fast 5GHz adapter.

In DLNA mode you are only reading from the USB disk and writing to the Ethernet port, so only twice the original throughput.

(2) Audio transcoding: If your 20GB+ movies contain HD audio tracks, then Plex is transcoding to AAC or something like that --> CPU might not be fast enough


Hi @uglymagoo thanks for helping me…
Cpu is not an issue, while transcoding audio it never goes above 50% in htop

After @ChuckPA told me that wifi can be issue, i tried with lan cable, and in some 4k movies buffers are now gone…in larger movies i still got buffers…

My sd card is overclocked with dtparam=sd_overclock=100 and speed when testing is:

CLOCK : 100.000 MHz
CORE : 400 MHz, turbo=0
DATA : 512 MB, /root/test.dat


Timing O_DIRECT disk reads: 94 MB in 3.06 seconds = 30.77 MB/sec
Timing O_DIRECT disk reads: 94 MB in 3.06 seconds = 30.74 MB/sec
Timing O_DIRECT disk reads: 94 MB in 3.06 seconds = 30.77 MB/sec


536870912 bytes (537 MB, 512 MiB) copied, 53.2032 s, 10.1 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 45.2123 s, 11.9 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 46.8427 s, 11.5 MB/s


536870912 bytes (537 MB, 512 MiB) copied, 16.6723 s, 32.2 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 16.561 s, 32.4 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 16.4579 s, 32.6 MB/s

and it buffers more when transcode folder is on sd card…

If i understand right, movie file is readed and write to transcode folder, and thats files are readed again by ethernet…
when i test external hdd in dietpi i get USB Drive : Write = 34.8 MB/s | Read = 36.0 MB/s
so ethernet is using 11 MB/s max, i still have above 20MB/s for read and write which is (10 MB for read and 10 MB for write if its happening all in the same time)
But i guess those chunks are small files, and hard drives are not that great in reading and writing small chunks…so i guess speed is slower than…

But I’m maybe wrong… but i would like to know if there is some config file or xml or json, where size of chunk files are writen so i can experiment little…


@boris9898989 said:
Hi @uglymagoo thanks for helping me…
Cpu is not an issue, while transcoding audio it never goes above 50% in htop

Audio transcoding only uses one core. I.e. a load of 0.5 is OK while a load >> 1.0 indicates a CPU bottleneck.

There is not much for you to optimize anymore.