Playback hiccups with some video MP4 (H.264/AAC) ?

server-mac

#1

Hello,
I am running the Plex Media Player on my Mac OSX, and the server is running on a NetGear NAS box which is on the same local home network. No heavy traffic on the network.
I have a group of MP4 files that won't play smoothly, but they play one second of audio/video, then 10 seconds of pause (with the spinner in the middle of the screen), then one more second of audio/video, then 10 more second of pause... and so on.
The funny thing is that if I jump in the middle of the file, then the playback usually works correctly, but then if I jump back to the beginning, the problem happens again.
I have many other MP4 files encoded with the same settings that don't have any problem playing back.
Has anyone else seen this?

Plex Media Player Version 3.7.0
Plex Media Server Version 1.5.5.3634 running on NETGEAR ReadyNAS 312 (also running latest firmware)
Mac OS Sierra 10.12.4
Processor 2.5GH i7
RAM: 16GB
Video is MP4: H.264/AAC, encoded using Handbrake (I use handbrake for all my DVD ripping/encoding)
Video is standard def (4:3) animation.
Subtitles are off during playback (the file does contain Japanese vobsub)
Primary audio track
I play the original stream (not the reduced Mbps ones)

I have tried playing one of these files using VLC over the same network connection, from the same NAS drive, and they al play flawlessly, even when I jump forward/backward in the file.

I am willing to share one of these files on my google drive share, if that helps.
Thanks,
-Gianluca.


#2

More information: The web based Plex Media Player has no problems playing the same file reported above.


#3

First of all, VLC is a 'player' and it contains all of the required codecs etc.. to enable it to play many, many file formats. It also contains error correction routines that allow it to play slightly damaged files where Plex does not. Plex relies on the device you are using to actually decode and play the file.

If that device does not support the file you are playing then you will need to rely on Plex's ability to transcode the file to a suitable format for your client device to play. Since you have PMS installed on a NAS, it is likely that your NAS is simply not powerful enough to handle transcoding of the file.

That being said, it is most likely that your files are encoded with variable bitrates or framerates. The bitrate/framerate can sometimes exceed the capabilities of your systems and client device and this results in pausing/stuttering during playback.

Because the file has suitable parameters (codecs etc..), Plex is most likely Direct Playing the file and not transcoding, therefore Plex is not able to handle the sudden increase in the bitrate/framerate and it therefore must cache the stream in order to catch up, again this results in pausing/stuttering during playback.

The best way to correct that is to reduce the overall bitrate/framerate of your file. You want an overall bitrate ~20Mbps or less for use on home networks and ~8Mbps for a remote connection with a 1080p file.

You may also try using constant bitrates/framerates instead of variable bitrates/framerates.

In Handbrake, try using the Fast 1080p 30 or Fast 720p 30 preset as your base settings when encoding your videos. You can make adjustments as needed, but the base settings of those presets should be suitable for your needs.


#4

Hello, @trumpy81,
Thank you for your reply!

Noted about VLC, what it is, and what it can do.
I was under the impression that the Plex Media Player (PMP) was the same kind of advanced swiss-knife/media-player, but I was wrong.
I am starting this message with a preemptive apology for sounding like a know-it-all, but I've done some homework, and I hope you can prove me wrong.
I really need your help, otherwise Plex is of no use to me.

I've tested the native PMP on Mac, Windows, and iOS.
Mac and Windows native apps are the ones that fail.
iOS works fine.
Web based Plex player work fine on both Mac and Windows.

I read your comment about PMP only being able to play files that can be natively played by my system, and both my Mac and Windows can play that same file (with their native Quicktime and Window Media Player, respectively), so I assume that the file is supported by installed codecs on both system.

All my MP4/AAC files are encoded with the same settings, and (you are right) they use variable frame rate, because some of them go through detelecine process, which tends to make them that way, but that should not cause any trouble, because the native OS codecs can play all my media just fine. I'm pretty sure my files don't have any errors or invalid data streams, because they came straight out of Handbrake.

The web based Plex player can play the same file on all OSs, so in my opinion that rules out any transcoding problem happening the NAS.

I am trying to be proactive, and I've uploaded one of the incriminated files on google drive, so you can download to your system, play it, and hopefully give me more information.
drive.google.com/open?id=0B3l632aizlJTMGlJaEZ5ZkFLeGs
It's an older Japanese animation with Italian soundtrack ... please forgive me :)
Let me know if the link works!

Thanks,
-Gianluca.


#5

First of all, thanks for the file and yes, the link worked. :)

You are not playing the file natively when you use WMP or QT, they are players and while they can use the codecs supplied by the system they also have their own codecs and error correction routines etc...

Examining your file, the only issue I see is that it is using too many RefFrames. The file has RefFrames = 8 where for an .mp4 file it should be 4 or 5. Other than that, I don't see any other issues with the file. The file is not Web Optimised either, not a big deal, but it helps when streaming across a network.

I would say it is a candidate for re-encoding though, to correct the number of RefFrames. A quick run through Handbrake should do the trick, but I don't recall if Handbrake strips the tags or not. You may need to use iTunes and copy the tags from the original file to the re-encoded copy or use your favourite tagging program, assuming it supports .mp4 tagging.


#6

Thanks, @trumpy81.
Oh wow. All my files are encoded with RefFrames=8, I think. We're talking more than 1500 files.
Does that mean that I'm out of luck? Ouch :(
Is that the reason why the player hiccups?

At the risk of repeating myself I've never encountered a player that could not play these (or all) my video files.
Is there a chance that the Plex player could be fixed to play these seemingly correctly encoded files?
These are are encoded correctly, with the exception of a slightly higher RF count, right?

The funny thing is that out of all my files, Plex only seems to choke on these, and they're all encode the same way with the same setting. Some are even from DVDs with videotape material that has framerates of 60fps (still with RefFrames=8), which is double the fps of the file I shared with you.
Here's a download link to a file (that works fine in Plex) encoded the same exact way but that is from videotape source (for your reference):
drive.google.com/open?id=0B3l632aizlJTRlo3TEYyU2xqTGM


#7

Plex does not actually play anything. The actual playing is performed by the Plex client device, not by Plex. The Plex client app is merely a controller and not a 'player'.

The only thing you can do, is try playing those files with Plex and if they fail or pause and stutter, then try re-encoding one or two of them and see if that makes a difference, it should.

If you need to re-encode them, then do it in batches. Handbrake has reasonable batch handling capabilities so that you can do say, 10 files at a time, and if you keep chipping away at them then eventually you will get them all done.

With the file you provided, golden.m4v, the framerate is much more constant,
Minimum frame rate : 59.920 FPS
Maximum frame rate : 59.960 FPS

Whereas the previous file, heidi.mp4, the framerate has a much wider range,
Minimum frame rate : 19.978 FPS
Maximum frame rate : 59.960 FPS

That may well be the difference between the two, but I would still opt to correct the RefFrames while you are at it.

Also, when I run golden.m4v through my ffmpeg error search it returns this:
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000006664c0] Referenced QT chapter track not found

The heidi.mp4 file returns no issues.


#8

Hi, Andy,
So I'm working with the same source material used to create the heidi.mp4 file I shared with you above, and I've encoded it again, from scratch with handbrake, 4 different ways, and none of them work correctly in the Plex Media Player apps for Windows and Mac. All of them work fine using the web based player (using google chrome) on the same Windows and Mac machines.
See below for the download links.

Thanks
-Gianluca.

Here are the newly encoded files:
Reference frame = 4; constant fps (same as source material); detelecine "on":
drive.google.com/open?id=0B3l632aizlJTM1EtOHZjLW1Ga2s

Reference frame = 4; constant fps (same as source material); detelecine "off":
drive.google.com/open?id=0B3l632aizlJTMmwxWTdIQzJaQVE

Reference frame = 4; constant fps (forced to 23.97); detelecine "off":
drive.google.com/open?id=0B3l632aizlJTUk1nZ2VYSkJYWEk

Reference frame = 4; constant fps (forced to 29.97); detelecine "off":
drive.google.com/open?id=0B3l632aizlJTRFIyWkF1Qnc0Z1E


#9

Thanks for providing those files. :slight_smile:

I don’t know what to tell you. I added all of the files to my Windows 10 Pro PC installed PMS version 1.7.2 and then played the files using PMP version 1.2.3 as shown in the image below.

I renamed the first file you provided to Heidi - S01E01.mp4 and added it along with the rest of the heidi files you provided above into a test TV Show library. All of the files were correctly identified and all metadata was downloaded. I also renamed the file golden.m4v to Golden Girls - S01E01.mp4 and it matched and all metadata was downloaded.

When playing any of the these files I am able to skip back and forth without any issues, apart from some slight pausing while Plex catches up to the correct position in the file, so I am unsure exactly what your issue might be.

I can only suggest that you have some kind of weird system issue that seems to effect your ability to playback some files and I have no idea what that might be. It could be lack of CPU power, it could a network issue, it could literally be anything.

Please play a file and when it shows an issue stop playing, wait ~1min and then go to Plex settings->server->help and download your Plex logs. Attach the .zip file to your next post, thanks.

In the first image below you will see Heidi - S01E01.mp4 playing on the left monitor and the test TV Show library is displayed on the second monitor on the right.

Below that is a screenshot of my PMP and it’s version.

I have also provided a video (taken with my phone, sorry for the bad filming) showing the file playing and I am skipping back and forth through the file as it plays without any real issues at all. https://1drv.ms/v/s!Al6fiSgXZz8chKF2KIUKdix2L2br3w

After the above tests were performed, PMP was updated to version 1.3.2 and I played all files again. There were no issues playing any of these files in the updated version of PMP either.


#10

Andy,
Thank you for testing with my files.
I am running the server on a NETGEAR ReadyNAS 312.
This has a Intel® Atom 2.1GHz dual core CPU. Not too shabby.
But in any case I have stream transcoding turned off (always set to "original" when playing).
I don't see any network issues. It's a home network with 2 computers on it, and my windows box is wired on the network, as well as the NAS, so no WiFi is involved.
The NAS is accessed only by be so there's not excessive activity on it.
Plus all the above would still be a problem when I play the same video from the web based Plex Player from google chrome browser. I run the browser on the same Windows machine, and it would experience the same Network and NAS CPU usage issue, if there were any, but that doesn't happen.
So the problem ONLY happens when playing using the Mac and Windows native Plex Player apps.
Maybe you could try running your server on a NAS similar to mine, if you have one around?

Tonight I will get you the Plex logs, as you requested, to see if we can figure out something from there.

Thanks,
-Gianluca.


#11

I have a Synology DS1813+ and I tested the files on it not long after making my post above. I get a lot of pausing when I play the original file, Heidi - S01E01.mp4 with PMP v1.3.2.

From my logs:

Jun 06, 2017 05:33:52.906 [0x7f40387ff700] DEBUG - Streaming Resource: Updating client bandwidth estimation to 51159kbps with most recent 52428kbps (655360)

As I suspected, the file is taking up a lot of bandwidth, much more than even I suspected. From the log line above it is commanding 51MB/s with recent bandwidth usage of 52MB/s. That is way more than the average home network will handle and it is a lot more than MediaInfo reports, 1975Kb/s overall.

I re-encoded the file using the Fast 1080p 30 preset in Handbrake v1.0.7 and made the following changes only:

  1. Anamorphic off
  2. Web Optimised = on
  3. Encoder tune = none ... Fast decode = on
  4. RF = 19
  5. Audio = AAC Stereo 160Kbps
  6. Subtitles = Foreign Audio Scan ... Forced Only = off ... Burn In = off ... Default = off ...

Playing the file now named Heidi - S06E01.mp4 using PMP results in no pausing or stuttering, it plays flawlessly from PMS on my NAS ->PMP on the PC.

I have uploaded a copy of the file here: https://1drv.ms/v/s!Al6fiSgXZz8chKF3t87YAv3IiZFllA

So it appears that something about your encoding settings are upsetting the apple cart after all. Try the settings above and you should be good to go.

Sorry, looks like your in for an extensive re-encoding session.


#12

Hello, Andy,
I will resign to re-encoding if I have to, although I have given away most of mY origin al DVDs, so I won't ever be able to re-encode everything I have (and that's a bit upsetting).

I've said this before but please don't think that I'm an annoying know-it-all for asking you to consider all my points below one more time, and give me an a answer:

My home network runs on a Gigabit Ethernet (router, NAS, Windows, CAT5 cables.....).
I mean I can copy the whole file from the NAS to my PC in less than 8 seconds, fresh from a NAS reboot, so that we can exclude file caching on the NAS.
If it is a bandwidth issue, then why does playback in the chrome browser work, with "original" quality streaming option?
Why does playing the same file directly over the network with QuickTime, WindowsMediaPlayer and VLC work? Yes, i understand that codecs and error corrections routines are different, but none of that fixes bandwidth issues.
Why does playing the same file over slower WiFi, to my old iPhone6, work, with "original" quality setting?
Wouldn't all the above have the same bandwidth issue, given it's the same wired network (except the iPhone), same source NAS, same CPU (local and remote)?
Doesn't all this point to something fishy in the Mac and Windows native client apps, OR perhaps to something fishy in the way data is specifically delivered to these two clients, from the Plex Media Server app?

Thanks,
-Gianluca.


#13

I would be trying Open PHT first before anything rash is exercised.

https://github.com/RasPlex/OpenPHT/releases

Now getting off that subject a bit, the latest Public PMS version : 1.5.6.3790

Manually Download whilst in the Public Channel setting in PMS. Sign in on below link and download.

https://plex.tv/downloads


#14

Hi, @Gdr56 ,
Thank you for the info. I manually downloaded and upgraded to the latest PMS for my NetGear NAS, which turned out to be version 1.7.2.3878 from May 26, 2017 (before I was running 1.5.5.3634).
I have no idea why this latest version jumped up to 1.7.2 (from 1.5.5), and I don't know where you got the 1.5.6.3790 from.
After upgrading, nothing's changed. Still having the hiccup issue.
The Open PHT option sounds interesting, but I can't figure out which version I should download for my Intel based NETGEAR ReadyNAS 312. Any help there?

Hi, Andy (@trumpy81 ),
I'm not sure if these would still help or not but I followed your instructions and I'm uploading my Plex Media Server Logs ZIP file.
And if I may, again speak like a know-it-all, I think I've have a vague idea of what's causing the hiccup.
I think it's the lack of file caching.
I suspect the native Mac and Windows native apps are extremely similar, and are probably just some flavor of Chromium web app, so they probably share some code, which could explain why they both fail.
When I play the incriminated file in my Chrome browser, I can see that the browser pre-caches about 1 minute worth of video data, in fact you can see the little grey pre-cache line just a little bit ahead of the current playback marker point, on the player scroll/scrub control.
This little little grey pre-cache line doesn't show up at all in the native Mac and Windows app, probably because of the way file caching the Chromium app is setup? Don't know. Just sharing what I'm thinking.
I'm still hoping for your answer to my multi-points question from my previous post.

Thanks,
-Gianluca,


#15

From your logs:

Jun 05, 2017 23:27:13.438 [0x7f0b417fd700] ERROR - Caught exception trying to stream file: /data/media/media/Video/TV Shows/Heidi/Heidi - s02e01 - const fps (same as source) - refFrame 4 - detelecine on.mp4: write: Broken pipe

The above indicates an issue with your file. No surprise as we have already identified that issue.

I believe, but I am not 100% sure, that because of the high data rates involved and the lack of CPU processing power on the NAS and a few other things, they are all combining to cause the issue of pausing and stuttering that you see.

It could be that the buffers are being filled too quickly or too slowly. It is not so much of a bandwidth or network issue, more of a limitation with your systems, a timing issue in other words. The broken pipe also hints at a buffer issue, but given the other factors, it's hard to point the finger at any one thing.

Jun 05, 2017 23:03:51.236 [0x7f22687ff700] DEBUG - Failed to stream media, client probably disconnected: 32 - Broken pipe

The above error follows the previous error.

Jun 05, 2017 23:27:13.477 [0x7f0b2dffe700] WARN - SLOW QUERY: It took 480.000000 ms to retrieve 17 items.

This indicates that your database could use some Optimising. There are more lines like this in your logs.

P.S.

After consulting with the other Ninja's and employees, the consensus is that you need to re-encode those troublesome files if you want them to play without issue. There does appear to be a slight issue in PMP in regards to caching, but it is triggered by your files poor encoding. If the file was encoded correctly, then you would have no issue, as I demonstrated.


#16

Hi, Andy,

With all this information we can finally agree that the problem is not the frame rate, but it's the variable bitrate!
I finally remember something that I should have mentioned right away, and I apologize about that:

I encode my files in Handbrake with quality first setting (over bitrate) at level 17, which produces a very good video quality VBR output, to optimize space usage.

Please do not say that my files are encoded poorly.
They are encoded with a perfectly valid setting that produces high quality VBR outputs.
You may choose to call the PMP caching issue a slight issue, but in my eyes, and in the eyes of anyone that wants to use a high quality encoding setting, it is a priority-1 bug that should be fixed ASAP.
There was no mention of not supporting VBR when I decided to pay for my Plex Pass.

Also there are a few reasons why I can't re-encode all my content:
- I unfortunately no longer own the original material of most of my content.
- I can't settle for a lower quality video encoding, as I play these on my big TV at home.
- I can't settle for a wasteful CBR encoding
- Re re-encoding or transcoding the files I have means apply a lossy encoding on top of a lossy encoding

What are the chances that the caching bug is fixed soon?

BTW: I believe this bug also exists in the Plex Player app for TiVo, which I also own, and I'm just now recalling I gave up on using, over a month ago, because it's plagued by the same bug.

Thanks,
-Gianluca.


#17

There is no other way to put it, your files are NOT encoded correctly and that does not necessarily mean you are using bad settings, but if your settings continually produce bad results, then it is safe to say it is your settings.

If you don't want to correct the issue, that is entirely up to you, but suffice to say that your files will not play without issue until they are corrected.


#18

Hi, @trumpy81,
Got it, thank you.
I hope the Plex Media Player caching issue gets resolved soon.
Regards,
-Gianluca.