Created
August 14, 2017 16:50
-
-
Save lancehilliard/4778d043d9ed02cd45f2e9418087adf6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set FFMPEG_EXE="C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility\vendor\ffmpeg\bin\ffmpeg.exe" | |
set OUTPUT_INTERVAL_IN_SECONDS=60 | |
set OUTPUT_DIR_WITHOUT_TRAILING_SLASH=%userprofile%\documents\instantreplay | |
set OUTPUT_FILES_TO_KEEP=120 | |
:loop | |
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set timestamp=%%I | |
set datetimestart=%timestamp:~0,8%-%timestamp:~8,4%_%timestamp:~12,2% | |
%FFMPEG_EXE% -loglevel info -t %OUTPUT_INTERVAL_IN_SECONDS% -f dshow -video_device_number 0 -i video="screen-capture-recorder" -vcodec libx264 -pix_fmt yuv420p -s hd720 -preset ultrafast -vsync vfr -acodec libmp3lame -f mpegts - | %FFMPEG_EXE% -f mpegts -i - -c copy "%OUTPUT_DIR_WITHOUT_TRAILING_SLASH%\%datetimestart%.mkv" | |
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set timestamp=%%I | |
set datetimeend=%timestamp:~0,8%-%timestamp:~8,4%_%timestamp:~12,2% | |
move /Y "%OUTPUT_DIR_WITHOUT_TRAILING_SLASH%\%datetimestart%.mkv" "%OUTPUT_DIR_WITHOUT_TRAILING_SLASH%\%datetimestart% to %datetimeend%.mkv" | |
for /f "skip=%OUTPUT_FILES_TO_KEEP% eol=: delims=" %%F in ('dir /b /o-d /a-d %OUTPUT_DIR_WITHOUT_TRAILING_SLASH%\*.mkv') do @del "%OUTPUT_DIR_WITHOUT_TRAILING_SLASH%\%%F" | |
goto loop | |
:dev notes | |
https://superuser.com/questions/108034/rolling-desktop-recorder | |
http://www.linuxquestions.org/questions/linux-newbie-8/how-to-use-ffmpeg-x11-grab-inside-windows-917907/ | |
http://www.ignas.in/blog/130625_realiable_way_to_get_date_in_batch_scripting | |
mkv is used so that video can be watched while it's being recorded | |
https://www.howtogeek.com/tips/how-to-run-a-scheduled-task-without-a-command-window-appearing/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment