[BUG] Chrome exits direct play of .mp4 video with more than one audio track after 2-5 minutes.
EDIT Found out what happened here - https://forums.plex.tv/discussion/comment/1485134/#Comment_1485134 and here https://forums.plex.tv/discussion/comment/1492233/#Comment_1492233
Symptoms: Video starts, buffers approximately 150~ megabytes of the video until chrome exits the video without warning to the user. Server-side logs show nothing unusual other than "Client disconnected"
I tried for days to figure out what was going on with this. I could get movies/tv shows to play if they were direct streamed/remuxed/transcoded. I tried re-encoding my rip of Resident Evil 20 different ways to see if it was some funky h264 setting. Server side logs are useless as the issue seems to be on the client side.
After a lot of google searches, I tried using chrome://media-internals/ to debug the situation since it seemed to be on the client side.
When the video finishes buffering the initial 150~ megabytes of data, it throws a debug message here:
00:01:38 850 debug FFmpegDemuxer: memory limit exceeded
After this message, the video will continue to play for approximately 40-60 seconds until the buffer runs out and it exits.
After more research, it led me to this bug that was fixed in chrome about 2 years ago, in which chrome set a cap on memory usage with their demuxer: https://bugs.chromium.org/p/chromium/issues/detail?id=343304
I think that Plex is sending too large of a buffer to Chrome when direct play is enabled on a video with multiple audio streams, which overloads chrome's demuxer and causes it to exit. If I direct stream/transcode/direct play (1 audio stream) a video Plex stops adding to the buffer after it has 10-15 seconds of buffer already, but if I direct play a video with multiple audio streams it never stops adding to the buffer until chrome throws the demux error and stops it from adding more.
To test this theory, I took a movie that was having the problem and used ffmpeg to ONLY strip out the extra audio streams, then re-add it to Plex. After doing this, the movie direct played without any issues.
The issue occurs locally and remotely, and I can upload/host a movie for plex devs if needed to test.