Search code examples
ffmpegvideo-processing

Frame loss while FFmpeg video splitting


I am using ffmpeg to split the video file into multiple parts by following command. But there is frame loss.

   ffmpeg -i input.mp4 -ss 00:00:00 -t 00:10:00 -c copy output.mp4

For example there are total 17983 frames in complete video file. But total number of frames combined in all the splitted parts is 17970. So there are 13 frames less.

Can anyone please tell, if there is any method by which we can split the video without any frame loss. Even by using some other tool than ffmpeg.

Thanks....


Solution

  • Try with the segment muxer instead.

    ffmpeg -i input.mp4 -c copy -segment_times 600,1100,1400 -f segment out%d.mp4
    

    The times are in seconds. Just like ss copy, cut times may not be exact if a keyframe isn't present at the split time.