Hi,
I am trying to remove parts of a video (with audio) using the select
filter. I constructed this command to remove seconds 20-25:

(newlines only for readability)

ffmpeg -i input.mkv
  -vf "select='1-between(t,20,25)', setpts=N/FRAME_RATE/TB"
  -af "aselect='1-between(t,20,25)', asetpts=N/SR/TB" output.mkv

This works great, except that when I use multiple "between" clauses
to discard multiple sections, audio and video will start to get out of
sync. After changing the command to:

ffmpeg -i input.mkv
  -vf "select='1-between(t,20,25)'"
  -af "aselect='1-between(t,20,25)'" output.mkv

this doesn't happen anymore, but now the video is glitchy: Parts that
should be gone sort of remain in the video timeline, but are skipped.
Specifically, for the following command executed on a 59 minute long
video, vlc will jump from 6:38 (second 398s) to 9:59 (second 599), but
the video will still be truncated to 25:00 (1500 seconds) correctly: 

ffmpeg -i input.mkv
    -vf "select='1-between(t,20,25)-between(t,100,200)
    -between(t,220,300)-between(t,400,600)-between(t,750,800)
    -between(t,820,860)-between(t,880,900)-between(t,1000,1200)
    -gt(t,1500)'"
    -af "aselect='1-between(t,20,25)-between(t,100,200)
    -between(t,220,300)-between(t,400,600)-between(t,750,800)
    -between(t,820,860)-between(t,880,900)-between(t,1000,1200)
    -gt(t,1500)'" output3.mkv

Is there a way to cut up a video into multiple parts using the select
filter without having the video and audio go out of sync or having
glitchy video playback? If not, what is the best alternative?

_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to