Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Posts: 468
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
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

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

set DELTA=1&set ENDVAL=%NOF%

set REP=1&if "%9"=="norepeat" set REP=0
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
del /Q cachefiles.dat>nul 2>nul
if not "%~9" == "" set DUMMY=1&%~9

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

for /L %%1 in (1,1,300) do if not defined STOP (
  cmdwiz gettime & set CURRT=!errorlevel!
  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

cmdwiz showcursor 1
taskkill /IM cmdwiz.exe>nul 2>nul

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.

Posts: 468
Joined: 02 May 2016 18:20

Re: mov2txt

#17 Post by misol101 » 08 Dec 2019 20:12

Well now, since I started looking at oldies...

3 archive updates :)

I hadn't looked at these converted movies for years. When I ran State Of The Art on my Win10 machine it was both slow, used the wrong font, cached files for a really long time, and was not synched with the music at all :cry:

So I attempted to fix all these things for the 3 archives, basically updating it to use cmdgfx with server.

Try State of the Art first if you want to watch any of these; it's the one that benefits most from being correctly synched with music. ... fTheArt.7z (run sota.bat) ... ickWeed.7z (run Lickweed.bat) ... BitchUp.7z (run smbu.bat)

Post Reply