[FFmpeg-user] When clipping by exact frame, how to get correct audio to match that clip?

Sam Logan shapableline at gmail.com
Wed May 24 06:37:20 EEST 2023

I am trying to extract a clip of a video by the exact frames.

I tried

ffmpeg -i "InputFile.mp4" -vf select="between(n\, 1069\,
1263),setpts=PTS-STARTPTS" "OutputAttempt1.mp4"


ffmpeg -i "InputFile.mp4" -vf

(In the second command, the ending frame is 1 greater than in the first
because the documentation indicates "end_frame" is the first frame that
dropped, and I want to include frame 1263.)

The video in the output files is correct and covers the frames that I want.
problem is that in both my attempts, the ENTIRE audio track is copied over
the output file, when I only want the portion of the audio track that plays
the same time (in the input video) as the video frames that I extracted for
output video. How do I get ONLY that portion of the audio into the output?

More information about the ffmpeg-user mailing list