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?

sanzoghenzo
  • 238
  • 2
  • 6

1 Answers1

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

llogan
  • 63,280