ffmpeg-python icon indicating copy to clipboard operation
ffmpeg-python copied to clipboard

How to get frames & their timestamps - frame-pts option?

Open freeIsa opened this issue 2 years ago • 4 comments

Hi everyone, I am experimenting with different ways to sample a fixed number of frames from a video. At the same time, I would also need to get the timestamps of the extracted frames so as to save them in a dataframe.

What's the best way to achieve this? Right now, the only way I found is to use the showinfo filter and parse the output string (as shown here).

According to ffmpeg docs a frame_pts option should also be available that would use timestamps in the saved frame filenames (which would not be ideal either, as I would still have to parse filenames to get them, but it's an alternative), but I don't seem to get it to work in ffmpeg-python. Can someone suggest the right syntax per this option?

In general, if you can suggest how to get selected frames and their timestamps in one pass that'd be really appreciated 🙏

freeIsa avatar Apr 04 '23 08:04 freeIsa

Have you solved this problem yet? I'm interesting of the answer too!

Avencheng avatar Feb 05 '24 10:02 Avencheng

Hi, I'm interesting of the answer to. Do you have any progress? Thanks

aimaicai avatar Feb 22 '24 11:02 aimaicai

Right now, the only way I found is to use the showinfo filter and parse the output string (as shown here).

I could not find any other way than this one.

freeIsa avatar Feb 22 '24 13:02 freeIsa