Ask Your Question
0

Is there any option to change the FPS of VideoWriter?

asked 2015-06-03 09:00:44 -0600

Hello,

I'm trying to save a video-stream with an undefined framerate. My idea is to count the frames and measure the time of the stream and set the FPS after I've written the video. Is there any chance or even a better solution?

Thanks Klaus

edit retag flag offensive close merge delete

Comments

unless you can cache all your images somehow, - no way, how things are atm.

berak gravatar imageberak ( 2015-06-03 09:36:50 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-06-05 03:52:26 -0600

pklab gravatar image

updated 2015-06-05 05:04:25 -0600

I suppose that source stream has a fixed FPS.

You could reopen the video file, read the frames and save them into a new file with right FPS.. this will introduce big overhead specially for big videos

You could catch your video stream for a couple of seconds to measure source frame rate. Create your video file using measured frame rate. Sincerely 2 or 3 frame should be enough

  • If you need to include initial part of the stream you have to cache it.
  • If your process is fast enough you can to cache just 1st part
  • If your process speed is close to source frame rate you need a tread that receives frames from video stream and write them a FIFO queue and a threads that reads frames from FIFO queue and save them into video file

finally if your process is slower than source frame rate you have to take some countermeasure because you can going into buffer overflow

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-06-03 09:00:44 -0600

Seen: 2,203 times

Last updated: Jun 05 '15