[MPlayer-dev-eng] mencoder variable FPS

Keith Chew keith.chew at gmail.com
Sat Jan 6 03:16:04 CET 2007


Hi

For my security project, I am extending mencoder to receive an input
from another application to control the force_fps variable. This
allows me to control the framerate of the video being captured (ie
from the video camera).

All is working well, but to get mencoder to produce the output frames
correctly, I needed to add these lines in the loop when each video
frame is captured:

    // get video frame!
  if (!frame_data.already_read) {
    if(force_fps){  <---- CODE ADDED
      sh_video->fps=force_fps;  <---- CODE ADDED
      sh_video->frametime=1.0f/sh_video->fps;  <---- CODE ADDED
    }  <---- CODE ADDED
    frame_data.in_size=video_read_frame(sh_video,&frame_data.frame_time,&frame_data.start,force_fps);
    sh_video->timer+=frame_data.frame_time;
  }

When the sh_video->fps and sh_video->frametime are updated, the output
video comes out correctly. Without the udpdate, the output elapsed
time goes slower/faster when the fps is set lower/faster.

I am writing to ask if there are other implications of this change? I
had a look at the code and could not see any other impact of setting
the sh_video->fps & sh_video->frametime during each frame capture.

Regards
Keith



More information about the MPlayer-dev-eng mailing list