[FFmpeg-user] ffmpeg producing invalid wav headers when merging two wav files

Jim McMaster jim.mcmaster at ringcentral.com
Mon Sep 13 21:13:33 EEST 2021

We are using ffmpeg to merge two mono wav files into a single two-channel file.  When we do, we get a wav file that has an invalid header, and some of our other software cannot process it.    In particular, the AudioFormat at offset 20 has a value of ‘0700’ (little-endian) instead of ‘0100’.  The Subchunk2ID is ‘00006461’ instead of ‘74616461’ (“data”).  The Subchink2Size is a huge number (1937924468 or 0X73826174) which is much larger than the size of the audio file.

We are using the command:

/usr/bin/ffmpeg -ac 1 -ar 8000 -acodec pcm_s16le -f s16le -i  <inFile1>  -ac 1 -ar 8000 -acodec pcm_s16le -f s16le -i  <inFile2>  -filter_complex "[1:a][2:a] amerge=inputs=2[a]" -map "[a]" <outFile>

This is generated in Java, so I hope I got it right.

So, what are we doing wrong?  How do we get ffmpeg to generate a valid wav header?

Thank you.

Jim McMaster
Senior Software Engineer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4050 bytes
Desc: image001.png
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210913/fe6f3b61/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 15133 bytes
Desc: image002.png
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210913/fe6f3b61/attachment-0001.png>

More information about the ffmpeg-user mailing list