mov2txt

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
misol101
Posts: 384
Joined: 02 May 2016 18:20

Re: mov2txt

#16 Post by misol101 » 01 Oct 2016 13:18

I suddenly realized it's pretty easy to do basic synching between images and sound. I can't be bothered to update the archives, but if you experienced bad synching, try this:

1. save as playm2t_synch.bat:

Code: Select all

@echo off
setlocal ENABLEDELAYEDEXPANSION
if "%~2" == "" echo Usage: playm2t m2tfolder length_in_seconds [x] [y] [color] [bcol] [startskip_nof] [endskip_nof] [repeat^|norepeat] [cache "cacheFinishedCommand"]&goto :eof
cmdwiz showcursor 0

set SLENGTH=%2
set XP=0&if not "%3"=="" set XP=%3
set YP=0&if not "%4"=="" set YP=%4
set COL=u&if not "%5"=="" set COL=%5
set BCOL=U&if not "%6"=="" set BCOL=%6
set SSKIP=0&if not "%7"=="" set SSKIP=%7
set ESKIP=0&if not "%8"=="" set ESKIP=%8
set FNAME=%~1

if not exist "%~1" echo Error: folder not found.&goto :OUTOF
set MAX=10000&set MIN=1
for %%a in (25,50,100,190,375,750,1500,3000,6000,12000,24000,48000,96000) do if exist %FNAME%\%%a.gxy set /A MIN=%%a&set /A MAX=%%a*2
for /L %%a in (%MIN%,1,%MAX%) do if not exist %FNAME%\%%a.gxy set /A CNT=%%a-1&goto EXITCOUNT
:EXITCOUNT

set /A NOF=%CNT%-%ESKIP%
set /A SSKIP+=1
if %NOF% lss %SSKIP% echo Error: all frames skipped.&goto :OUTOF
set CNT=%SSKIP%
set /A SSKIPM=%SSKIP%-1
cls

set DELTA=1&set ENDVAL=%NOF%

set REP=1&if "%9"=="norepeat" set REP=0
shift
if not "%9"=="cache" goto LOOP
cmdwiz getconsoledim sw&set /a CXP=!ERRORLEVEL!/2 - 9
cmdwiz getconsoledim sh&set /a CYP=!ERRORLEVEL!/2 - 2
gotoxy %CXP% %CYP% "[ Caching Files ]" 2
for /L %%a in (%CNT%,1,%NOF%) do echo %FNAME%\%%a.gxy>>cachefiles.dat
cmdwiz cache cachefiles.dat
shift
del /Q cachefiles.dat>nul 2>nul
if not "%~9" == "" set DUMMY=1&%~9

set /a NOF_FRAMES=%NOF%-%CNT%
set /a SLENGTH_MS = %SLENGTH% * 1000
cmdwiz gettime & set STARTT=!errorlevel!
set STOP=

:LOOP
for /L %%1 in (1,1,300) do if not defined STOP (
  cmdwiz gettime & set CURRT=!errorlevel!
  set /a ELAPSED=!CURRT!-!STARTT!
  if !ELAPSED! gtr %SLENGTH_MS% cmdwiz gettime & set STARTT=!errorlevel!& set ELAPSED=0& if "%REP%" == "0" set STOP=1
  set /a "RELTIME=(!ELAPSED!*100)/%SLENGTH%"
  set /a "FRAME=(!RELTIME!*%NOF_FRAMES%)/(1000*100) + %SSKIP%"
  gotoxy %XP% %YP% "\I:%FNAME%\!FRAME!.gxy;" %COL% %BCOL% k
  set KEY=!errorlevel!
  if !KEY! == 27 set STOP=1
  if !KEY! == 112 cmdwiz getch
  if !KEY! == 67 set /A COL+=1&if !COL! gtr 15 set COL=1
  if !KEY! == 99 set /A COL-=1&if !COL! lss 1 set COL=15
)
if not defined STOP goto LOOP

:OUTOF
cmdwiz showcursor 1
taskkill /IM cmdwiz.exe>nul 2>nul
endlocal


For LickWeed, in the file Lickweed.bat, comment out the line "call playm2t ..." and replace with: call playm2t_synch lw 192 0 0 0 0 0 0 repeat cache "start /MIN cmdwiz playsound Stream.adpcm"

For StateOfTheArt, in SOTA.bat, comment out as above and replace with: call playm2t_synch.bat sota 209 0 0 0 0 530 5 repeat cache "start /MIN dlc -p Sota-cut2.mp3 Sota-cut2.mp3 Sota-cut2.mp3"

For the Prodigy video in SMBU.bat, comment out as above and replace with: call playm2t_synch.bat smbu 273 0 0 0 0 0 0 repeat cache "start /MIN dlc -p smbu.mp3 smbu.mp3 smbu.mp3"


The second argument specifies how long the "video" should run in seconds, which should correspond to how long the music is.

Post Reply