FFMPEG preprocessing for Wav2Vec2 - lmmx/devnotes GitHub Wiki
To convert an MP4 to WAV (resampled at 16kHz):
ffmpeg -i output.mp4 -ar 16000 -ac 2 -f wav output.wav
To split this into 5 minute chunks:
ffmpeg -i output.wav -f segment -segment_time 300 -c copy segmented/output%09d.wav
(Note the filenames will have 9 digits for the number here, probably excessive)
E.g.
output000000000.wav
If you choose a time period too short, you'll see the error that
RuntimeError: Calculated padded input size per channel: (2). Kernel size: (10). Kernel size can't be greater than actual input size
- See also: FFMPEG in Python