Hi, only for ****
please my cats have a question
in a batch there is a envoroment variable called %timecode% that, if timecode exist and is defined, output a string of this type:
HH:MM:SS:FF
for example 01:32:21:05
In PAL mode, 25fps, I would like convert this timecode in his correspondant frame number, for rxample in the case of 01:32:21:05 is 138530
so the convert processing should output 138530
Another examples: 00:00:00:00 ----------------> 0
00:00:00:01 ----------------> 1
........
00:00:00:24 ----------------> 24
00:00:01:00 ----------------> 25
00:00:01:01 ----------------> 26
and so on
How can I do?
thanks
		
			+ Reply to Thread
			
		
		
		
			
	
	
				Results 1 to 6 of 6
			
		- 
	
- 
	that was actually one of those first inputs to this whole saga of mega batch script, how to parse timecode and put it into variables, it is somewhere here already, ...., then it is a simple math 
 Code:set timecode=01:32:21:05 for /f "tokens=1,2,3,4 delims=:" %%a in ("%timecode%") do (set hours=%%a& set mins=%%b& set secs=%%c& set frames=%%d) set /a total_frames=(%hours% * 60 * 60 * 25) + ( %mins% * 60 * 25 ) + (%secs% * 25) + %frames% echo %total_frames%
- 
	t:h:a:n:k,s it' works!  
 
 only one question:
 
 in the batch I also have a ffprobe value output that says the r_frame_rate
 
 r_frame_rate that becomes frame_rate
 
 and assume this format,
 
 for example 25/1
 50/1
 30/1
 
 and so on
 
 so for example %frame_rate% becomes 50/1
 
 From this format, can I get simply: 25 or 50 or 30 (and not 25/1 50/1 30/1) ?
 
 thanks!!
- 
	parse %frame_rate% to get out that first value 
 you split your variable with "/" into two, then you need only first number, so:
 "tokens=1 delims=/"
 try to figure out how those commands work, otherwise you would ask all the time
- 
	but I think you can use that 25/1 value in that line where total_frames are calculated, for example: 
 (%hours% * 60 * 60 * %frame_rate%) .... etc,... try it


 
		
		 View Profile
				View Profile
			 View Forum Posts
				View Forum Posts
			 Private Message
				Private Message
			 
 
			
			

 Quote
 Quote