如何转换WAV为16000Hz单声道及FFmpeg合并输出该格式
Your current command uses -c copy which copies the original audio streams directly—so it preserves the sample rate and channel count from your input files. To force the merged output to be 16000Hz mono, you'll need to add audio conversion parameters and remove the stream copy flag.
Modified Command
ffmpeg -f concat -safe 0 -i /storage/emulated/0/AudioClipsForSpeakerRecognition/1/speaker_1_segments.txt -ac 1 -ar 16000 -c:a pcm_s16le /storage/emulated/0/AudioClipsForSpeakerRecognition/1/speaker_1.wav
Breakdown of New Parameters
-ac 1: Sets the output audio to mono (1 channel).-ar 16000: Sets the output sample rate to 16000Hz.-c:a pcm_s16le: Specifies the audio codec as 16-bit PCM (the standard uncompressed format for WAV files). This ensures compatibility and avoids any unexpected compression.
Why We Removed -c copy
The -c copy flag skips re-encoding, which is fast but doesn't let you modify audio properties like channel count or sample rate. Since you need to adjust these settings, re-encoding is necessary here.
Optional: Verify Output
After running the command, you can check the output file's properties with this command to confirm it's 16kHz mono:
ffmpeg -i /storage/emulated/0/AudioClipsForSpeakerRecognition/1/speaker_1.wav
Look for lines like Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s in the output to confirm the settings are correct.
内容的提问来源于stack exchange,提问作者channae




