Page 1 of 1

Set Length of Time Recording in Windows 7 (Kworld DVD Maker

Posted: 22 Sep 2012 01:21
by puck64
Hi All,

I thought that this piece of code may be of use :)
If anyone has a better way to do it please let me know, as this is my first try and it worked :D

It uses a "Kworld DVD Maker 2 (USB Device)".

It will record "dshow" for a desired period of time (in minutes) and reboot.
The code as is will not display the Video or Play Audio so it is ideal for setting off a recording and going to bed :)
The 2nd piece of code will display Video and Audio via the GUI.

To just shutdown the machine change "shutdown /r /t %sec%" to "shutdown /t %sec%"

Each recording is given a unique file name by using DATE and TIME EG....
"VLC_ 2012-09-22 80049.49.ts" by "g:\vlc\VLC_%date:~10,4%-%date:~7,2%-%date:~4,2% %TIME::=%.ts"
It assumes DATE is in the following format "Sat 22/09/2012" you may have to alter the above substringing to get
the ISO date format. The ISO date format is Ideal for sorting :)

I have yet to work on the TIME portion to cater for single digit HOURS :oops:

The Code.....

Code: Select all

@ECHO OFF set vlc="C:\Program Files\VideoLAN\VLC\vlc.exe" SET /P min=Please enter the time to record: IF "%min%"=="" GOTO Error SET /A sec = 60 * %min% ECHO Shutdown will happen in %min% Minutes shutdown /r /t %sec% %VLC% dshow:// :dshow-vdev="USB 2861 Device" :dshow-adev="Line (2- USB 2861 Device)" :dshow-aspect-ratio=16\:9 :sout=#transcode{vcodec=mp2v,vb=9000,scale=1,fps=25,width=720,height=576,acodec=mpga,ab=320,channels=2,samplerate=48000}:duplicate{dst=file{dst="g:\vlc\VLC_%date:~10,4%-%date:~7,2%-%date:~4,2% %TIME::=%.ts"}} :sout-all :sout-keep --qt-start-minimized EXIT :Error ECHO You did not enter a time in minutes! Bye bye!! PAUSE :End
To enable Video and Audio use this Code....

Code: Select all

@ECHO OFF set vlc="C:\Program Files\VideoLAN\VLC\vlc.exe" SET /P min=Please enter the time to record: IF "%min%"=="" GOTO Error SET /A sec = 60 * %min% ECHO Shutdown will happen in %min% Minutes shutdown /r /t %sec% %vlc% dshow:// :dshow-vdev="USB 2861 Device" :dshow-adev="Line (2- USB 2861 Device)" :dshow-aspect-ratio=16\:9 :sout=#transcode{vcodec=mp2v,vb=9000,scale=1,fps=25,width=720,height=576,acodec=mpga,ab=320,channels=2,samplerate=48000}:duplicate{dst=file{dst="g:\vlc\VLC_%date:~10,4%-%date:~7,2%-%date:~4,2% %TIME::=%.ts"},dst=display} :sout-all :sout-keep EXIT :Error ECHO You did not enter a time in minutes! Bye bye!! PAUSE :End EXIT
Regards,
Mark
(God help me be the person my dog thinks I am)

Re: Set Length of Time Recording in Windows 7 (Kworld DVD Ma

Posted: 27 Sep 2012 23:47
by puck64
The Final Version Of The Bat File With friendly date and time in the file name :D

Code: Select all

@ECHO OFF set vlc="C:\Program Files\VideoLAN\VLC\vlc.exe" set "dte=%DATE% set "tme=%TIME%" REM ========================================================= REM Get the time to record REM ========================================================= SET /P min=Please enter the time to record: IF "%min%"=="" GOTO Error REM ======================================================== REM Convert Minutes to Seconds for SHUTDOWN REM ======================================================== SET /A sec = 60 * %min% ECHO Shutdown will happen in %min% Minutes shutdown /r /t %sec% REM ========================================================= REM Build the file name to store the recording in REM ========================================================= set "datestamp=%dte:~10,4%-%dte:~7,2%-%dte:~4,2%" if "%tme:~0,1%"==" " ( set "timestamp=0%tme:~1,1%_%tme:~3,2%_%tme:~6,2%_%tme:~9,2%" ) ELSE ( set "timestamp=%tme:~0,2%_%tme:~3,2%_%tme:~6,2%_%tme:~9,2%" ) set "file_name=VLC_Capture %datestamp%_%timestamp%" REM ========================================================= REM Record the input to a file REM ========================================================= %VLC% dshow:// :dshow-vdev="USB 2861 Device" :dshow-adev="Line (2- USB 2861 Device)" :dshow-aspect-ratio=16\:9 :sout=#transcode {vcodec=mp2v,vb=9000,scale=1,fps=25,width=720,height=576,acodec=mpga,ab=320,channels=2,samplerate=48000}:duplicate {dst=file{dst="g:\vlc\%file_name%.ts"}} :sout-all :sout-keep --qt-start-minimized EXIT :Error ECHO You did not enter a time in minutes! Bye bye!! PAUSE :End EXIT REM ================= Record With Display ======================== %vlc% dshow:// :dshow-vdev="USB 2861 Device" :dshow-adev="Line (2- USB 2861 Device)" :dshow-aspect-ratio=16\:9 :sout=#transcode {vcodec=mp2v,vb=9000,scale=1,fps=25,width=720,height=576,acodec=mpga,ab=320,channels=2,samplerate=48000}:duplicate {dst=file{dst="g:\vlc\%file_name%.ts"},dst=display} :sout-all :sout-keep

Re: Set Length of Time Recording in Windows 7 (Kworld DVD Ma

Posted: 06 Oct 2012 13:48
by puck64
Hi All,

I have refined the BAT File a bit....

Options to shutdown and reboot, Watch and record or just record..

To stop your machine going to sleep comment the line "Rundll32.exe Powrprof.dll,SetSuspendState Sleep
" at the bottom of the code.

All I need to do now is devise a routine that validates the number of minutes entered as "numeric"

Code: Select all

@ECHO OFF set vlc="C:\Program Files\VideoLAN\VLC\vlc.exe" REM ========================================================= REM Build the file name to store the recording in REM ========================================================= set "dte=%DATE% set "tme=%TIME%" set "datestamp=%dte:~10,4%-%dte:~7,2%-%dte:~4,2%" if "%tme:~0,1%"==" " ( set "timestamp=0%tme:~1,1%_%tme:~3,2%_%tme:~6,2%_%tme:~9,2%" ) ELSE ( set "timestamp=%tme:~0,2%_%tme:~3,2%_%tme:~6,2%_%tme:~9,2%" ) set "file_name=VLC_CR_Capture_%datestamp%_%timestamp%" REM ========================================================= REM Get the time to record REM ========================================================= SET /P min=Please enter the time to record in Minutes: IF "%min%"=="" GOTO Error REM ======================================================== REM Convert Minutes to Seconds for RECORD TIME and SHUTDOWN REM ======================================================== SET /A sec = 60 * %min% SET /A ssec = 60 + %sec% REM ======================================================== REM Watch while recording? REM ======================================================== :WATCHIT CLS SET /P watch=Do you want to watch while you record (y or n): IF "%watch%"=="y" GOTO SHUT IF "%watch%"=="n" GOTO SHUT GOTO WATCHIT REM ======================================================== REM SHUTDOWN or NOT to SHUTDOWN that is the question :-) REM ======================================================== :SHUT CLS SET /P shtdwn=Do you want to SHUTDOWN (y or n) : IF "%shtdwn%"=="y" GOTO DOIT IF "%shtdwn%"=="n" GOTO DOIT GOTO SHUT :DOIT IF "%shtdwn%"=="y" ( ECHO You have %min% Minutes to cancel SHUTDOWN with "shutdown /a" rem shutdown /r /t %ssec% /d P:0:0 /c "End of VLC Recording to ABORT shutdown /a" ) REM ======================================================== REM Record .... Finally :-) REM ======================================================== IF "%watch%"=="y" ( %VLC% --run-time=%sec% dshow:// :dshow-vdev="USB 2861 Device" :dshow-adev="Line (2- USB 2861 Device)" :dshow-aspect-ratio=16\:9 :sout=#transcode{vcodec=mp2v,vb=9000,scale=1,fps=25,width=720,height=576,acodec=mpga,ab=320,channels=2,samplerate=48000}:duplicate{dst=file{dst="g:\vlc\%file_name%.ts"},dst=display} :sout-all :sout-keep --no-overlay --deinterlace={-1} --deinterlace-mode={yadif2x} vlc://quit ) ELSE ( %VLC% --run-time=%sec% dshow:// :dshow-vdev="USB 2861 Device" :dshow-adev="Line (2- USB 2861 Device)" :dshow-aspect-ratio=16\:9 :sout=#transcode{vcodec=mp2v,vb=9000,scale=1,fps=25,width=720,height=576,acodec=mpga,ab=320,channels=2,samplerate=48000}:duplicate{dst=file{dst="g:\vlc\%file_name%.ts"}} :sout-all :sout-keep --qt-start-minimized --no-overlay --deinterlace={-1} --deinterlace-mode={yadif2x} vlc://quit ) Rundll32.exe Powrprof.dll,SetSuspendState Sleep EXIT :Error ECHO You did not enter a time in minutes! Bye bye!! PAUSE :End EXIT REM --deinterlace-mode={discard,blend,mean,bob,linear,x,yadif,yadif2x,phosphor,ivtc}

Re: Set Length of Time Recording in Windows 7 (Kworld DVD Ma

Posted: 09 Dec 2013 21:42
by techlady
Great solution for Windows 7, but I have a problem with Windows 8. The Kworld USB2800D worked fine with Windows 7, BUT I get a black screen trying to get it to play or record with VideoLAN software.
Any suggestions?
Thanks.