[FFmpeg-user] Cutting out part of a video does not work
Peter White
peter.white at posteo.net
Fri Mar 26 11:59:23 EET 2021
On Fri, Mar 26, 2021 at 09:55:21AM +0100, Cecil Westerhof via ffmpeg-user wrote:
> I want to publish a speech I gave during a Zoom meeting. But cutting
> it out does not work.
>
> When I use:
> ffmpeg -y -i 2021-03-25ToastmastersClubAvond.mp4 -ss 1190 -to 1631 -acodec copy -vcodec copy -async 1 speech.mp4
>
> The video starts just a bit to late. But when I use:
> ffmpeg -y -i 2021-03-25ToastmastersClubAvond.mp4 -ss 1185 -to 1631 -acodec copy -vcodec copy -async 1 speech.mp4
>
> which is five seconds earlier. I get the same output.
>
> Am I doing something wrong?
This is the expected outcome, because, due to the nature of lossy video
codecs, one can only start on keyframes. Please have a look at the
description of the -ss option for further details
> Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 2070 kb/s, 25 fps, 25 tbr, 30k tbn, 60k tbc (default)
> Metadata:
> creation_time : 2021-03-25T19:02:11.000000Z
> handler_name : H.264/AVC video
> encoder : AVC Coding
This is a lossy codec.
If you can live with further quality loss in the video, you can
transcode it, i.e. -c:v libx264.
Or you can set the start point some seconds further back. This way you
will not get the perfect cut but at least you do not lose anything of
the content you want.
You can use ffprobe to find the keyframe timestamps:
ffprobe -select_streams V:0 -show_frames -skip_frame nokey -show_entries frame=best_effort_timestamp_time 2021-03-25ToastmastersClubAvond.mp4
Cheers,
Peter
More information about the ffmpeg-user
mailing list