[FFmpeg-user] What is the correct way to cut the video with ffmpeg?

Shaun Procter shaun.procter at gmail.com
Tue Jun 21 17:14:24 CEST 2016

> On 21 Jun 2016, at 5:28 PM, 桃源老師 <xanadu6291 at dream.jp> wrote:
> Hello, 
> I have some videos which downloaded from internet.  
> Those video have approximately 30 second advertisement (ad) on start.  
> I can remove this ad using the following ffmpeg command:
> $ ffmpeg -ss 00:00:30.666 -i INPUT.mp4 -ss 0 -c: copy OUTPUT.mp4
> But here, I have one question.
> The cut point "00:00:30.666" is not keyframe.  The nearest keyframe is 
> "00:00:25.058" or "00:00:33.400".
> And If I cut the video on keyframe, the ad remain or run over the video contents.
> I have learned from the net that the video should be edit on unit of keyframe or 
> can not be edit on unit of keyframe.  This is my poor knowledge about video editing.  
> But as above, ffmpeg seems allows to cut video not on keyframe.  The resulting video 
> playbacks fine with ffplay and VLC except QuickTime Player have approx. 2 seconds 
> black screen on start.
> So, I'd like to confirm my way to remove ad is correct or not.  i.e. cutting video not on 
> keyframe is correct or not.  
> And if my way is not correct, please teach me the correct way…

If black screen on start with QuickTime Player is a problem you could consider a re-encode of the video track plus an audio copy instead of copying both the video and audio tracks e.g.

ffmpeg -ss 00:00:30.666 -i INPUT.mp4 -ss 0 -q:v 28 -c:a copy OUTPUT.mp4



More information about the ffmpeg-user mailing list