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

Sam Logan shapableline at gmail.com
Sun Jul 16 09:04:45 EEST 2023


I tried

ffmpeg -i "InputFile.mp4" -vf "select='between(n, 1069, 1263)',
setpts=PTS-STARTPTS" -af "aselect='between(t, 1069, 1263)',
asetpts=N/SR/TB" "OutputAttempt.mp4"

but this just results in an output file that has no audio track at all.
What can I do to fix this?

On Mon, Jun 12, 2023 at 3:13 AM Bouke / edit 'B <bouke at editb.nl> wrote:

>
> > On 12 Jun 2023, at 07:33, Edit 'B <bouke at editb.nl> wrote:
> >
> >
> >
> >> On 12 Jun 2023, at 07:15, Sam Logan <shapableline at gmail.com> wrote:
> >>
> >> Could someone please show me a command line with exactly what arguments
> to
> >> pass to -aselect or -atrim, based on my original post of wanting to clip
> >> video frames 1069 to 1263?
> >>
> >> Thanks.
> >
> > The numbers obviously depend on framerate and audio sample rate.
> >
> > Bouke
> >
>
> So the math is:
> frame number / frame rate * audio sample rate
> For speeds other than integers, use the 1000/1001 math.
> (23,976 vs 23,98 makes a huge difference on large numbers…)
>
> Bouke
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list