imsparsh / pyffmpeg

Automatically exported from code.google.com/p/pyffmpeg
0 stars 0 forks source link

seek_to_frame not working on long .mp4 files #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is a chunk of code that's a good example of the kinds of problems I'm 
having. "SD010008.mp4" is over an hour long and hads 60 frames per second.

IDLE 2.6.5      ==== No Subprocess ====
>>> import pyffmpeg
>>> mp = pyffmpeg.FFMpegReader()
>>> mp.open("SD010008.mp4",pyffmpeg.TS_VIDEO)
result PTS:33367
start time checked : pts = 33367 , declared was : 4505
result PTS:33367
>>> vt=mp.get_tracks()[0]
>>> image = vt.get_next_frame()
>>> image = vt.get_next_frame()
>>> image = vt.get_next_frame()
>>> image = vt.get_next_frame()
>>> image = vt.get_next_frame()
>>> image = vt.get_next_frame()
>>> image = vt.get_next_frame()
>>> image = vt.get_next_frame()
>>> image = vt.get_next_frame()
>>> image = vt.get_next_frame()
>>> vt.get_current_frame_frameno()
14
>>> vt.seek_to_frame(0)
result PTS:33367
>>> vt.get_current_frame_frameno()
16
>>> vt.seek_to_frame(0)
result PTS:33367
>>> vt.get_current_frame_frameno()
18
>>> vt.seek_to_frame(1)
result PTS:116789
>>> vt.get_current_frame_frameno()
21
>>> vt.seek_to_frame(1*60*60*60)
result PTS:3603650056
>>> vt.get_current_frame_frameno()
84
>>> 

I am running Windows 7, Python 2.6.5, pyffmpeg-2.1beta.win32.zip 

I was really hoping for a way to get back to the beginning of the file, and a 
way to jump forward five or 10 frames that's better than calling 
get_next_frame() repeatedly. When I noticed that seek_to_frame was not really 
working at all.

Original issue reported on code.google.com by YeomanYa...@gmail.com on 15 Apr 2011 at 2:36