[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"
and
ffmpeg -i "InputFile.mp4" -vf
trim=start_frame=1069:end_frame=1264,setpts=PTS-STARTPTS
"OutputAttempt2.mp4"
(In the second command, the ending frame is 1 greater than in the first
command
because the documentation indicates "end_frame" is the first frame that
gets
dropped, and I want to include frame 1263.)
The video in the output files is correct and covers the frames that I want.
The
problem is that in both my attempts, the ENTIRE audio track is copied over
to
the output file, when I only want the portion of the audio track that plays
at
the same time (in the input video) as the video frames that I extracted for
the
output video. How do I get ONLY that portion of the audio into the output?
More information about the ffmpeg-user
mailing list