标签:delay 批处理 extract exp dexp inf style bsp 方法
使用方法:extract file time step folder
time 设置时间长度
step 设置周期
均以秒(s)为单位
贡献:1. 从视频文件中周期性提取图片;2. Windows下批处理程序的一些技术。
依赖:mplayer
todo: 目前周期最小为1s,可以扩展使频率大于1Hz.
更详细的内容可以参考:
http://blog.csdn.net/xuyaqun/article/details/6077917
http://blog.csdn.net/aa846555831/article/details/53400974
http://blog.csdn.net/yjfkpyu/article/details/3694990
1 @echo off 2 3 :: extract frames 4 rem echo filename: %1 5 rem echo time: %2 s 6 rem echo step: %3 s 7 rem echo folder: %4 8 9 if "%4" equ "" ( 10 echo Usage: extract file time step folder 11 echo file: mplayer can play 12 echo time unit: s 13 echo step unit: s 14 echo folder: snap saved folder 15 goto :end 16 ) 17 18 if not exist %4 mkdir %4 19 20 set /A length = %2 / %3 21 echo length: %length% 22 23 setlocal enabledelayedexpansion 24 25 set n=0 26 for /L %%i in (0, %3, %2) do ( 27 :: progress info 28 set /A n += 1 29 set /A n = !n! %% 10 30 if !n! equ 0 ( 31 set /A nth = %%i * 100 / %2 32 echo !nth! %% 33 ) 34 35 :: key command 36 mplayer -ss %%i -noframedrop -nosound -vo png -frames 1 %1 > nul 37 38 :: save files because mplayer extracts frame in same name 39 set /A name = %%i / %3 40 move 00000001.png %4\!name!.png > nul 41 ) 42 43 :end
标签:delay 批处理 extract exp dexp inf style bsp 方法
原文地址:http://www.cnblogs.com/kangtian0/p/6847650.html