# mpv very unstable - Best settings for optimal video?



## i-bsd (Jul 4, 2018)

Using drm-next on X1 Carbon 6th. intel driver.

I've tried vo=xv, vo=gpu (default) and vo=x11. Got half way through a video and it just froze frame and crashed.

Or I get a lot of dropped frames (video is very laggy):


```
AO: [oss] 44100Hz stereo 2ch s32
VO: [gpu] 1280x720 yuv420p
AV: 00:00:13 / 00:01:43 (13%) A-V:  0.000 Dropped: 245
```

Has anyone got suggestions on how to optimize mpv?


----------



## k.jacker (Jul 5, 2018)

I watch youtube and tv streams using the Intel drm-next-kmod as well. Videos play well in mpv, mplayer and vlc.
We share our internet connection with our neighbours so sometimes it‘s getting slow. 
To configure mplayer and vlc to use more cache prevents from stuttering for me. Haven‘t tried that with mpv, but it should have such an option, too.


----------



## fernandel (Jul 5, 2018)

I did try mpv too but I cannot find mpv.conf? Where shoul I look, please?
Thank you.


----------



## k.jacker (Jul 5, 2018)

I just looked into mpv(1).
In the section "CONFIGURATION FILES", subsection "Profiles" (that is line 491) there is an example that I just tried, called [big-cache]



fernandel said:


> I cannot find mpv.conf? Where shoul I look, please?


User config file is ~/.config/mpv/mpv.conf (that is, as allways  explained in the FILES section at the end of the manpage)
You have to create it yourself.


----------



## i-bsd (Jul 5, 2018)

k.jacker said:


> I watch youtube and tv streams using the Intel drm-next-kmod as well. Videos play well in mpv, mplayer and vlc.
> We share our internet connection with our neighbours so sometimes it‘s getting slow.
> To configure mplayer and vlc to use more cache prevents from stuttering for me. Haven‘t tried that with mpv, but it should have such an option, too.



Do you mind sharing your mpv.conf settings?

Are you just using `cache=123400` according to the man page?


----------



## k.jacker (Jul 5, 2018)

Yeah, I created ~/.config/mpv/mpv.conf
and added, like shown in the example:

```
cache=123400
demuxer-readahead-secs=20
```
I tried with other values as well and ran mpv -v some/network/stream/ to check if those settings get applied and they did.

Couldn't test with slow internet connection yet, but I guess this is a good start.
(I didn't use the [big-cache] from the example since I wanted it to be always applied and not just when calling mpv with a specific profile)
Hope it will help you, too!


----------



## i-bsd (Jul 5, 2018)

Thanks.

I just discovered a strange issue that I'm pretty sure is related to drm-next:

If I log out of X and back in again, mpv plays videos perfectly. Seems to randomly happen where performance drops on video playback and requires me logging out of X to fix. I don't even know where to begin to find the cause of this.


----------



## k.jacker (Jul 5, 2018)

Hei i-bsd 

I am far from in Xorg expert and what you experience sounds weird indeed.
Only thing I could imagine is that the drm-next-kmod driver maybe doesn't attach quick enough before Xorg starts and then,
after you log out an in again... it meanwhile has attached and Xorg picks it up.

Are there other performance issues when mpv laggs? Can you move/wiggle windows around the screen without problems?
If other things, like moving windows laggs as well, then there is no driver/hardware acceleration.
Look if there is an indication for, that the drm-next-kmod driver didn't attach, in the output of `dmesg|grep drm`

I'd suggest updating mpv and if that doesn't do the trick, start a new thread and provide the information from the testing above.


Hope that helps!


----------



## scottro (Jul 6, 2018)

Interesting.  Is it consistent?  As k.jacker suggests, is mpv (and its dependencies) up to date? 

My own experience, on a fast Internet connnection, even with wireless, which will only do a few MBs in FreeBSD, is that mpv has been troublefree for me on a couple of laptops running 11.2 and a workstation tower with 11.1  Only one of these has a video card new enough to require drm-next.


----------

