[FFmpeg-user] "More than 1000 frames duplicated" when converting JPGs to video

Gyan Doshi ffmpeg at gyani.pro
Sun Jun 27 09:26:29 EEST 2021



On 2021-06-27 11:43, Eduard B wrote:
> Hi list,
>
> I am using ffmpeg to convert a large set of timelapse still frames (JPGs)
> captured by my surveillance camera to a video. Using x265 library to make
> the file smaller. The particular batch I have tested has 14401 JPG files in
> a folder (one image captured every 6 seconds).
>
> Command is:
> ffmpeg -i /mnt/user/cctv/mjwVb9pFuK/8sHGyfFGu6_timelapse/$(date -d "-1
> days" '+%Y-%m-%d')/%06d.jpg -c:v libx265 -preset medium -crf 20 -r 30 -c:a
> aac -b:a 128k /mnt/user/cctv/mjwVb9pFuK/8sHGyfFGu6_timelapse/$(date -d "-1
> days" '+%Y-%m-%d')_x265_correct.mp4
>
> I wanted to convert to a 30 FPS video, the command I have been using, which
> works, converts the files to a video, however it complains about duplicate
> frames. While investigating, I have realized the final duplicate frames
> count has 2880 frames, which is 1/5 of the total amount of still images.
> Seems to me that the encoder assumes the input is recorded at 25 FPS and
> tries to convert it to a video which has the same length, but with 30 FPS.
> However, the input is a series of still images with no frame rate.
>
> I have changed the command to a similar one, using 25 FPS frame rate
> parameter value instead, and the complaint about duplicate frames is gone.
> This means I would need to explicitly tell the encoder the input is using
> 30 FPS, rather than the default assumption of 25. I have been looking at
> the "--fps" option, however documentation says "YUV only", I'm not sure
> it's applicable.

For image sequence inputs, use the framerate option.

     ffmpeg -framerate 30 -i ...

Regards,
Gyan


More information about the ffmpeg-user mailing list