Well if you just run:
ffmpeg -i file.mp4
The output will contain the length of the video on stderr. If you run your program and pipe its output to a file you can read it or if you'd prefer you can read the output of stderr and just write some code in whatever language you're using to find the position in that output. It's pretty because I believe it's actually in the string as "Duration: 00:15:00" or whatever.
If you run:
ffmpeg -ss 00:03:00 -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
ffmpeg -ss 00:06:00 -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
ffmpeg -ss 00:09:00 -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
ffmpeg -ss 00:12:00 -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
ffmpeg -ss 00:15:00 -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
Then you'll have frames as jpegs every 3 minutes. Hope this helps.