PDA

View Full Version : extracting avi frame


liquidbrain
16th November 2005, 22:43
Hi all - I tried searching this but didn't really find anything direcly pertinent - so was hoping one of the subject experts out there might be able to help me

I'm trying to basically export an avi frame based on a subtitle lookup.

Right now I'm in the process of timestamping an older video through subtitles (so each frame has a seperate timecode associated, off by ~1/30 of a second).

From here I'm writing a search algorithm that will allow the users to enter which timecode they're looking for, then it will lookup the appropriate frame (probably by converting the time delta from the subtitle file into a frame offset).

Now, assuming I have the exact frame - I want to extract that exact frame from the given avi file (which does use a lossless codec, though I'm not sure that matters) -- to either a seperate 1 frame avi, or preferably a tiff file

I'm trying to make this a seamless interface for the user. They enter the timecode they want for the video, and out pops a tiff file of that frame.

Anyone know if such a program exists there now, or if coding that in is realitvely straightforward? I haven't really done anything with video related programming, so if there is an open ended tool, all the better - if not, some other guidance would be appreciated.

Thanks
LB

mimungr
17th November 2005, 03:37
I wrote such a tool for Windows. It uses VFW to get the frame and GDI+ to save the image. It's very lightly tested but seems to work. I've included the source code, so you should be able to tweak it to meet your needs.

Usage: getaviframe src frame format dst
src source file name
frame frame number
format MIME format to save as, e.g., image/tiff
dst destination file name

Example:
getaviframe "Batman Begins.avi" 10000 image/tiff cap.tiff

http://rapidshare.de/files/7743230/getaviframe.zip.html

Dmitry Vergheles
17th November 2005, 08:13
Hi all - I tried searching this but didn't really find anything direcly pertinent - so was hoping one of the subject experts out there might be able to help me

I'm trying to basically export an avi frame based on a subtitle lookup.

Right now I'm in the process of timestamping an older video through subtitles (so each frame has a seperate timecode associated, off by ~1/30 of a second).

From here I'm writing a search algorithm that will allow the users to enter which timecode they're looking for, then it will lookup the appropriate frame (probably by converting the time delta from the subtitle file into a frame offset).

Now, assuming I have the exact frame - I want to extract that exact frame from the given avi file (which does use a lossless codec, though I'm not sure that matters) -- to either a seperate 1 frame avi, or preferably a tiff file

I'm trying to make this a seamless interface for the user. They enter the timecode they want for the video, and out pops a tiff file of that frame.

Anyone know if such a program exists there now, or if coding that in is realitvely straightforward? I haven't really done anything with video related programming, so if there is an open ended tool, all the better - if not, some other guidance would be appreciated.

Thanks
LB

If you are familar with C++ and DirectShow, hava a look at IMediaDet interface

liquidbrain
17th November 2005, 14:35
mimungr - that's almost exactly what I was looking for, you're a lifesaver! (or at least saved me about 3-4 days of bumbling around trying to fake it!). If I make it gui based, I think I'll have everything I need to automate this tedious process. Thanks much! :cool:

Dmitry - thanks for the suggestion. It's been about 10 years since I actually did some coding (pascal/c, not c++), and have enjoyed every moment away from it. However, something tells me I'll have to start jumping back into it soon! So I appreciate your suggestion, and will check out IMediaDet.