Skip to content

trim start end make duration vagued #318

Closed Answered by lucemia
sugizo asked this question in Q&A
Discussion options

You must be logged in to vote

For more information, please see:
https://www.bannerbear.com/blog/how-to-trim-a-video-using-ffmpeg/

It's advisable to avoid using a complex filter for simple video trimming tasks:

import ffmpeg

ffmpeg.input(
    "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
    ss=5,
    t=3,
).output(filename="trim_without_complex_filter.mp4").overwrite_output().run()
trim_without_complex_filter.mp4

When using a complex filter for trimming, sometimes the setpts filter becomes necessary:

Slightly different from the last two commands, setpts=PTS-STARTPTS is added to the command to adjust the timestamps of the output video. This resets the timestamps of the…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sugizo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants