0

I'm curious, is it possible to do frame-perfect audio cutting using ffmpeg's complex filter graphs + frame filtering aselect functionality?

I've tried a bunch of other approaches (using -segment_times and -ss/-t) - they worked but were only ~0.02sec accurate, just for reference:

  • ffmpeg -f lavfi -i "sine=frequency=1000:duration=5" -ar 48000 test.wav
  • ffmpeg -y -i test.wav -f segment -segment_times "1.55,2.00" -segment_list_type csv -segment_list output.csv test%04d.opus
  • ffmpeg -y -i test.wav -ss 0.00 -t 1.55 test0000.opus -ss 2.00 -t 1.00 test0001.opus

My filter-based attempts:

  • ffmpeg -y -i test.wav -ar 48000 -af "aselect=between(samples_n\,100\,16100)" test0000.opus as an example but this produces a 5-second long test0000.opus instead of a 0.25-second one
  • ffmpeg -y -i test.wav -ar 48000 -af "aselect=between(t\,0.0\,1.55)" test0000.opus kind of works, but still gives a 1.57-second audio instead of 1.55-second one.

Can this be done in principle using frame filtering? Am I missing something in these commands above? If the filter-based approach is not more accurate, I will fall back to my initial attempts.

Thanks!

2
  • Same issue as video.stackexchange.com/q/26451
    – Gyan
    Commented Sep 27, 2023 at 18:40
  • I think the linked issue is about generation of files of specific duration while here I'm inquiring about cutting from an input PCM with sample-perfect provided boundaries (I realize that some padding may appear during encoding to opus, but I care that input cutpoints are as sample-precise as possible) Commented Sep 28, 2023 at 15:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.