home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Products
TV-Server
My TS fix/clean and advert ( comskip ) removal script
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="prupert" data-source="post: 483698" data-attributes="member: 69540"><p>First off, I am by no means a script genius, it took me ages to get this far and people with more knowledge than me will no doubt find loads of faults in what I have written. Anyway, since I couldn't find anything on the forums related to this and I had to go to so many places to find all this info, I thought I would share it, hope this is the right place.</p><p></p><p>I have provided all the respective .exes in the accompanying zip file. Hope this is ok, anybody who maintains these exes and dont want them zipped here, please contact me via PM and I will remove them.</p><p></p><p>To use, extract the zip to some where. Enable the comskip plugin in TVServer, in the configuration of the plugin choose the pp1.bat file as the file to run and make sure you choose to run it after the recording ENDS.</p><p></p><p>You'll no doubt have to edit it a bit, but I have tried to indicate what you should edit.</p><p></p><p>More details will be found on my website, <a href="http://www.prupert.co.uk" target="_blank">putting the no back in technology | pruperting</a>, I'll add the direct link in a bit and it will include the script I run on my Ubuntu server (where the cleaned file is moved to) to convert the file to something smaller.</p><p></p><p>Here is the bat code:</p><p></p><p>[CODE]</p><p>@ECHO off</p><p>Rem pp1.bat</p><p>Rem v0.1 09.07.09</p><p>Rem more details found on www.prupert.co.uk</p><p>Rem my first attempt at a batch file to be called by the comskip plugin in TVServer</p><p>Rem </p><p>Rem it cleans a TS file with mpeg2repair, then it runs comskip on it (the .ini has UK TV settings), then it cuts the TS file with mencoder based on the comskip's edl file, then it transfers it to my network folder and cleans up the crud</p><p>Rem %1 is the fully qualified name of the recorded mpeg file.</p><p>Rem I start VLC here since it is one of the processes that I have set the Powerscheduler to prevent system standby, thus it ensures the system does not shutdown whilst the bat file is running</p><p>START "" "C:\Program Files\VideoLAN\VLC\vlc.exe"</p><p> </p><p>Rem this is because where I eventually move the cleaned file to, is on a USB hardrive on another computer, and this helps spin up the drive, you can delte this</p><p>%SystemRoot%\explorer.exe "Z:\"</p><p></p><p>ECHO ************************** >> "%~dpn1.PostLog.txt"</p><p>ECHO Post Processing started on %date% %time% >> "%~dpn1.PostLog.txt"</p><p>ECHO Post Processing started on %date% %time%</p><p>Rem Sadly, I just couldnt get ProjectX to work properly, I have left this in for intersts sake</p><p>Rem ECHO ProjectX cleanup started on %date% %time% >> "%~dpn1.PostLog.txt"</p><p>Rem ECHO ProjectX cleanup started on %date% %time%</p><p>Rem Echo %TIME% - Demultiplexing %~nx1</p><p></p><p>Rem echo "# Project-X INI" > "%TEMP%\X.ini"</p><p>Rem the original command that I found to actually get ProjectX to do something</p><p>Rem start "Demultiplexing %~1" /WAIT /LOW /MIN "C:\scripts\comskip\projectX\ProjectX.jar" -name "%~n1" -out "%~dp1" "%~1" -ini "%TEMP%\X.ini" -demux</p><p></p><p>Rem start "Demultiplexing %~1" /WAIT /LOW /MIN "C:\scripts\comskip\projectX\ProjectX.jar" -out "%TEMP%\rec2mpg" "%~1" -ini "%TEMP%\X.ini" -tots</p><p>Rem so instead I am using mpeg2repair, but since it has no CLI, I have to use mpeg2repairHelper</p><p>ECHO Starting mpeg2repair %date% %time% >> "%~dpn1.PostLog.txt"</p><p>mpeg2repairHelper.exe %1 %1-fixed.ts</p><p>ECHO mpeg2repair finished on %date% %time% >> "%~dpn1.PostLog.txt"</p><p>ECHO.</p><p>ECHO Commercial Detection...</p><p>ECHO Comskip started on %date% %time% >> "%~dpn1.PostLog.txt"</p><p></p><p>comskip %1-fixed.ts >>"%~dpn1.PostLog.txt"</p><p></p><p>ECHO Comskip finished on %date% %time% >> "%~dpn1.PostLog.txt"</p><p>REM ** Check for completion of ComSkip again...</p><p>REM ** If there's no txt file, ComSkip didn't run, don't continue...</p><p>IF EXIST "%1-fixed.edl" GOTO ComClean</p><p>ECHO ComSkip did not run right, PostProcess.bat will end now...</p><p>ECHO Comskip failed on %date% %time%. Ending PostProcessing.bat >> "%~dpn1.PostLog.txt"</p><p>GOTO EOF</p><p></p><p>:ComClean</p><p>ECHO %date% %time% >> "Z:\new_files.log"</p><p>ECHO Commercial removal...</p><p>ECHO ComClean started on %date% %time% >> "%~dpn1.PostLog.txt"</p><p>mencoder "%1-fixed.ts" -edl "%1-fixed.edl" -alang eng,nar -noskip -vf harddup -oac copy -ovc copy -of mpeg -o "%~dpn1_clean.ts"</p><p>REM mencoder "%~dpn1.ts" -edl "%~dpn1.edl" -alang eng -noskip -vf harddup -oac copy -ovc copy -of mpeg -o "%~dpn1_clean.ts"</p><p>ECHO ComClean finished on %date% %time% >> "%~dpn1.PostLog.txt"</p><p></p><p>Rem this is another call to keep the USB drive that the file is moved to going,you can delete this</p><p>ECHO New file %~n1_clean.ts being moved to Server >> "Z:\new_files.log"</p><p>REM ** Check for completion of ComClean...</p><p>REM ** If there's no original MPG file, comclean didn't run, don't continue...</p><p>IF EXIST "%~dpn1_clean.ts" GOTO Move</p><p>ECHO ComClean did not run right, PostProcess.bat will end now...</p><p>ECHO ComClean failed on %date% %time%. Ending PostProcessing.bat >> "%~dpn1.PostLog.txt"</p><p>GOTO EOF</p><p></p><p>:Move</p><p>ECHO Tidying up...</p><p>ECHO Tidying started on %date% %time% >> "%~dpn1.PostLog.txt"</p><p></p><p>Rem this is another call to keep the USB drive that the file is moved to going,you can delete this</p><p>%SystemRoot%\explorer.exe "Z:\"</p><p>REM ** if there isn't an '_clean.ts', comclean didn't run and so tidying should cease</p><p>IF not EXIST "%~dpn1_clean.ts" GOTO EOF</p><p></p><p>ECHO Moving Clean TS to Server directory on %date% %time% >> "%~dpn1.PostLog.txt"</p><p>IF EXIST "%~dpn1_clean.ts" del "%1"</p><p></p><p>REM you should change the location where you want the cleaned file to be moved, but keep this part: %~n1_clean.ts</p><p>move "%~dpn1_clean.ts" "Z:\%~n1_clean.ts"</p><p></p><p>ECHO Clean TS moved to Server directory on %date% %time% >> "%~dpn1.PostLog.txt"</p><p>Rem more logging and USB drive stuff</p><p>ECHO %~n1_clean.ts moved to Server on %date% %time% >> "Z:\new_files.log"</p><p>del "%1-fixed.txt"</p><p>del "%1-fixed.edl"</p><p>del "%1-fixed.ts"</p><p>del "%1-fixed.ts.txt"</p><p></p><p>:EOF</p><p>Rem this kills the vlc.exe, thus allowing the server to shutdown via the powersheduler plugin</p><p>TASKKILL /IM vlc.exe</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="prupert, post: 483698, member: 69540"] First off, I am by no means a script genius, it took me ages to get this far and people with more knowledge than me will no doubt find loads of faults in what I have written. Anyway, since I couldn't find anything on the forums related to this and I had to go to so many places to find all this info, I thought I would share it, hope this is the right place. I have provided all the respective .exes in the accompanying zip file. Hope this is ok, anybody who maintains these exes and dont want them zipped here, please contact me via PM and I will remove them. To use, extract the zip to some where. Enable the comskip plugin in TVServer, in the configuration of the plugin choose the pp1.bat file as the file to run and make sure you choose to run it after the recording ENDS. You'll no doubt have to edit it a bit, but I have tried to indicate what you should edit. More details will be found on my website, [url=http://www.prupert.co.uk]putting the no back in technology | pruperting[/url], I'll add the direct link in a bit and it will include the script I run on my Ubuntu server (where the cleaned file is moved to) to convert the file to something smaller. Here is the bat code: [CODE] @ECHO off Rem pp1.bat Rem v0.1 09.07.09 Rem more details found on www.prupert.co.uk Rem my first attempt at a batch file to be called by the comskip plugin in TVServer Rem Rem it cleans a TS file with mpeg2repair, then it runs comskip on it (the .ini has UK TV settings), then it cuts the TS file with mencoder based on the comskip's edl file, then it transfers it to my network folder and cleans up the crud Rem %1 is the fully qualified name of the recorded mpeg file. Rem I start VLC here since it is one of the processes that I have set the Powerscheduler to prevent system standby, thus it ensures the system does not shutdown whilst the bat file is running START "" "C:\Program Files\VideoLAN\VLC\vlc.exe" Rem this is because where I eventually move the cleaned file to, is on a USB hardrive on another computer, and this helps spin up the drive, you can delte this %SystemRoot%\explorer.exe "Z:\" ECHO ************************** >> "%~dpn1.PostLog.txt" ECHO Post Processing started on %date% %time% >> "%~dpn1.PostLog.txt" ECHO Post Processing started on %date% %time% Rem Sadly, I just couldnt get ProjectX to work properly, I have left this in for intersts sake Rem ECHO ProjectX cleanup started on %date% %time% >> "%~dpn1.PostLog.txt" Rem ECHO ProjectX cleanup started on %date% %time% Rem Echo %TIME% - Demultiplexing %~nx1 Rem echo "# Project-X INI" > "%TEMP%\X.ini" Rem the original command that I found to actually get ProjectX to do something Rem start "Demultiplexing %~1" /WAIT /LOW /MIN "C:\scripts\comskip\projectX\ProjectX.jar" -name "%~n1" -out "%~dp1" "%~1" -ini "%TEMP%\X.ini" -demux Rem start "Demultiplexing %~1" /WAIT /LOW /MIN "C:\scripts\comskip\projectX\ProjectX.jar" -out "%TEMP%\rec2mpg" "%~1" -ini "%TEMP%\X.ini" -tots Rem so instead I am using mpeg2repair, but since it has no CLI, I have to use mpeg2repairHelper ECHO Starting mpeg2repair %date% %time% >> "%~dpn1.PostLog.txt" mpeg2repairHelper.exe %1 %1-fixed.ts ECHO mpeg2repair finished on %date% %time% >> "%~dpn1.PostLog.txt" ECHO. ECHO Commercial Detection... ECHO Comskip started on %date% %time% >> "%~dpn1.PostLog.txt" comskip %1-fixed.ts >>"%~dpn1.PostLog.txt" ECHO Comskip finished on %date% %time% >> "%~dpn1.PostLog.txt" REM ** Check for completion of ComSkip again... REM ** If there's no txt file, ComSkip didn't run, don't continue... IF EXIST "%1-fixed.edl" GOTO ComClean ECHO ComSkip did not run right, PostProcess.bat will end now... ECHO Comskip failed on %date% %time%. Ending PostProcessing.bat >> "%~dpn1.PostLog.txt" GOTO EOF :ComClean ECHO %date% %time% >> "Z:\new_files.log" ECHO Commercial removal... ECHO ComClean started on %date% %time% >> "%~dpn1.PostLog.txt" mencoder "%1-fixed.ts" -edl "%1-fixed.edl" -alang eng,nar -noskip -vf harddup -oac copy -ovc copy -of mpeg -o "%~dpn1_clean.ts" REM mencoder "%~dpn1.ts" -edl "%~dpn1.edl" -alang eng -noskip -vf harddup -oac copy -ovc copy -of mpeg -o "%~dpn1_clean.ts" ECHO ComClean finished on %date% %time% >> "%~dpn1.PostLog.txt" Rem this is another call to keep the USB drive that the file is moved to going,you can delete this ECHO New file %~n1_clean.ts being moved to Server >> "Z:\new_files.log" REM ** Check for completion of ComClean... REM ** If there's no original MPG file, comclean didn't run, don't continue... IF EXIST "%~dpn1_clean.ts" GOTO Move ECHO ComClean did not run right, PostProcess.bat will end now... ECHO ComClean failed on %date% %time%. Ending PostProcessing.bat >> "%~dpn1.PostLog.txt" GOTO EOF :Move ECHO Tidying up... ECHO Tidying started on %date% %time% >> "%~dpn1.PostLog.txt" Rem this is another call to keep the USB drive that the file is moved to going,you can delete this %SystemRoot%\explorer.exe "Z:\" REM ** if there isn't an '_clean.ts', comclean didn't run and so tidying should cease IF not EXIST "%~dpn1_clean.ts" GOTO EOF ECHO Moving Clean TS to Server directory on %date% %time% >> "%~dpn1.PostLog.txt" IF EXIST "%~dpn1_clean.ts" del "%1" REM you should change the location where you want the cleaned file to be moved, but keep this part: %~n1_clean.ts move "%~dpn1_clean.ts" "Z:\%~n1_clean.ts" ECHO Clean TS moved to Server directory on %date% %time% >> "%~dpn1.PostLog.txt" Rem more logging and USB drive stuff ECHO %~n1_clean.ts moved to Server on %date% %time% >> "Z:\new_files.log" del "%1-fixed.txt" del "%1-fixed.edl" del "%1-fixed.ts" del "%1-fixed.ts.txt" :EOF Rem this kills the vlc.exe, thus allowing the server to shutdown via the powersheduler plugin TASKKILL /IM vlc.exe [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Products
TV-Server
My TS fix/clean and advert ( comskip ) removal script
Contact us
RSS
Top
Bottom