Find Framenumber at Time in Video
I'm making a small program to allow me to easily split videos given relevant timecodes (IE. mins:secs) and I am using Virtual Dub to do all the video handling. VDub can do 开发者_JS百科what I want, but it takes a framenumber instead of a timecode, so what I am asking is if anyone know how to perform a conversion for this. (Video might not neccessarily have a fixed framerate and I'm not sure how I would find the framerate anyway) The video will be an AVI file. I would prefer any code to be in C#, but I can probably translate it anyway.
THANKYOU Very Much!
YoshieMaster
This is how you can extract a frame in a certain timestamp using ffmpeg.
ffmpeg -i n.wmv -ss 00:00:20 -t 00:00:1 -s 320×240 -r 1 -f singlejpeg myframe.jpg
-i input file name
-ss set the start time offset
-t set the recording time
-s set frame size (WxH or abbreviation)
-r set frame rate (Hz value, fraction or abbreviation)
-f force format
To get the framerate, you can also use ffmpeg
and if it's fixed there shouldn't be any problem calculating which frame is being displayed at a certain timestamp.
精彩评论