I want to play movies without hangs

On 7 May 2012, at 21:43, Dale wrote: > ... > Also, there was a thread a good while back with this issue and their fix > was to do a emerge -e world with everything optimized for their CPU and > such. May be worth thinking about at least.

I understood that issue as significantly different - in that case there was stuttering of demanding video with no other i/o occurring. In this case *any* video, even low-res standard-def video, is pausing when i/o load is applied. The previous case is CPU / GPU video decoding performance issue, I think this one is clearly not.

I don't know, haven't used gentoo sources in ages. I don't need fb beautification, zcache, alps or livecd goodies. I like to be as close to upstream as possible, so bug reports are taken seriously.

vanilla-sources work reliably with that annoying io-stuff. But no matter which kernel I tried, ck, zen, gentoo, love etc pp that annoying io-stuff was always there.. so no reason at all to use a patched up kernel.

> Also, there was a thread a good while back with this issue and their fix > was to do a emerge -e world with everything optimized for their CPU and > such. †May be worth thinking about at least.

Video playback and CPU optimisations go hand in hand.

One video I have had for a long time, I could never play it at all on any of my computers and I could not beleive what I saw next... I got a new PC and thought to give it a try. It worked painfully, skipping and using 100% of one of my CPU cores. I was sad and thought this video might have been corrupt. After a wave of cleanup, I had removed all CPU optimisation flags from my make.conf (I was originally negating many, like -sse, etc, so I left it "to my profile" to choose what was needed) and recompiled everything. After that, the same movie played in the best quality I had ever seen and CPU usage was below 5% !!!! I was even able to open 12 movies (4x3) all playing at the same time (this was unthinkable before I optimized my system). Anyway, keep in mind that my particular starting scenario was that I had "un-optimized" it long ago!

> > OK, fire up two terminals. In one run top, hit 1 & z so you see all > > your CPUs and then watch CPU usage. In the second terminal su to root > > and run iotop -o. Now, watch for a few minutes and get a feel for > > what's going on when video is not running. Then start your video and > > watch IO usage and CPU usage. Where's the problem? > > > > Once you get an idea where the bottleneck is we can address what a > > solution might be. In general, if the CPUs aren't maxed out and it's > > an I/O problem then usually a bit more buffering is a simple solution. > > Other more draconian solution might be a real-time kernel with a > > player (if there is one) that is set up for real-time playback. > > > > Looking forward to hearing your test results. > > Thanks for your support, Mark! > > I did this already, but sometimes I do not notice anything. I guess it's > short I/O operations in that case. CPU load is not the problem, and it > happens for both high-quality videos and small ones. > Currently iotop shows stuff like kjournald, kworker, kdeinit4, > akonadiserver, firefox. And lots of virtuoso-t and nepomuk when I enable > indexing again, which I just suspended. > And mplayer of course, it shows up in about every 2nd redisplay, which > happens every second. > > Well... but when I do the same in the other window manager, it seems I > see fewer processes then. Are they mostly suspended when I am on another > display?

I watched for longer now, and this does not seem to be true.

> And I should fire up the same stuff (Firefox, Chromium, maybe KDEPIM > stuff) in the other WM and see if this makes things worse. But I'll do > this tomorrow. Thanks for the inspiration, though, at least I have > something more to try now.

I am running Enlightenment 0.16 in parallel now, with Firefox, Chromium, Kontact, Claws, Liferea, Amarok (which is doing a lot of I/OP stuff at the moment according to iotop), and Dolphin showing a large directory of multimedia files wit thumbnails. But I don't see akonadi related processes in iotop, that is unusual. I did the dd command to create more I/O. No gaps in video display at all.

When I play the video from within KDE (running Konsoles, Konqueror, Dolphin and a lot of plasma stuff), I have gaps, and when I do the dd command, there are in the range of seconds. Even for some seconds after I canceled the dd.

I also tried a fresh, unconfigured KDE session by another user. I've already done that, and there were also gaps in video playback, although it seems they were fewer. But this time, I was not able to reproduce them. Huh?

I guess I could remove anything running on my KDE desktop one by one, including plasmoids, and see if playback gets better. But not now, I finally have to actually do some work.

> I guess I could remove anything running on my KDE desktop one by one, > including plasmoids, and see if playback gets better. But not now, I > finally have to actually do some work.

I recently experienced slowdowns and delays with KDE. It turned out I had inadvertently disabled swap (I'd rearranged my partitions and not updated fstab). As soon as I gave it some swap space the delays disappeared.

-- Neil Bothwick

Sarchasm : The gulf between the author of sarcastic wit and the person who doesn't get it.

> On Wed, 9 May 2012 21:44:19 +0200, Alex Schuster wrote: > > > I guess I could remove anything running on my KDE desktop one by one, > > including plasmoids, and see if playback gets better. But not now, I > > finally have to actually do some work. > > I recently experienced slowdowns and delays with KDE. It turned out I > had inadvertently disabled swap (I'd rearranged my partitions and not > updated fstab). As soon as I gave it some swap space the delays > disappeared.

There's plenty of swap space available. With 16 G of RAM it should not be needed, but sometimes my load gets really really high, and when I can use the system again, there is 2-3 G of swap usage. I haven't found out yet what this is, it seems to happen when emerging things, maybe related to having 5 G tmpfs for portage, but when it happened the last time only 100 M were being used.

Alex Schuster wrote: > Neil Bothwick writes: > >> On Wed, 9 May 2012 21:44:19 +0200, Alex Schuster wrote: >> >>> I guess I could remove anything running on my KDE desktop one by one, >>> including plasmoids, and see if playback gets better. But not now, I >>> finally have to actually do some work. >> >> I recently experienced slowdowns and delays with KDE. It turned out I >> had inadvertently disabled swap (I'd rearranged my partitions and not >> updated fstab). As soon as I gave it some swap space the delays >> disappeared. > > There's plenty of swap space available. With 16 G of RAM it should not > be needed, but sometimes my load gets really really high, and when I can > use the system again, there is 2-3 G of swap usage. I haven't found out > yet what this is, it seems to happen when emerging things, maybe related > to having 5 G tmpfs for portage, but when it happened the last time only > 100 M were being used. > > Wonko > >

Is there a way to find out what is using swap? Maybe something related to the video is on swap which at times can be slow, certainly slower than ram.

I have always wondered how to find this out myself.

Dale

:-) :-)

-- I am only responsible for what I said ... Not for what you understood or how you interpreted my words!

> Is there a way to find out what is using swap? †Maybe something related > to the video is on swap which at times can be slow, certainly slower > than ram. > > I have always wondered how to find this out myself.

Well the OS uses swap, i dont know if its possible to then tie that directly to a process. You can find out if swap is being at all using with vmstat; so= swap out, si=swap in.

> There's plenty of swap space available. With 16 G of RAM it should not > be needed, but sometimes my load gets really really high, and when I can > use the system again, there is 2-3 G of swap usage. I haven't found out > yet what this is, it seems to happen when emerging things, maybe related > to having 5 G tmpfs for portage, but when it happened the last time only > 100 M were being used.

I'm not the OP but posted a two part post that didn't quite come out like I expected. One for the OP to try to find out what was using swap, just in case it mattered. Two to ask how that is done in case he didn't know and for me since I don't know either. lol

I was hoping for a command that says program foo is using X amount of swap but I guess not.

Interesting that there isn't a real good tool for this.

Dale

:-) :-)

-- I am only responsible for what I said ... Not for what you understood or how you interpreted my words!

Am 10.05.2012 05:59, schrieb Adam Carter: >> There's plenty of swap space available. With 16 G of RAM it should not >> be needed, but sometimes my load gets really really high, and when I can >> use the system again, there is 2-3 G of swap usage. I haven't found out >> yet what this is, it seems to happen when emerging things, maybe related >> to having 5 G tmpfs for portage, but when it happened the last time only >> 100 M were being used. > > Yeah so it wont be swap related. This sounds more like the desktop > responsiveness issue discussed a while back. It might be worth > googling that (main issue was fixed in later kernels) > http://www.phoronix.com/scan.php?page=article&item=linux_2637_video&num=1> > There's other things that may help, ie > CONFIG_HZ_1000=y > CONFIG_HZ=1000 >

Does the CONFIG_HZ setting today really have that much of an impact? I mean with tickles kernels and high res timers it should matter that much, or am I wrong? Playing video is not really a low-latency-multimedia-app, on the other hand: you never really know :)

On Wed, May 9, 2012 at 8:00 PM, Alex Schuster <wonko [at] wonkology> wrote: > Neil Bothwick writes: > >> On Wed, 9 May 2012 21:44:19 +0200, Alex Schuster wrote: >> >> > I guess I could remove anything running on my KDE desktop one by one, >> > including plasmoids, and see if playback gets better. But not now, I >> > finally have to actually do some work. >> >> I recently experienced slowdowns and delays with KDE. It turned out I >> had inadvertently disabled swap (I'd rearranged my partitions and not >> updated fstab). As soon as I gave it some swap space the delays >> disappeared. > > There's plenty of swap space available. With 16 G of RAM it should not > be needed, but sometimes my load gets really really high, and when I can > use the system again, there is 2-3 G of swap usage. I haven't found out > yet what this is, it seems to happen when emerging things, maybe related > to having 5 G tmpfs for portage, but when it happened the last time only > 100 M were being used.

Hi,

I realize this thread is bigger than an encyclopedia by now, so I apologize if this has already been suggested. :)

I'm curious if you look at /proc/interrupts if the disk with I/O problems is sharing interrupt with some other device. Maybe there is a conflict of some sort.

On my motherboard, one of the SATA controllers shares an interrupt with the soundcard, for example.

> I realize this thread is bigger than an encyclopedia by now, so I > apologize if this has already been suggested. :)

Well, I'm happy for any input on this :) This problem is really annoying.

> I'm curious if you look at /proc/interrupts if the disk with I/O > problems is sharing interrupt with some other device. Maybe there is a > conflict of some sort. > > On my motherboard, one of the SATA controllers shares an interrupt > with the soundcard, for example.

Good point. But this does not seem to be the case. The only lines that have multiple entries are two interrupts with ohci_hdc and snd_hda_intel, that should be no problem. The two ahci entries have their own interrupts.

I did not yet find the time to remove the plasmoids (all is fine in other window managers, or for another user with a plain unconfigured KDE desktop), today I dealt with a horrible and weird qt upgrade experience on another PC. Finally I was able to downgrade to 4.7, and at least stuff is working again there.

I've done some longer testing, always playing the same video parallel with a dd if=/dev/zero of=/tmp/10G bs=1M count=10000, in mplayer, for a minute, several times. When I do this by opening the file in Dolphin, I get about 15 interruptions, some for longer than a second. Started on the command line, there are very few, I can play the video for minutes without a gap. Hooray!

In KDE, I usually play videos by opening them in Dolphin. I exchanged 'mplayer %U' by 'xterm -T MPLAYER -e mplayer %U' in the settings, now mplayer runs in a terminal, and all is fine. I created a window rule so the terminal automatically minimizes. Cool!

It only happens in mplayer and mplayer2. Other players work fine, but I like mplayer best, and prefer to run it without any window decoration.

On 11 May 2012 21:40, Alex Schuster <wonko [at] wonkology> wrote: > Finally, I found something. It's Dolphin! > > I've done some longer testing, always playing the same video parallel > with a dd if=/dev/zero of=/tmp/10G bs=1M count=10000, in mplayer, for a > minute, several times. When I do this by opening the file in Dolphin, I > get about 15 interruptions, some for longer than a second. Started on the > command line, there are very few, I can play the video for minutes > without a gap. Hooray! > > In KDE, I usually play videos by opening them in Dolphin. I exchanged > 'mplayer %U' by 'xterm -T MPLAYER -e mplayer %U' in the settings, now > mplayer runs in a terminal, and all is fine. I created a window rule so > the terminal automatically minimizes. Cool! > > It only happens in mplayer and mplayer2. Other players work fine, but I > like mplayer best, and prefer to run it without any window decoration. > > Now, would this be an MPlayer problem, or one of Dolphin? >

Apologies: I haven't followed this thread from the beginning, but do you have any advanced power management features enabled (especially hard drive related)? When I pull the power cord on my lap-top, it goes into all kinds of nutty "power-saving" and mplayer has long pauses while the drive spins back up.

> but do you have any advanced power management features > enabled (especially hard drive related)?

My drives spin down after 30 minutes of idle time, but this never happens for the system drive. The CPU is set to throttle down from 3600 MHz to 1400 MHz with the ondemand governor, but changing to performance governor makes no change.

> When I pull the power cord on my lap-top, it goes into all kinds > of nutty "power-saving" and mplayer has long pauses while > the drive spins back up.

Yeah, but those pauses are much longer than the small interruptions that are a fraction of a second mostly, and do not happen 15 times per minute. And it only happens when MPlayer is started from Dolphin. Well, mainly, when there is much system load, I also had small interruptions when I run mplayer from the command line, but they are much much less frequent, and do not happen under normal circumstances, like when doing emerges while playing videos.

On 12 May 2012 11:05, Alex Schuster <wonko [at] wonkology> wrote: > Norman Invasion writes: > >> On 11 May 2012 21:40, Alex Schuster <wonko [at] wonkology> wrote: >> > Finally, I found something. It's Dolphin! > [...] >> Apologies: I haven't followed this thread from the beginning, > > Which was quite long ago :) > >> but do you have any advanced power management features >> enabled (especially hard drive related)? > > My drives spin down after 30 minutes of idle time, but this never happens > for the system drive. The CPU is set to throttle down from 3600 MHz to > 1400 MHz with the ondemand governor, but changing to performance governor > makes no change. > >> When I pull the power cord on my lap-top, it goes into all kinds >> of nutty "power-saving" and mplayer has long pauses while >> the drive spins back up. > > Yeah, but those pauses are much longer than the small interruptions that > are a fraction of a second mostly, and do not happen 15 times per minute. > And it only happens when MPlayer is started from Dolphin. Well, mainly, > when there is much system load, I also had small interruptions when I run > mplayer from the command line, but they are much much less frequent, and > do not happen under normal circumstances, like when doing emerges while > playing videos. >

I'm just recalling that I get stuttering audio in freebsd, which is caused by what-I-don't-know, but only happens when the CPU load is low. Firing up burncpu or doing useless recompiles ameliorates it.

> Is there a way to find out what is using swap? Maybe something related > to the video is on swap which at times can be slow, certainly slower > than ram. > > I have always wondered how to find this out myself.

There's lots of information for all processes in /proc/<pid>/. Trying to read /proc/<pid>/mem (I think it was this file) in mc was not such a good idea, the system froze with lots of HD activity, and after half an hour I rebooted with Alt-SysRq-{K,E,I,S,U,B}.

I improved the script a little, it allows sorting by PID, size and name, and can restrict the output to specific processes or show only those using more swap than specified. If interested you can download it here: http://www.wonkology.org/utils/getswapYou need to be root to see processes you do not own.

But of course, I forgot to run it after the sudden swap problem happened lately. So I still do not know what was going on there. I'll wait for the next time it happens.

On Sat, May 12, 2012 at 8:34 PM, Alex Schuster <wonko [at] wonkology> wrote: > Dale writes: > >> Is there a way to find out what is using swap? ¬†Maybe something related >> to the video is on swap which at times can be slow, certainly slower >> than ram. >> >> I have always wondered how to find this out myself. > > Me too, so when I had this sudden swap problem for the first time, I > searched for a method to do this and found a script here: > http://northernmost.org/blog/find-out-what-is-using-your-swap/> > There's lots of information for all processes in /proc/<pid>/. Trying to > read /proc/<pid>/mem (I think it was this file) in mc was not such a good > idea, the system froze with lots of HD activity, and after half an hour I > rebooted with Alt-SysRq-{K,E,I,S,U,B}. > > I improved the script a little, it allows sorting by PID, size and name, > and can restrict the output to specific processes or show only those > using more swap than specified. If interested you can download it here: > http://www.wonkology.org/utils/getswap> You need to be root to see processes you do not own. > > But of course, I forgot to run it after the sudden swap problem happened > lately. So I still do not know what was going on there. I'll wait for the > next time it happens. > > ¬† ¬† ¬† ¬†Wonko >

> On Sat, May 12, 2012 at 8:34 PM, Alex Schuster <wonko [at] wonkology> > wrote: > > Dale writes: > > > >> Is there a way to find out what is using swap? †Maybe something > >> related to the video is on swap which at times can be slow, > >> certainly slower than ram. > >> > >> I have always wondered how to find this out myself. > > > > Me too, so when I had this sudden swap problem for the first time, I > > searched for a method to do this and found a script here: > > http://northernmost.org/blog/find-out-what-is-using-your-swap/> > > > There's lots of information for all processes in /proc/<pid>/. Trying > > to read /proc/<pid>/mem (I think it was this file) in mc was not such > > a good idea, the system froze with lots of HD activity, and after > > half an hour I rebooted with Alt-SysRq-{K,E,I,S,U,B}. > > > > I improved the script a little, it allows sorting by PID, size and > > name, and can restrict the output to specific processes or show only > > those using more swap than specified. If interested you can download > > it here: http://www.wonkology.org/utils/getswap> > You need to be root to see processes you do not own. > > > > But of course, I forgot to run it after the sudden swap problem > > happened lately. So I still do not know what was going on there. I'll > > wait for the next time it happens. > > > > † † † †Wonko > > > > sys-process/htop

Huh? I only see the total amount of swap being used, but no entry per process.

On Sat, May 12, 2012 at 8:58 PM, Alex Schuster <wonko [at] wonkology> wrote: > Michael Mol writes: > >> On Sat, May 12, 2012 at 8:34 PM, Alex Schuster <wonko [at] wonkology> >> wrote: >> > Dale writes: >> > >> >> Is there a way to find out what is using swap? ¬†Maybe something >> >> related to the video is on swap which at times can be slow, >> >> certainly slower than ram. >> >> >> >> I have always wondered how to find this out myself. >> > >> > Me too, so when I had this sudden swap problem for the first time, I >> > searched for a method to do this and found a script here: >> > http://northernmost.org/blog/find-out-what-is-using-your-swap/>> > >> > There's lots of information for all processes in /proc/<pid>/. Trying >> > to read /proc/<pid>/mem (I think it was this file) in mc was not such >> > a good idea, the system froze with lots of HD activity, and after >> > half an hour I rebooted with Alt-SysRq-{K,E,I,S,U,B}. >> > >> > I improved the script a little, it allows sorting by PID, size and >> > name, and can restrict the output to specific processes or show only >> > those using more swap than specified. If interested you can download >> > it here: http://www.wonkology.org/utils/getswap>> > You need to be root to see processes you do not own. >> > >> > But of course, I forgot to run it after the sudden swap problem >> > happened lately. So I still do not know what was going on there. I'll >> > wait for the next time it happens. >> > >> > ¬† ¬† ¬† ¬†Wonko >> > >> >> sys-process/htop > > Huh? I only see the total amount of swap being used, but no entry per > process.

Hit F2, and go down to 'columns'. Anything per-process found under /proc can be added as a column.

> On 12 May 2012 11:05, Alex Schuster <wonko [at] wonkology> wrote: > > Norman Invasion writes: > > > >> On 11 May 2012 21:40, Alex Schuster <wonko [at] wonkology> wrote: > >> > Finally, I found something. It's Dolphin! > > [...] > >> Apologies: I haven't followed this thread from the beginning, > > > > Which was quite long ago :) > > > >> but do you have any advanced power management features > >> enabled (especially hard drive related)? > > > > My drives spin down after 30 minutes of idle time, but this never > > happens for the system drive. The CPU is set to throttle down from > > 3600 MHz to 1400 MHz with the ondemand governor, but changing to > > performance governor makes no change. > > > >> When I pull the power cord on my lap-top, it goes into all kinds > >> of nutty "power-saving" and mplayer has long pauses while > >> the drive spins back up. > > > > Yeah, but those pauses are much longer than the small interruptions > > that are a fraction of a second mostly, and do not happen 15 times > > per minute. And it only happens when MPlayer is started from > > Dolphin. Well, mainly, when there is much system load, I also had > > small interruptions when I run mplayer from the command line, but > > they are much much less frequent, and do not happen under normal > > circumstances, like when doing emerges while playing videos. > > > > I'm just recalling that I get stuttering audio in freebsd, which is > caused by what-I-don't-know, but only happens when the CPU load is > low. Firing up burncpu or doing useless recompiles ameliorates it. >

I was getting stuttering audio from a sizeable % of my .avi files served from a FreeBSD NAS. The likely cause became obvious when I noticed that it was only on .avi files - all real containers were fine[1].

mencoder -ovc copy -oac copy -of avi -o <new_file> <old_file>

fixed it permanently. I'm won't go so far as to say this might apply to your issue, but sometimes the simplest things are the actual causes :-)

[1] .avi files are notorious for this shit. It's what happens when you are Microsoft and you release any old crappy format without consulting the other experts out there (who will always outnumber you)