8

I'm trying to setup a script to automate some video manipulation, including trimming the video. for that I'm using ffmpeg filter_complex.

I would like to specify the start and end position using the format HH:MM:SS.m, but I'm not able to do it, despite the fact that ffmpeg documentation states it could be done. Here's a simplified version of the code:

ffmpeg -i input.mp4 -filter_complex \
"[0:v]trim=1.40.1:1.59.3,setpts=PTS-STARTPTS[v]" \
-map "[v]" -pix_fmt yuv420p -c:v libx264 -preset fast -y output.mp4

I think this it due to the fact that ":" is used to separate arguments in the filter options.
Any chances to make it work?

1
  • I've marked this duplicated as per the suggestion, but the answer to my question is way better (and includes link to documentation!) Mar 22, 2022 at 10:50

1 Answer 1

19

Welcome to "escaping hell". There are a variety of methods to do this. Here are three:

"trim=start='00\:00\:01.23':end='00\:00\:04.56'"

"trim=start=00\\\:00\\\:01.23:end=00\\\:00\\\:04.56"

trim=start=00\\\\:00\\\\:01.23:end=00\\\\:00\\\\:04.56
1
  • Wow. I spent a long time trying to figure this one out. Thanks for the helpful answer!
    – Sam
    Jul 12, 2020 at 12:44

Not the answer you're looking for? Browse other questions tagged .