3

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?

10

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 '20 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.