View Full Version : ffmpeg wav copy question
BabaG
2nd January 2026, 00:39
This seems to work but I'm wondering if it does the conversion without altering the audio data. It basically just extracts the pcm data to a raw file, then folds it back into a new wav file.
ffmpeg -i input.wav -f s16le -acodec pcm_s16le output.raw && ffmpeg -f s16le -ar 48000 -ac 2 -i output.raw output.wav
The original input wav has some header info that i want to change and this operation does do what I want. I'd just like to make sure the audio data is a 1:1 copy of the original.
thanks for any help,
babag
GeoffreyA
2nd January 2026, 07:52
I tested it on a 16-bit 48 kHz file. Using WinMerge, the resulting output.wav is, apart from the header I think, identical to the original.
However, the danger with FFmpeg is that auto-inserted filters can be invoked in other cases. Without asserting -c copy, we are open to alteration. Add -loglevel trace to see what is happening. Indeed, whenever processing in FFmpeg, check it with a higher loglevel; for in circumstances one might not expect, the auto-inserted filters come into play behind the scenes. Once the script has been verified, remove loglevel and use it as normal, till you make another change.
Does a simple -c copy not give the desired header?
ffmpeg -i input.wav -c copy output.wav
BabaG
2nd January 2026, 08:01
using a copy operation always copies the header too, warts and all. that was my experience anyway.
thanks for looking into this and the -loglevel suggestion.
babag
tebasuna51
2nd January 2026, 10:39
If your input.wav is the showed in post https://forum.doom9.org/showthread.php?p=2026238#post2026238 please, instead open a new thread, answer my question about how do you obtain this file with ffmpeg.
Maybe using:
ffmpeg -i 5.1.wav -af "pan=stereo|FL=c4|FR=c5" "simple BL-BR like FLFR.wav"
BabaG
3rd January 2026, 07:39
this seems to work well:
ffmpeg -i surround_input_file.m4a -af "pan=stereo|c0=c4|c1=c5" stereo_output_file_ch5_ch6.wav
in the m4a file above, the m4a contains uncompressed audio. the only question i have pertains to using the pan filter.
when i first started playing with extractions of channels with ffmpeg i was using "channelsplit=channel_layout=5.1" but the results for channels higher than 1/2 carried different header info that gave some of my software problems.
it's my understanding that, once i switched to a filter like "pan," i opened up the possibility that data would be altered. "copy" is always the way to get a 1:1 transfer of the data but using a filter might carry with it recompression or some alteration.
my question is, if i use pan (and only the pan filter) as in the above example, might the data from the two channels being extracted be altered or is this, in effect, a copy operation?
thanks,
babag
tebasuna51
4th January 2026, 11:33
Without any other filter this is a copy operation.
BabaG
5th January 2026, 21:32
fantastic! such helpful info.
thanks so much,
babag
Z2697
5th January 2026, 23:42
It depends on the expression you give it
BabaG
5th January 2026, 23:45
sorry. i don't follow that.
Z2697
6th January 2026, 00:45
pan is a channel mixing filter that's able to do pure channel mapping (copying)
https://trac.ffmpeg.org/wiki/AudioChannelManipulation (this explains basically everything)
BabaG
6th January 2026, 02:33
I was unclear on "the expression you give it." Am I right that what you're saying is that, while my example above keeps the channels discrete, other examples might mix channels, causing recompression, like this:
ffmpeg -i input.mp3 -af "pan=stereo|c0<c0+c1|c1<c0+c1" output.ogg
thanks,
babag
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.