NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support Legacy (v4.x and earlier) v
« Previous 1 … 204 205 206 207 208 … 433 Next »
Powershell for postprocessing

Powershell for postprocessing
SickBoy
Offline

Senior Member

Posts: 346
Threads: 56
Joined: May 2005
#1
2014-10-07, 04:13 PM (This post was last modified: 2014-10-07, 04:18 PM by SickBoy.)
I use a bit of powershell for work, so when it came to configuring postprocessing stuff for a freshly installed OS and new configuration of NPVR, I opted to rewrite in Powershell.

Not so much looking for support (I have everything in my configuration working (knock on wood) that I can tell) - but I figured I'd post up what I wrote just in case anyone else is interested. As usual, use at your own risk. Oh, and I wrote and tested all of this on Powershell 4 in Windows 7.

Here's what my main postprocessing.bat file looks like:

Code:
REM use the below line for logging output REM powershell -NonInteractive -ExecutionPolicy unrestricted -NoLogo -NoProfile -f "C:\Users\Public\NPVR\Scripts\StreamFix.ps1" %1 >> C:\logs\postprocessing.log REM Use this one for no log powershell -NonInteractive -ExecutionPolicy unrestricted -NoLogo -NoProfile -f "C:\Users\Public\NPVR\Scripts\StreamFix.ps1" %1 SET _oldfile=%1 SET _newfile=%_oldfile:.ts=.mpg% REM Comskip powershell -NonInteractive -ExecutionPolicy unrestricted -NoLogo -NoProfile -f "C:\Users\Public\NPVR\Scripts\Comskip.ps1" %_newfile% %2

StreamFix.ps1: This one runs the .ts files generated by my HDHR through VideoRedo to fix junky timelines and kicks out a .mpg file.

Code:
trap { Write-Host $_ exit 1 } $ErrorActionPreference = "Stop" #stop on all errors #Make sure this path is correct $vrdPath = "C:\Program Files (x86)\VideoReDoPlus" $vpPath = $vrdPath + "\vp.vbs" $origFile = $args[0] $newFile = $args[0].split('.') $newFileFull = $newFile[0] + ".mpg" $renamedFile = $newFile[0] + "_orig.ts" Write-Host "Original File:" $origFile Write-Host "New File:" $newFileFull #$nologo = "//nologo" cscript.exe //nologo $vpPath $origFile $newFileFull /t1 /q /na Write-Host "Exit Code:" $LASTEXITCODE #Check that the output file exists before continuing $fileExists = Test-Path $newFileFull if ($fileExists -eq $true) { Rename-Item $origFile $renamedFile Write-Host "Deleting renamed original ts file:" $renamedFile Remove-Item $renamedFile } Write-Host " "

and Comskip.ps1:

Code:
trap { Write-Host $_ exit 1 } $ErrorActionPreference = "Stop" #stop on all errors $file = $args[0] $channel = $args[1] $comskipExe = "C:\comskip\comskip.exe" #Functions function numInstances([string]$process) { @(Get-Process $process -ErrorAction 0).Count } #Main script execution starts here #Skipping channels that don't need comskip, i.e. PBS if ($channel -match "21" -or $channel -match "22" -or $channel -match "23" -or $channel -match "24") { Write-Host "Not running Comskip on channel" $channel Write-Host "Exiting..." break } #Sleep a number of seconds equal to the channel nbr, #prevents multiple postprocessing files from running at exactly the same time Write-Host "Sleeping" $channel "seconds before starting comskip" Start-Sleep -s $channel #Check if comskip is running $comskips = 2 while ($comskips -gt "1") { $comskips = numInstances comskip Write-Host "Two or more comskip instances running, sleeping 15 seconds" Start-Sleep -s 15 } $curDatetime = Get-Date Write-Host $curDatetime Write-Host "Invoking comskip on" $file & $comskipExe $file $curDatetime = Get-Date Write-Host "Comskip finished." Write-Host $curDatetime
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  postprocessing batch to escape special characters donbrew 3 2,534 2019-11-06, 11:29 PM
Last Post: JavaWiz
  PostProcessing.bat not executing MiyoshiSaki 13 6,646 2019-09-03, 10:36 PM
Last Post: sub
  PostProcessing and PostCancel.bat being triggered but not working antenna 4 2,730 2018-08-05, 07:40 PM
Last Post: antenna
  PostProcessing.bat doesn't run wscrivens 23 10,441 2016-04-08, 06:30 PM
Last Post: Handy.Man
  Show CMD window while executing PostProcessing.bat uspino 6 3,861 2015-12-08, 11:41 PM
Last Post: mvallevand
  Havng trouble using VideoRedo in Batch (Postprocessing.bat) ????? puck64 0 2,112 2015-11-14, 10:39 AM
Last Post: puck64
  PostProcessing failing Quaraxkad 22 9,380 2015-10-19, 10:43 AM
Last Post: puck64
  PostProcessing.bat not run on Recording Cancel arrmo 9 3,913 2015-08-10, 01:31 PM
Last Post: arrmo
  Strange problem with PostProcessing and PsExec Reddwarf 8 3,910 2015-06-10, 07:39 PM
Last Post: Reddwarf
  PostProcessing not running, recording marked as recording service not running Reddwarf 12 5,364 2015-05-24, 11:20 PM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode