2

The following command trims a video using the trim video filter:

ffmpeg -y -i input.mp4 -vf "trim='00\:00\:05':'00\:00\:10',setpts=PTS-STARTPTS" output.mp4

But if the video also contains audio stream, it will not be trimmed.

I tried

ffmpeg -y -i input.mp4 -vf "trim='00\:00\:05':'00\:00\:10',setpts=PTS-STARTPTS" -af "atrim='00\:00\:05':'00\:00\:10'" output.mp4
ffmpeg -y -i input.mp4 -filter "trim='00\:00\:05':'00\:00\:10',setpts=PTS-STARTPTS" output.mp4

but the 2nd version returns an error, and the 1st creates a "wrong" video. By "wrong" I mean that the output video is now somewhat consists of two parts, the 1st part is silent, and the 2nd does have a static image.

How to combine -vf trim and -af atrim so that they will work synchronously?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.