Passero
Passero

Reputation: 222

cImg save_video ignores fps

I am using cImg to generate images in a CImgList. when I save that stack to video by calling the save_video method on the stack, it ignores the fps and the output seems to be always 25fps. I opened the file in different players (VLC, windows movie,...) and its always 25fps.

cImg is using ffmpeg to create the video. I'm not specifying any codec so i assume the default mpeg2 is used (based on what VLC tells me). I also have no specfic settings for cImg.

I have a fixed amount of images of 500 and it always produces around 20 seconds which is 25fps.

What do I need to do to output it to for example 60fps?

Upvotes: 0

Views: 103

Answers (1)

Passero
Passero

Reputation: 222

I fixed it but not sure if it's a bug in cImg or just me not knowing how to use it properly but from what I found is that cImg doesn't pass the --framerate parameter to ffmpeg, only the -r parameter.

I updated the code to include the framerate parameter and it does seem to work. This is the updated cImg code in the save_ffmpeg_external function:

cimg_snprintf(command,command._width,
                "\"%s\" -framerate %u -v -8 -y -i \"%s_%%6d.ppm\" -pix_fmt yuv420p -vcodec %s -b %uk -r %u \"%s\"",
                cimg::ffmpeg_path(),
                fps,
                CImg<charT>::string(filename_tmp)._system_strescape().data(),
                _codec,bitrate,fps,
                CImg<charT>::string(filename)._system_strescape().data());

Upvotes: 0

Related Questions