[Pending] Added process priority setting to Comskip Launcher plugin. (1 Viewer)

elliottmc

Retired Team Member
  • Premium Supporter
  • August 7, 2005
    14,927
    6,061
    Cardiff, UK
    Home Country
    United Kingdom United Kingdom
    mm1352000 has already answered to say that he is okay with this as long as someone else does the work porting it to TVE35. So, I think we are okay in principle.

    Please bear in mind that while a recording is being processed by comskip, it cannot be deleted, and changing the priority will mean this takes even longer.

    So, if at all possible I'd like to see a situation where if the user tries to delete a recording that is being processed by comskip, MP can check this and stop the comskip process for that recording and the delete.

    However, that might be more complicated and may have to wait for TVE35.

    For now, I guess we can change the priority. Need to have a GIT branch for this fix.
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    A friend of mine told me :
    Lowering process priority wont cause more longer comskip runs to happen, unless there is CPU required for example on the playback and it's pretty sure that people tolerate not being able to delete something more than getting stuttering playback :)
    We can create bat for comskip so it's possible to watch tv while it is working (old AMD with multiple comskips running in background was too much and actually it is a bug in comskip).
    So not sure but when running under MP it is not able to set the process priority correctly - based on comskip dev it will always run at low priority by default (and even uses low I/O priority when running on >= Vista)
    Not sure why it doesn't work, but somehow TVE manages to trigger that bug in comskip.

    But seems good news too :)
    --
    Changes on 0.81.056
    - Bug solved: On some recordings comskip would restart processing the file when reaching the end of the recording resulting in an endless loop.
    --
    Yeah :)
     

    markus_g

    Portal Pro
    August 12, 2006
    104
    42
    Home Country
    Australia Australia
    A friend of mine told me :
    Lowering process priority wont cause more longer comskip runs to happen, unless there is CPU required for example on the playback and it's pretty sure that people tolerate not being able to delete something more than getting stuttering playback :)
    We can create bat for comskip so it's possible to watch tv while it is working (old AMD with multiple comskips running in background was too much and actually it is a bug in comskip).
    So not sure but when running under MP it is not able to set the process priority correctly - based on comskip dev it will always run at low priority by default (and even uses low I/O priority when running on >= Vista)
    Not sure why it doesn't work, but somehow TVE manages to trigger that bug in comskip.

    But seems good news too :)
    --
    Changes on 0.81.056
    - Bug solved: On some recordings comskip would restart processing the file when reaching the end of the recording resulting in an endless loop.
    --
    Yeah :)
    I have been using version 81.056, but have all sorts of problems if more than one comskip is being run with the server plugin. Mediaportal TV video playback stops and starts but the audio isn't affected. MP becomes unresponsive or very slow when trying to stop the video. This problem is on any recording and not just the one comskip is processing.

    A quick look at the logs it appears that MP is loosing server connection when the problem is occurring.

    I have tried running lots of manual comskip processes in the background without using the TVserver plugin and this doesn't affect MP.

    I am planning on doing some more tests and will capture some logs and will report it as a bug.

    Regards,
    Markus
     

    RonD

    Test Group
  • Team MediaPortal
  • December 20, 2011
    911
    278
    SillyValley CA
    Home Country
    United States of America United States of America
    I also use comskip and have problems using the recent versions. For me I get good acceptable results using comskip rev = 0.80.042. On my main MePo 1.5.0 win7 server, Ivybridge i5-3450 4-core 3.1 GHz, integrated HD2500 graphics/LAV, 5 ATSC tuner, I can do the following on a single seat Server/Client. This is with all comskip "play_nice" disabled, full speed.

    1. record 5 simultaneous 30 minute shows, auto-start 5 comskips at end of recordings
    2. record the next 5 simultaneous 30 minute shows
    3. while 5 comskips are running and 5 more shows are recording, watch a recorded show without any visible problems.

    When I've tried recent comskip versions I have major problems and can't use MePo client to watch a show with recording and comskip activity.

    With Win7 Task Manager and Resource Monitor I see the following for 0.80.042, comskip is running at low priority and comskip process does all disk reads with "Background" IO priority.

    With current comskip versions, 0.81.056, comskip runs at Normal priority and comskip disk reads are done with "Normal IO" priority. I've also found a way to use the stock comskip launcher plugin to start/run 0.81.056 at low priority but the disk traffic is still done at "Normal IO". This helps but I still see problems with 5*recording, 5*comskip, and watching a show at the same time. I may try tweaking the "play_nice" options to see if that helps.

    Looking at the comskip release history http://www.kaashoek.com/files/readme.txt there are a few interesting comments that may explain some of what is happening.

    Changes in 0.80.017
    - Set Comskip to THREAD_MODE_BACKGROUND_BEGIN priority to prevent the disk IO from blocking all other processes

    Changes in 0.81.013
    - Disabled the IO playnice to gain speed on multi core Windows 7 machines.

    I think I chose 0.80.042 since it was the last version that still did Background Disk reads. Not really sure what causes comskip problems but suspect the Normal vs Background IO Priority is part of the story.
     

    RonD

    Test Group
  • Team MediaPortal
  • December 20, 2011
    911
    278
    SillyValley CA
    Home Country
    United States of America United States of America
    A couple of comments on adjusting comskip priority. With the stock comskip launcher you can do the following. In these examples I put all the scripts and .exe files in the following folder, you'll need to modify the folder paths for your system

    My test folder path L:\MePo\comskip81_056

    make a 1 line RunComskip.cmd file with the following. Use either /LOW or /BELOWNORMAL to lower comskip.exe priority
    start "COMSKIP" /min /I /LOW L:\MePo\comskip81_056\comskip.exe %1

    use the following for comskip launcher, this starts a cmd.com to run the script and closes the cmd window when done.
    Program: C:\Windows\System32\cmd.exe
    Parameters: /c L:\MePo\comskip81_056\RunComskip.cmd "{0}"

    since this is just a 1 line command you can also just skip the .cmd file and do the following for comskip launcher and set LOW CPU priority
    Program: C:\Windows\System32\cmd.exe
    Parameters: /c start "COMSKIP" /min /low L:\MePo\comskip81_056\comskip.exe "{0}"

    On my 5 tuner 4-core IVB i5 system setting comksip to LOW CPU priority works for 2-3 active comskips but have problems if I test with 5 active comskips, 5 active recordings, and watching 1 program on a remote client. To pass this test I also needed to lower the IO Priority. I could not find a way do this with "just scripts", needed to download/use a small IOPriorityV1.1.exe file from sourceforge, and write small vbs script to start comskip at low CPU priority and set IO Priority "VeryLow".

    http://sourceforge.net/projects/iopriority/

    I uploaded the vbs script as RunComskip.txt, you'll need to modify the extension to RunComskip.vbs to use it. In the beginning of the vbs script you'll need to modify the strComSkip and strIOpriority "strings" with the path to your .exe files. To use RunComskip.vbs do the following for comskip launcher. Modify paths as needed.

    Program: C:\Windows\System32\cscript.exe
    Parameters: L:\MePo\comskip81_056\RunComskip.vbs "{0}"

    With the vbs script I can run 5-10 background comskips while recording 5 shows and watching 1 program on a remote client. Sometimes there a few video glitches when 5 recordings stop, 5 new recordings start, and 5 new comskips start but I can live with the hickups.

    NOTE: If you go to msg #21 of this thread, there is an updated zip/dll that includes the fixes in the script. I'm using the dll version without problems. Just save the ComSkipLauncher.dll file in the TV Server Plugins folder in case you have a problem and use the new dll.
     

    Attachments

    • RunComskip.txt
      2 KB
    Last edited:

    cwchapma

    Portal Pro
    October 15, 2006
    56
    34
    48
    Home Country
    Canada Canada
    I'm uploading the dll for this patch in case other people find it useful. Just replace the ComSkipLauncher.dll in 'C:\Program Files\Team MediaPortal\MediaPortal TV Server\Plugins' or your equivalent. You can set the priority in the plugin configuration.
     

    Attachments

    • ComSkipLauncher.zip
      8.1 KB

    cwchapma

    Portal Pro
    October 15, 2006
    56
    34
    48
    Home Country
    Canada Canada
    Here's an updated ComskipLauncher that also sets the io priority and memory priority to low for the comskip process. Thanks to @RonD for all the great info!
     

    Attachments

    • ComSkipLauncher.zip
      8.6 KB

    RonD

    Test Group
  • Team MediaPortal
  • December 20, 2011
    911
    278
    SillyValley CA
    Home Country
    United States of America United States of America
    cwchapma

    tried both of your ComSkipLaunchers on my 4 core system, run 5 parallel comskip, record 5 parallel shows, 2 active Clients (1 local, 1 remote)

    1st zip (.exe = 4/24/13) CPU = Idle, IO = Normal, shows the same problems I saw when I used script to do "Start /Low". Lower CPU priority helps, but MePo Client and video have major problems, CPU priority helps but IO Priority is still a problem

    2nd zip (.exe = 1/28/14) CPU = Idle, IO = Low, this works better, but my script approach CPU = Idle, IO = VeryLow/Background is still better.

    Could you build a 3rd version that also sets IO Priority = VeryLow = 0. In my script this is "IOPriorityV1.1.exe PID 0"

    When I use Resource Monitor or Msft Process Explorer I see the IO = Low priority, with Process Explorer I can manually tweak the IO Priority = Background and it improves the response.
     
    Last edited:

    Users who are viewing this thread

    Top Bottom