Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Display Modes
Old 2nd January 2026, 00:39   #1  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
ffmpeg wav copy question

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.

Code:
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
BabaG is offline   Reply With Quote
Old 2nd January 2026, 07:52   #2  |  Link
GeoffreyA
Registered User
 
Join Date: Jun 2024
Location: South Africa
Posts: 603
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?

Code:
ffmpeg -i input.wav -c copy output.wav

Last edited by GeoffreyA; 2nd January 2026 at 08:03.
GeoffreyA is offline   Reply With Quote
Old 2nd January 2026, 08:01   #3  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
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
BabaG is offline   Reply With Quote
Old 2nd January 2026, 10:39   #4  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 7,362
If your input.wav is the showed in post https://forum.doom9.org/showthread.p...38#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"
tebasuna51 is offline   Reply With Quote
Old 3rd January 2026, 07:39   #5  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
this seems to work well:
Code:
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
BabaG is offline   Reply With Quote
Old 4th January 2026, 11:33   #6  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 7,362
Without any other filter this is a copy operation.
tebasuna51 is offline   Reply With Quote
Old 5th January 2026, 21:32   #7  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
fantastic! such helpful info.

thanks so much,
babag
BabaG is offline   Reply With Quote
Old 5th January 2026, 23:42   #8  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 859
It depends on the expression you give it
Z2697 is offline   Reply With Quote
Old 5th January 2026, 23:45   #9  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
sorry. i don't follow that.
BabaG is offline   Reply With Quote
Old 6th January 2026, 00:45   #10  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 859
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)
Z2697 is offline   Reply With Quote
Old 6th January 2026, 02:33   #11  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
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:
Code:
ffmpeg -i input.mp3 -af "pan=stereo|c0<c0+c1|c1<c0+c1" output.ogg
thanks,
babag
BabaG is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:42.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.