[mythtv-users] Mythpreviewgen

John Pilkington J.Pilk at tesco.net
Fri Oct 14 16:15:26 UTC 2011

On 14/10/11 15:29, Josu Lazkano wrote:
> 2011/9/22 Michael T. Dean<mtdean at thirdcontact.com>:
>> On 09/21/2011 09:24 AM, Josu Lazkano wrote:
>>> Hello again, I notice that mythpreviewgen is executed on program
>>> change and on channel change in LiveTV, it taken more than 50% of CPU
>>> usage and it generate lots of playback stops.
>>> I read about the nice(), but it must be executed as root thi way: nice
>>> -n 17 /usr/bin/mythpreviewgen
>> Any unprivileged user should be allowed to nice his/her own processes.
>> It's only "un-nicing" (raising priority) beyond a certain limit
>> (RLIMIT_NICE, which is typically) that requires privileges.
>>> But I don't know where to put this code. Need I to change the source
>>> code and compile it?
>> Yes, you would need to change the source to make it automatic.
>>>    I never compile MythTT, I just use the
>>> debian-multimedia repository. I think this will be the cause of all my
>>> playback problems, I will appreciate any help.
>>> Thanks and best regards.
>> However, you can instead just make a wrapper script called
>> mythpreviewgen and have it nice and/or ionice itself and then call the
>> actual mythpreviewgen binary.
>> Mike
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
>> http://www.mythtv.org/mailman/listinfo/mythtv-users
> Hello, thanks for your help, I create two scripts, one with nice() and
> the other with ionice():
> #!/bin/bash
> nice -n 19 mythpreviewgen.real $@
> #!/bin/bash
> ionice -c2 -n7 mythpreviewgen.real $@
> But it is getting same little stops on playback, this the first 10
> second of program change (with ionice script):
> http://dl.dropbox.com/u/1541853/mythpreview2.log
> Maybe it is related to sql, but I don't know what else to try.
> Thanks and best regards.
I don't recall seeing the 'random pauses' but I thought I would try the 
wrapper script.  It works ok - but I don't know if it would cure your 


# Script to reduce CPU impact of preview generation at the end of a 
# mv /usr/bin/mythpreviewgen to /usr/bin/mythpreviewgen.real
# copy this script to /usr/bin/mythpreviewgen and make it executable,
# chmod 755 /usr/bin/mythpreviewgen
# http://www.gossamer-threads.com/lists/mythtv/users/492811#492811

ionice -c3 nice mythpreviewgen.real  "$@"


John P

More information about the mythtv-users mailing list