char0n/ffmpeg-php — pull request #8 by robwalch (2011-12-15 22:58:36+00:00)
Title: fps and getFrameByTime enhancements

Great project! I'm using it to generate stills and thumbnails from video. I ran into a couple of issues and these changes solved them.

First, getFPS was returning 300 for the videos I am using. Video with multiple slices will not have a tbr that matching the fps. Fortunately the ffmpeg info included 'fps' so I made REGEX_FRAME_RATE match that if present first otherwise fallback to tbr.

Next, I use seconds as the base for all my video work not frame numbers - as does ffmpeg. For this reason I made getFrameByTime the primary method for grabbing an image. getFrame is still there with the same interface. The only cavait is that in the latest ffmpeg, -s expects width x height, not height x width. I made correction only in getFrameByTime. getFrame should continue to work exactly as it did before.