YoshieMaster
YoshieMaster

Reputation: 257

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 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

Upvotes: 0

Views: 890

Answers (1)

Fredrik Pihl
Fredrik Pihl

Reputation: 45642

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.

Upvotes: 0

Related Questions