-
code
result not expected expected result code just atrim (for audio)
result is expected problem seems on trim(start, end) function question thanks and best regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
For more information, please see: 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.mp4When using a complex filter for trimming, sometimes the
import ffmpeg
in_file = ffmpeg.input(
"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
)
ffmpeg.output(
in_file.trim(start=5, end=8).setpts(expr="PTS-STARTPTS"),
in_file.atrim(start=5, end=8).asetpts(expr="PTS-STARTPTS"),
filename="trim_with_complex_filter.mp4",
).overwrite_output().run() trim_with_complex_filter.mp4 |
Beta Was this translation helpful? Give feedback.
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:
trim_without_complex_filter.mp4
When using a complex filter for trimming, sometimes the
setpts
filter becomes necessary: