Ask Your Question

Revision history [back]

re-encode video

Hi,

in my Python app I record a temporary video with fps being unpredictable when constructing the VideoWriter object. I use this one merely for collecting frames coming from some lengthy calculations. When done, I re-encode the temporary video to a new video with different fps in order to synchronize the video play length with the timestamp written to the video frames. Here is a snippet:

for i in np.arange(num_frames):
        _, frame = video_tmp.read()
        video_out.write( cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY) )

where video_tmp is the temporary video and video_out is the video with different fps.

Basically, my questions are:

Is it possible to just 'set' the new fps without encoding again?

If not, could encoding be done not frame-wise but in parallel?

I'm aware of the possibility to call ffmpeg externally for re-encoding. I just hoped, I could do it with OpenCV somehow.

Thanks in advance...