High CPU usage with v4l2 tv card (recent problem)
mpv version and platform
cplayer: mpv git-eacf4a7d9b (C) 2000-2017 mpv/MPlayer/mplayer2 projects cplayer: built on Sat Feb 25 07:27:33 CST 2017 cplayer: ffmpeg library versions: cplayer: libavutil 55.34.101 cplayer: libavcodec 57.64.101 cplayer: libavformat 57.56.101 cplayer: libswscale 4.2.100 cplayer: libavfilter 6.65.100 cplayer: libswresample 2.3.100 cplayer: ffmpeg version: 3.2.4 arch linux kernel 4.9.11-1 alsa-lib 1.1.3-1 mplayer 37916-1 nvidia 378.13-2 using X/KDE/nvidia proprietary drivers in regular arch I've also tried rebuilding ffmpeg, kwin, mesa, mpv, etc., issue remains
Reproduction steps
since a few git updates ago, cpu usage in mpv goes to 120-150% when watching tv card (Hauppauge WinTV-HVR-955Q using v4l2 driver) whereas mplayer with same options shows cpu usage @ 30-40% (both show hw accel)
specifiying --profile=opengl-hq (and other optimizations) make no difference, and will increase cpu usage (depending on options such as scale, interpoation, etc)
turning sound off on mpv shows cpu reduced to 30-50% which could be a clue to the problem, but as I said, mplayer is fine (with same alsa or pulse output), in fact using pulse on mplayer lowers cpu usage to 7-9%.
NOTE: "env __GL_THREADED_OPTIMIZATIONS=0" needed in mpv (as per https://github.com/mpv-player/mpv/issues/4060 ) or cpu spikes up to 220-250% - this is not needed in mplayer
command line: env __GL_THREADED_OPTIMIZATIONS=0 mpv --no-config --tv-driver=v4l2 --tv-device=/dev/video0 --tv-input=1 --tv-norm=ntsc --tv-width=640 --tv-height=480 --tv-forceaudio=yes --tv-alsa --tv-adevice=hw.2 --tv-immediatemode=no --tv-amode=1 --tv-fps=30 tv:///
compared to mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:alsa=1:adevice=hw.2:amode=1:input=1:immediatemode=0:forceaudio=yes:norm=ntsc -fps 30
Expected behavior
hw accel and cpu usage at 30-40% (or lower)
Actual behavior
cpu usage at 120-150% (or higher) on mpv only
Log file
http://sprunge.us/RUAV
Do you have any reason to believe this is specific to tv://?
Also bisect which git commit causes this.
Do you have any reason to believe this is specific to tv://?
playing regular files (mp4 for instance) with mpv/mplayer (and --no-config) shows cpu usage in mpv @ 15-20%, and mplayer at <10%, so it seems like it is doing hw accel/sound fine otherwise, I've only seen the high cpu usage when using tv://
which git commit
like I said, it started about a week or so ago, so I'll try rebuilding from then. I orginally thought it was the nvidia driver update of about a week ago, but other than the GL_THREADING mentioned there was no other issues related to that as far as I can tell that would affect tv: playback specifically
well I rebuilt mpv git versions back to Feb 2 and cpu usage is still high for v4l2, so I'm not sure what it could be. it's just weird that mplayer works fine, and mpv does not.
I went back down to alsa 1.1.2, and the first time I tried the tv card input, cpu was around 90-100%. After closing and reopening, it seemed back to how it was originally (20-30%). I upgraded back to 1.1.3, and cpu usage went high again. On a whim I closed and reopened, and now it's doing 20-30% cpu usage. Tried again and goes back to 100+ %
A bit more messing around makes me think it's an alsa issue, or even a usb/alsa issue (the tv card is a usb card). manually running "alsactl kill quit" after closing down mpv seems to reset alsa and prevents the high cpu usage.
let's call this resolved, since it doesnt seem to be an mpv issue.