I have been working to remove certain intervals in audio using FFMPEG and was wondering if there is a command or certain technique to only display certain intervals selected.

For example, say I have an audio file (audio.wav) of duration 400 sec, and I run a command to only select the intervals from 30 sec and beyond as such:

ffmpeg -i audio.wav -af "aselect=not(between(t,0,30)), asetps=N/SR/TB" output.wav

The command above produces an audio file output that does not include the first 30 seconds, however, my goal is to know what intervals that it did include. I am looking for something to display some output like:

start_time: 30 sec, end_time: 400 sec

I do not want to hardcode these values which is why I am looking for some type of way for FFMPEG or technique to produce it based on the intervals not included in the original audio. If anyone could please share with me any command, technique it would be greatly appreciated!


FFmpeg won't provide this information in compact form. At most, you can get the result of aselect's per-frame evaluation by switching to debug log level.

ffmpeg -v debug -i audio.wav -af "aselect=not(between(t,0,30)), asetpts=N/SR/TB" output.wav

The log will contain lines of the form

[Parsed_aselect_0 @ 000001ce36d7c440] n:107.000000 pts:219136.000000 t:9.938141 key:1 samples_n:2048 consumed_samples_n:nan -> select:1.000000 select_out:0
[Parsed_aselect_0 @ 000001ce36d7c440] n:108.000000 pts:221184.000000 t:10.031020 key:1 samples_n:2048 consumed_samples_n:nan -> select:0.000000 select_out:-1

select:1.000000 means the frame was selected, and 0.000000 means it was dropped. The t: on the same line is the timestamp.

So, locate the first select:1.000000 and then the select:0.000000 following that. The corresponding timestamps form the selected range. Repeat till end.

  • Is there a way to see this same information without having to produce another output wav file? I just want to see the information on the 'audio.wav' file after doing selecting which frames I want. Or do you happen to know a programming technique to where I can just compute the intervals myself? Eg: Intervals Not Selected -- [0,34], [67,100], program produces the intervals [35,66], [101, 400]. Jun 3 at 15:13
  • Without generating a file: ffmpeg -v debug -i audio.wav -af "aselect=not(between(t,0,30))" -vn -f null -
    – Gyan
    Jun 3 at 15:17
  • Thank you for this, however, the issue with this is how long it takes to produce the output considering prints every single frame that was used in selection. Jun 3 at 16:37
  • Yes. No way around that,
    – Gyan
    Jun 3 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.