DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 25th September 2015
e1-531g e1-531g is offline
ISO Quartermaster
 
Join Date: Mar 2014
Posts: 628
Default Mpv is lagging when watching movies

Hello,
I have OpenBSD-current amd64. I use softraid for full disc encryption. I use mpv for watching movies. I have them on HDD. The thing is: mpv is lagging. I don't know if I express correctly. The movie is stopping for fraction of a second and then plays well, then after few seconds stops and plays again and again.
I think that this happens a lot more frequently since I use full disc encryption. Before it was so rare that it doesn't bothered me.
How can I prevent this?
Reply With Quote
  #2   (View Single Post)  
Old 25th September 2015
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Generally, I find that problems with video performance on OpenBSD are due to video software/hardware and not related to I/O or CPU -- so using softraid is an unlikely root cause of the problem. For example, I could easily push 1280x720/50fps from a low powered (Atom N270) netbook using softraid to a PS3 media player, using less than 3% CPU, too. That little netbook couldn't display 480p on its display. Its video hardware was too low-end. And that was true whether using OpenBSD or Windows XP.
  1. What video driver is being used by X? (see /var/log/Xorg.0.log).
  2. What is the resolution of your display? (same log file)
  3. What is the resolution and framerate of the video that lags?
Reply With Quote
  #3   (View Single Post)  
Old 25th September 2015
e1-531g e1-531g is offline
ISO Quartermaster
 
Join Date: Mar 2014
Posts: 628
Default

Here is full log from Xorg:
http://paste.opensuse.org/a2a81eeb

1.
Code:
[   144.231] (II) LoadModule: "intel"
[   144.231] (II) Loading /usr/X11R6/lib/modules/drivers/intel_drv.so
[   144.294] (II) Module intel: vendor="X.Org Foundation"
[   144.294] 	compiled for 1.17.2, module version = 2.99.916
[   144.294] 	Module class: X.Org Video Driver
[   144.294] 	ABI class: X.Org Video Driver, version 19.0

[   144.294] (II) LoadModule: "vesa"
[   144.295] (II) Loading /usr/X11R6/lib/modules/drivers/vesa_drv.so
[   144.301] (II) Module vesa: vendor="X.Org Foundation"
[   144.301] 	compiled for 1.17.2, module version = 2.3.3
[   144.301] 	Module class: X.Org Video Driver
[   144.508] (II) UnloadModule: "vesa"
[   144.508] (II) Unloading vesa

2.
Code:
[   144.508] (--) intel(0): Output LVDS1 using initial mode 1366x768 on pipe 0
[   144.508] (==) intel(0): TearFree disabled
[   144.508] (==) intel(0): DPI set to (96, 96)
[   145.067] (II) intel(0): switch to mode 1366x768@60.0 on LVDS1 using pipe 0, position (0, 0), rotation normal, reflection none
3.
Code:
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1040, 2059 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
October 4,2015:
http://paste.opensuse.org/2bb1f573

Last edited by e1-531g; 4th October 2015 at 05:38 PM. Reason: Added information, and again
Reply With Quote
  #4   (View Single Post)  
Old 25th September 2015
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Thank you for the details, including the full log. Nothing jumped out at me, other than your video resolution is larger than your display, requiring downsizing of the image. Your video hardware is Intel HD 2000, which may be considered standard performance, rather than high performance, according to this particular specification document I found on the Internet.

Your video bitrate is 2 MB/sec, and while audio may be another half a megabyte or so per second, I'll bet your system can exceed this when reading the video file, even when using softraid. This is easy to test:

$ dd if=/path/to/media/file of=/dev/null

The output will provide the elapsed time, along with bytes per second. Compare the elapsed time with the media's duration. I/O will only be a problem if reading the file exceeds the media duration.
Reply With Quote
  #5   (View Single Post)  
Old 25th September 2015
e1-531g e1-531g is offline
ISO Quartermaster
 
Join Date: Mar 2014
Posts: 628
Default

Code:
1548134234 bytes transferred in 66.871 secs (23150903 bytes/sec)
23150903 is around 22 mebibytes per second. It is ok if I constantly, continuously read a file. When I watch movie mpv reads some part of big video file, decodes it and plays. In paralell HDD probably stays in idle for few seconds. Then it reads some more data from file. But I don't know if access time to HDD is a problem or maybe kernel need some time to process encrypted data. I suspect second option, because it wasn't that inconvenient when I haven't disc encryption.
Added:
Duration time of video is 5739 seconds. So avarage bitrate of movie is around 0.2572 mebibytes per second. It is around 2.058 mebibits per second.
Added2:
The only unencrypted partition which I have mounted in OpenBSD is FAT partition. dd tells me this about reading from uncrypted partition:
Code:
2496210944 bytes transferred in 33.909 secs (73614305 bytes/sec)
73614305 bytes/sec is around 70.2 mebibytes per second.

Last edited by e1-531g; 25th September 2015 at 02:05 PM. Reason: added to be clear
Reply With Quote
  #6   (View Single Post)  
Old 25th September 2015
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

If you replicate the same performance problem when displaying this video when read from the FAT partition, then I would suspect video HW/SW performance issues.

If you are unable to replicate the performance problem when the video is being read from the FAT partition, then I would suspect an I/O management issue.
Reply With Quote
  #7   (View Single Post)  
Old 25th September 2015
e1-531g e1-531g is offline
ISO Quartermaster
 
Join Date: Mar 2014
Posts: 628
Default

I have some hypothesis which I would like to check. I am going to back to this thread in a few days.
Reply With Quote
  #8   (View Single Post)  
Old 27th September 2015
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,503
Default

I do not use the mplayer fork mpv but in mplayer the choice of video output and cache size can also impact choppy video play back.

Code:
PooBear$ mplayer -vo help
MPlayer SVN-r37322 (C) 2000-2014 MPlayer Team
Available video output drivers:
	xv	X11/Xv
	gl_nosw	OpenGL no software rendering
	x11	X11 ( XImage/Shm )
	xover	General X11 driver for overlay capable video output drivers
	sdl	SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)
	gl	OpenGL
	gl_tiled	X11 (OpenGL) - multiple textures version
	dga	DGA ( Direct Graphic Access V2.0 )
	matrixview	MatrixView (OpenGL)
	null	Null video output
	mpegpes	MPEG-PES file
	yuv4mpeg	yuv4mpeg output for mjpegtools
	png	PNG file
	jpeg	JPEG file
	gif89a	animated GIF output
	tga	Targa output
	pnm	PPM/PGM/PGMYUV file
	md5sum	md5sum of each frame
	mng	MNG file
and some info on mplayer cache.
Reply With Quote
  #9   (View Single Post)  
Old 27th September 2015
e1-531g e1-531g is offline
ISO Quartermaster
 
Join Date: Mar 2014
Posts: 628
Default

I have tried watching on the same system (with softraid FDE) movie from unencrypted partition. It was better. Lags were less apparent/noticeable/visible. But they were still there.

In mpv on OpenBSD I have only five video outputs. I tried OpenGL and OpenGL-hq. On Windows in VLC it doesn't lag but it takes 20-30% of CPU time. In OpenBSD mpv uses about 15%-25% on both cores (lower). CPU in OpenBSD is in from 60% to 85% in idle during watching, but there are some lags.
Mpv also wrote something about desynchronization between audio and video, but it (I mean it = desynchronization) wasn't visible.

I have recompiled OpenBSD kernel with higher system clock's frequency(from 100 to 1000 HZ and after that also 550 HZ) and... it works well. It doesn't lag, it doesn't write lines about desynchronization between audio and video.

This is about Timer Interrupt Frequency in Linux. It seems to apply accidentally/circumstantially to OpenBSD's kernel as well.
http://lxr.free-electrons.com/source/kernel/Kconfig.hz

On the other hand this kernel is not supported, so I am going to experiment witch other media player and newer Intel's DRM driver. Now I have old DRM driver. The best performance I have gotten when I was using VAAPI backend in Linux. Maybe it will be available in OpenBSD as well with newer driver. I don't know. It is wishfull thinking
Reply With Quote
Reply

Tags
encryption, mpv, openbsd, watching videos

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Second Life Solaris Movies not working whispersGhost Solaris 0 14th June 2008 02:53 PM


All times are GMT. The time now is 05:43 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick