I have large amount of wav files (over 50 000) and I need to split every wav file to 10 second long parts.

t's nearly impossible to do it one by one, so my question is: How can I do it in ffmpeg (or in sox)?

  • I'm voting to close this question as off-topic because the question is about Microsoft Windows, not Unix/Linux. – telcoM Sep 23 '19 at 15:01
  • @telcoM, this is not about Windows at all. Only the screenshot was (and I edited that out). – Wildcard Sep 23 '19 at 22:49

This is mentioned as an example in man sox:

split the input file into multiple files of 30 seconds in length. Each output filename will have unique number in its name as documented in the Output Files section.

sox infile.wav output.wav trim 0 30 : newfile : restart

So, assuming your wav files are under directory ~/myfiles, and you want to create the split versions in ~/split you can do

mkdir ~/split
cd ~/myfiles
find . -name '*.wav' \
 -exec sh -c 'mkdir -p ~/split/$(dirname "{}")' \; \
 -exec sox {} ~/split/{}  trim 0 10 : newfile : restart \;
  • there is a problem, i don't know, how sox works :( ... and i don't know how to use this command... if my exact source folder is named e.g.: "3_6_5_2016_L" should i write to command script cd 3_6_5_2016_L or ~/3_6_5_2016_L ... i'm really amateur but i desperately need to split these files :( ... here is a link for screenshot of the error which it shows: leteckaposta.cz/331694478 (im czech so don't get scared of the language, it's not some click bait, just click on SOX_screenshot.jpg link...) please, if you can, write the instructions like you would for a dummy :) thank you so so much – Taron Jan 17 '17 at 18:13
  • I am not able to access that website. If you have an error message you should copy it as text. If you have to post an image, edit your original question using the "image" button in the web page edit form and it will be held in the standard stackexchange place, namely imgur.com – meuh Jan 18 '17 at 14:15
  • I already added a screenshot directly into my question – Taron Jan 22 '17 at 20:12
  • 1
    Your screenshot shows that you are not using a Unix Operating System, but microsoft Windows. My answer will not work for you. You need to ask your question again on another site such as stackoverflow, making sure you mention you are using Windows. – meuh Jan 22 '17 at 21:09

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.