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
MediaPortal 1
Support
General Support
Ability to process recordedings or call a script after recording
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="mattmannz" data-source="post: 557688" data-attributes="member: 100457"><p>Here is the final script I ended up using if anyone is interested. It's called via the Comskip plugin in the TV Server using the filename parameter at the end of the recording.</p><p></p><p>I have two cards, an analogue for Sky and a DVB-T for Freeview HD so only the Freeview programs with HE-AAC needed to be converted, the others were recorded with MPG audio.</p><p></p><p>There are probably better and smarter ways of writing this script but this works for me at the moment. Have tested all the various permutations of error situations and it seems to handle them all okay.</p><p></p><p>I used the cli version of Mediainfo to check the file to see if it needed to be converted. I added some logging so that I could see what was going on.</p><p></p><p>Hope someone else can get some use out of this.</p><p></p><p>@echo off</p><p>rem Change to TV drive</p><p>e:</p><p>cd "\recorded tv"</p><p></p><p>rem Start logging</p><p>echo Starting conversion at %date% %time% > conversionlog.txt</p><p>echo You passed me %1 >> conversionlog.txt</p><p></p><p>rem Check supplied file exists</p><p>if not exist %1 goto NOFILE</p><p></p><p>rem Check current audio codec in file</p><p>setlocal</p><p>e:\mediainfo\mediainfo.exe --Inform=Audio;%%Format%% %1>audiocodec.txt</p><p>set /p TOOLOUTPUT= < audiocodec.txt</p><p>del audiocodec.txt</p><p>echo The codec in the file is %TOOLOUTPUT% >> conversionlog.txt</p><p>if "%TOOLOUTPUT%" == "AAC" goto CONVERT</p><p>echo No need to convert %1 >> conversionlog.txt</p><p>goto END</p><p></p><p>:CONVERT</p><p>rem Rename original file and delete temp file if necessary</p><p>if exist tobeconverted.ts del tobeconverted.ts</p><p>rename %1 tobeconverted.ts</p><p>echo renamed %1 to tobeconverted.ts >> conversionlog.txt</p><p></p><p>rem Call VLC to convert renamed file and output as original filename</p><p>"g:\Program Files\VideoLAN\VLC\vlc.exe" -vvv -I dummy tobeconverted.ts --sout=#transcode{acodec=a52,ab=256,channels=2,samplerate=48000}:duplicate{dst=std{access=file,mux=ts,dst=%1} vlc://quit</p><p>echo Just converted %1 >> conversionlog.txt</p><p></p><p>rem Check for file and check file length of converted file and if zero back out</p><p>if not exist %1 goto DELANDRENAME</p><p>if exist %1 for %%i in (%1) do if %%~zi==0 goto DELANDRENAME</p><p></p><p>rem All okay so delete renamed file</p><p>del tobeconverted.ts</p><p>echo Converted %1 okay >> conversionlog.txt</p><p>goto END</p><p></p><p>:NOFILE</p><p>rem No file exists</p><p>echo Error file %1 doesn't exist >> conversionlog.txt</p><p>goto END</p><p></p><p><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" />ELANDRENAME</p><p>rem Delete zerobyte file and backout</p><p>echo Problem so rolling back >> conversionlog.txt</p><p>if exist %1 del %1</p><p>rem Rename file to original</p><p>rename tobeconverted.ts %1</p><p>goto END</p><p></p><p>:END</p><p>rem Nothing left to do</p><p>echo The end at %date% %time% >> conversionlog.txt</p></blockquote><p></p>
[QUOTE="mattmannz, post: 557688, member: 100457"] Here is the final script I ended up using if anyone is interested. It's called via the Comskip plugin in the TV Server using the filename parameter at the end of the recording. I have two cards, an analogue for Sky and a DVB-T for Freeview HD so only the Freeview programs with HE-AAC needed to be converted, the others were recorded with MPG audio. There are probably better and smarter ways of writing this script but this works for me at the moment. Have tested all the various permutations of error situations and it seems to handle them all okay. I used the cli version of Mediainfo to check the file to see if it needed to be converted. I added some logging so that I could see what was going on. Hope someone else can get some use out of this. @echo off rem Change to TV drive e: cd "\recorded tv" rem Start logging echo Starting conversion at %date% %time% > conversionlog.txt echo You passed me %1 >> conversionlog.txt rem Check supplied file exists if not exist %1 goto NOFILE rem Check current audio codec in file setlocal e:\mediainfo\mediainfo.exe --Inform=Audio;%%Format%% %1>audiocodec.txt set /p TOOLOUTPUT= < audiocodec.txt del audiocodec.txt echo The codec in the file is %TOOLOUTPUT% >> conversionlog.txt if "%TOOLOUTPUT%" == "AAC" goto CONVERT echo No need to convert %1 >> conversionlog.txt goto END :CONVERT rem Rename original file and delete temp file if necessary if exist tobeconverted.ts del tobeconverted.ts rename %1 tobeconverted.ts echo renamed %1 to tobeconverted.ts >> conversionlog.txt rem Call VLC to convert renamed file and output as original filename "g:\Program Files\VideoLAN\VLC\vlc.exe" -vvv -I dummy tobeconverted.ts --sout=#transcode{acodec=a52,ab=256,channels=2,samplerate=48000}:duplicate{dst=std{access=file,mux=ts,dst=%1} vlc://quit echo Just converted %1 >> conversionlog.txt rem Check for file and check file length of converted file and if zero back out if not exist %1 goto DELANDRENAME if exist %1 for %%i in (%1) do if %%~zi==0 goto DELANDRENAME rem All okay so delete renamed file del tobeconverted.ts echo Converted %1 okay >> conversionlog.txt goto END :NOFILE rem No file exists echo Error file %1 doesn't exist >> conversionlog.txt goto END :DELANDRENAME rem Delete zerobyte file and backout echo Problem so rolling back >> conversionlog.txt if exist %1 del %1 rem Rename file to original rename tobeconverted.ts %1 goto END :END rem Nothing left to do echo The end at %date% %time% >> conversionlog.txt [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Support
General Support
Ability to process recordedings or call a script after recording
Contact us
RSS
Top
Bottom