You would actually have to calculate what that number comes out to based on the contents of
times.txt. It would be easier to write a little program that does the calculation for you. If you make a batch file with this code, it should work for Windows:
@echo off
setlocal
setlocal EnableExtensions
setlocal EnableDelayedExpansion
set currdir=%cd%\
for /f %%a in ('find /v /c "" ^<%currdir%%1') do set /a lines=%%a - 1
for /f "skip=%lines%" %%b in (%currdir%%1) do set lasttc=%%b
for /f "tokens=1 delims=." %%c in ("%lasttc%") do set /a lasttc=%%c + 1
set /a keyint=10000 * %lines% / %lasttc%
echo %keyint%
endlocal
To use the batch file, put it into the same directory as
times.txt, and run it with
times.txt as the only argument:
batchname.bat times.txt
There are some limitations to what this code can do. They arise from the fact that cmd.exe only works with 32-bit signed integers for calculations.
First, this means that the times.txt file can have a maximum of 2,147,483,647 lines, which wouldn't be a problem if not for the multiplication by 10,000 later. That multiplication effectively limits the file to 214,748 lines. At 60 fps, this allows a total
encode time of at least 59:39.13, with the time increasing as the number of duplicated frames increases. Most of the movies on our site aren't that long, but this is a rough time limit to keep in mind if the code doesn't work.
Second, this means that the maximum value of the last timecode is 2,147,483,647. Since the timecodes are in milliseconds, you are limited to a total
encode time of just over 596.5 hours. I think that should cover anything on the site except
Desert Bus. Sorry, Desert Bus.
Third, this means that the denominator does not correspond to the exact last timecode. The third for loop in the code takes the integral part of the last timecode and adds 1. I added that 1 ms to the denominator in order to guarantee that the keyint value calculated by the code will always be less than the exact value. Since we're dealing with the total
encode time, and the logo itself should be around 2 seconds long, this is an error of less than 0.05%, and it gets smaller as the movie gets longer.