Video stutters in identical places every time

For help and support with Linux-specific issues
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
lash
Posts: 6
Joined: Mon Jan 16, 2017 4:10 am

Video stutters in identical places every time

Post by lash » Mon Jan 16, 2017 4:20 am

I have PS3 connected to UMS 6.5.3 on an Ubuntu 16.04. The video is stuttering.

As the problem does not occur if I download the file to my PS3 first and then play it, I assume the problem lies with the server software or the server machine.

The FAQ informs that I should attempt to reduce the video quality. It refers to a dropdown list selection which I presume is a reference to a GUI client I do not have installed.

The conf file says the following:
To make the videos use less bandwidth you can go to the Transcoding Settings tab and select a new value in the "Video quality settings" option.
I did a search in the conf file for the string "quality", and only one value seemed to have relevance, set as follows in my config:

Code: Select all

x264_constant_rate_factor = Automatic (Wireless)
mpeg2_main_settings = Automatic (Wireless)
My questions;

1. Which other alternative "preset" values are there to choose from, with respect to the ones mentioned in the FAQ?
2. How can I query the UMS that the video quality setting conf actually has been parsed and set? (I have verified the conf file is actually being read, due to other custom settings)

EDIT - ADDITION

Also, I've tried with the same file with 3 different settings now. It stuttters in the exactly same places every time. With the latest setting, the stutter was less pronounced, but still in the same place. This tells me that the Wifi isn't necessarily (only) to blame.

So a new question:

3. Do the automatic settings have dynamic streaming rates? (would account for there being repetitive patterns depending on the video deltas)
Last edited by lash on Mon Jan 16, 2017 5:13 am, edited 4 times in total.

User avatar
Nadahar
Developer
Posts: 869
Joined: Tue Jun 09, 2015 5:57 pm

Re: video quality enums for linux

Post by Nadahar » Mon Jan 16, 2017 4:30 am

The default configuration file UMS.conf has a description text for most settings. It should be in your tarball, but can also be found here.

To see what is actually happening, you'll have to check out the logfile - the default name is "debug.log" and its default location is /var/log/UMS-%username% as far as I can remember. The default log level is "debug", but you won't get all the details you might need with that log level. Set log level to "trace" in UMS.conf to get more information than you'd wish for in the log file. It should let you see most of what's happening. Running "trace" log level can reduce the performance, so I'd set it back to "debug" or "info" when you're not looking for something special.

lash
Posts: 6
Joined: Mon Jan 16, 2017 4:10 am

Re: video quality enums for linux

Post by lash » Mon Jan 16, 2017 5:06 am

Indeed, and in the config it says the following:
# Sets the quality for H.264 conversion.
# Possible values are either "Automatic (Wired)", "Automatic (Wireless)", or a
# CRF (Constant Rate Factor) value.
# Automatic options are highly recommended since they will adapt based on the
# video being played to ensure the highest quality for your network.
Am I to understand, then, that there are only two presets available?
Does anyone know what "Automatic (Wired)" and "Automatic (Wireless)" values equal in terms of "CRF" - in case these are interchangable entities?

User avatar
Nadahar
Developer
Posts: 869
Joined: Tue Jun 09, 2015 5:57 pm

Re: Video stutters in identical places every time

Post by Nadahar » Mon Jan 16, 2017 5:32 am

Yes, but you can also set the CRF value directly.

I have no idea how these settings affect transcoding quality or bandwidth, but this is the calculation used for the presets:

Code: Select all

			if (x264CRF.contains("Automatic")) {
				if (x264CRF.contains("Wireless") || maximumBitrate < 70) {
					x264CRF = "19";
					// Lower quality for 720p+ content
					if (media.getWidth() > 1280) {
						x264CRF = "23";
					} else if (media.getWidth() > 720) {
						x264CRF = "22";
					}
				} else {
					x264CRF = "16";

					// Lower quality for 720p+ content
					if (media.getWidth() > 720) {
						x264CRF = "19";
					}
				}
			}
Stuttering can generally be due to one of two main reasons: 1) Too weak CPU 2) To low network bandwidth. The cure is difference depending on what the reason is. If weak CPU is the cause, then you will only have stuttering when transcoding content (that is, playing content that your renderer can not play natively so that UMS has to convert it on-the-fly). If low network bandwidth is the issue, you will have problems both when transcoding and not. If your network is bad enough, you might have to transcode content that your renderer could otherwise play, to lower the quality enough for the network to carry. You may also have to do "higher compression" when transcoding to get the bandwidth low enough, so in a sense you want the opposite depending on if you want to save CPU or bandwidth. If you're low on both, you're out of luck.

You might have a general idea of what is your weak point, if not you should test whether stuttering applies only to transcoded content or to any content.

lash
Posts: 6
Joined: Mon Jan 16, 2017 4:10 am

Re: Video stutters in identical places every time

Post by lash » Mon Jan 16, 2017 6:07 am

Thanks for the insight. Indeed, the stuttering in identical places hints towards this being a CPU issue.

I will try without transcoding aswell, to see if I can get further evidence from this. But of course, in the end not transcoding is really not a desired option, as I then am limited to the capabilities of the client.

By the way, there is another directive in the config file that should be relevant to CPU issues:
# Maximum transcode buffer size in MB (recommended: 200)
# ------------------------------------------------------
# Size of buffer in MB before transmitting to client. The maximum value is 400
# if the program memory is set to its default value (768).
# Default: 200
maximum_video_buffer_size = 200
It says "maximum" here, but how does the application decide the minimal threshold for buffering?

And what does it mean about program memory here; there are no settings with keyword or description "memory" in the config file.

(There is also another setting minimum_web_buffer_size pertaining to buffering, although fiddling with this have not yielded any changes in my case)

User avatar
Nadahar
Developer
Posts: 869
Joined: Tue Jun 09, 2015 5:57 pm

Re: Video stutters in identical places every time

Post by Nadahar » Mon Jan 16, 2017 9:27 am

There is a corresponding setting "minimum_video_buffer_size" which default to 12 Mb.

"Program memory" is how much memory is allocated to UMS. UMS being a Java application is given a maximum amount of memory it can allocate by the JVM when the program is started. You can read more about this here. Normally I think this is set in UMS.sh.

Normally, all a buffer can do is smooth out certain spikes in CPU demand somewhat, the underlying problem won't change by increasing buffers. "mpeg2_main_settings" on the other hand might be worth some tweaking.

lash
Posts: 6
Joined: Mon Jan 16, 2017 4:10 am

Re: Video stutters in identical places every time

Post by lash » Mon Jan 16, 2017 9:47 am

You are right, in UMS.sh it's set at 768;

Code: Select all

ums      17785  2.5  5.6 1388444 228028 pts/1  Sl   17:56   7:20 java -Xmx768M -Xss2048k -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djna.nosys=true -classpath update.jar:ums.jar net.pms.PMS
Theoretically it could be a memory issue too? If it has to resort to swap, it could also struggle to keep up?

User avatar
Nadahar
Developer
Posts: 869
Joined: Tue Jun 09, 2015 5:57 pm

Re: Video stutters in identical places every time

Post by Nadahar » Mon Jan 16, 2017 8:50 pm

Most definitely. If you're short on RAM, you should try to reduce both this and the max buffer size.

lash
Posts: 6
Joined: Mon Jan 16, 2017 4:10 am

Re: Video stutters in identical places every time

Post by lash » Mon Jan 16, 2017 8:56 pm

Conversely, if I am NOT short of RAM, limiting the heap size too much would also have nasty effects, no? Is 768 "enough for everything" that the transcoders might be up to?

User avatar
Nadahar
Developer
Posts: 869
Joined: Tue Jun 09, 2015 5:57 pm

Re: Video stutters in identical places every time

Post by Nadahar » Tue Jan 17, 2017 3:47 am

Feel free to increase it, it's just a default - but normally it is sufficient.

Post Reply