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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th December 2025, 22:59   #1  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
edit data displayed by mediainfo?

is there a means to edit the data i see displayed when i look at a wav file via mediainfo?

thanks,
babag
BabaG is offline   Reply With Quote
Old 20th December 2025, 23:45   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,411
Maybe you might wanna be more explicit in what you are asking.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 21st December 2025, 02:39   #3  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
thanks for taking the time to look at this StainlessS.

i have a 6 channel wav file and have extracted channels in pairs using ffmpeg. i extracted channels 1 and 2 to one stereo file and channels 5 and 6 to another stereo file. the info i get from mediainfo looks normal, as i'd expect it to look, for the extracted channel 1 and 2 file. the info i get for the extracted channel 5 and 6 file seems to have carried the info over from the 6 channel wav. for most programs, like players, this seems not to be a problem and they play the file fine. however, premiere displays the stereo wav extracted from channels 5 and 6 as blank. it looks to me like premiere is looking at things in the file data like the 'channel layout' info, which shows as Lb Rb, and is getting confused. mediainfo shows no info for 'channel layout' for the extracted channel 1 and 2 stereo file.

i thought it would be interesting to try editing the mediainfo data to try to bring the channel 5 and 6 stereo file into line with the channel 1 and 2 stereo file. the 'format settings,' 'encoded by,' 'codec id,' and 'channel layout' fields differ in the two files.

here's the media info readout for the two stereo files:
Code:
Format                                   : Wave
Format settings                          : PcmWaveformat
File size                                : 82.1 MiB
Duration                                 : 7 min 28 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 536 kb/s
Recorded date                            : 2025-12-18
Writing application                      : Lavf60.16.100

Audio
Format                                   : PCM
Format settings                          : Little / Signed
Codec ID                                 : 1
Duration                                 : 7 min 28 s
Bit rate mode                            : Constant
Bit rate                                 : 1 536 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 kHz
Bit depth                                : 16 bits
Stream size                              : 82.1 MiB (100%)
Code:
Format                                   : Wave
Format settings                          : WaveFormatExtensible
File size                                : 82.1 MiB
Duration                                 : 7 min 28 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 536 kb/s
Encoded by                               : REAPER
Recorded date                            : 2025-12-18
Writing application                      : Lavf60.16.100

Audio
Format                                   : PCM
Format settings                          : Little / Signed
Codec ID                                 : 00000001-0000-0010-8000-00AA00389B71
Duration                                 : 7 min 28 s
Bit rate mode                            : Constant
Bit rate                                 : 1 536 kb/s
Channel(s)                               : 2 channels
Channel layout                           : Lb Rb
Sampling rate                            : 48.0 kHz
Bit depth                                : 16 bits
Stream size                              : 82.1 MiB (100%)

Last edited by BabaG; 21st December 2025 at 03:04.
BabaG is offline   Reply With Quote
Old 21st December 2025, 21:23   #4  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 959
Reaper is not FFmpeg right?
There's a WAVEFORMATEXTENSIBLE_CHANNEL_MASK header section in the second file, removing that should give you the "normal" file.

Doing extraction with FFmpeg will be like
Code:
ffmpeg -i input.wav -af pan="2c|c0=c4|c1=c5" output.wav
There are multiple choices for audio channel extraction but I like pan the most.
This probably won't result in the file you have.
Z2697 is offline   Reply With Quote
Old 26th December 2025, 01:22   #5  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
thanks for the suggestion, z2697. as it happens, i'd found that solution and will probably use it if there's no better alternative. it's helpful to have your input in confirming it as a good method.

it's my understanding that filtering with ffmpeg involves recompressing files whereas copying does not, and that "-af pan..." is the application of a filter. that's why i was hoping to find a way to just edit the header or whatever. i never found a way to use "copy" with my m4a 6 channel files, at least for the higher channel numbers. ffmpeg always threw errors. was hoping there might be a way to just change labels or something without touching the raw data.

thanks again,
babag
BabaG is offline   Reply With Quote
Old 26th December 2025, 20:50   #6  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 959
Extracting channels from encoded audio streams is not trivial thing to do.

But as to the header editing, do you want to change the channel layouts of the audio (Lb Rb to L R), or you want to make 6 channels audio be read as 2 channels?
Modifying the header is not hard but you need to find out which byte to edit, because it usually won't spell out WAVEFORMATEXTENSIBLE_CHANNEL_MASK directly in the file.
The latter I don't know, it's like a completely different difficulty level.
Z2697 is offline   Reply With Quote
Old 26th December 2025, 21:45   #7  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
thanks for continuing to listen in on this and respond, z2697.

Quote:
...as to the header editing, do you want to change the channel layouts of the audio (Lb Rb to L R)...
yes, that's exactly what i was thinking. there are a couple of other fields, one that you mention (WAVEFORMATEXTENSIBLE_CHANNEL_MASK), that i've no idea if they'd make a difference but the channel layout would be a start. any tips on that would be appreciated.

thanks again,
babag
BabaG is offline   Reply With Quote
Old 27th December 2025, 05:31   #8  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 959
Here's a list of the bits and the corresponding channel position
(This version of the list is compiled by xyx98)
Quote:
0000 0000 0000 0001 L
0000 0000 0000 0010 R
0000 0000 0000 0100 C
0000 0000 0000 1000 LEF
0000 0000 0001 0000 Lb
0000 0000 0010 0000 Rb
0000 0000 0100 0000 Lscr
0000 0000 1000 0000 Rscr
0000 0001 0000 0000 Cb
0000 0010 0000 0000 Ls
0000 0100 0000 0000 Rs
0000 1000 0000 0000 Tc
0001 0000 0000 0000 Tfl
0010 0000 0000 0000 Tfc
0100 0000 0000 0000 Tfr
1000 0000 0000 0000 Tbl
So basically you look for bytes 0x3000 (because it's little endian) in the header and change it to 0x0300, it's byte 28-29 in my sample (count from 0) but I'm not sure if it will in different place in other samples.
And if you use FLAC, it's spelled out in the header and written as ASCII, for example WAVEFORMATEXTENSIBLE_CHANNEL_MASK=0x30, but it involves changing the length of the field, or you can chang the last ASCII 0 to 0x00, I'm not sure how compatible it will be.

Last edited by Z2697; 27th December 2025 at 06:03.
Z2697 is offline   Reply With Quote
Old 27th December 2025, 07:56   #9  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 7,368
If you want change only the channelmask of a wav file you can use 'LeeWav.exe' included in the attached file in https://forum.doom9.org/showthread.p...60#post2017560.
It read the wav header and can suggest available channel mask to change. You can test some values and need to confirm the change like you can see in the image:
Attached Images
File Type: jpg LeeWav.JPG (62.7 KB, 73 views)
tebasuna51 is offline   Reply With Quote
Old 28th December 2025, 22:56   #10  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
wow. this is pretty fascinating. pretty much beyond what i understand but fascinating. i was able to use leewav.exe to change the header info to L R. that's kind of my speed unless everything is explicitly spelled out for me.

the main things that seem to remain after getting L R fixed is the designation of "Format settings" to display as "PcmWaveformat" rather than "WaveFormatExtensible" and "Codec ID" to display as "1" rather than "00000001-0000-0010-8000-00AA00389B71".

i appreciate what Z2697 posts regarding the channel layout info but don't understand how to get or alter that info, what tools are used and how. i assume something similar would be applicable to the "Format settings" and "Codec ID" fields. i just would need a lot of hand-holding to be able to apply it.

thanks again for the info on this,
babag
BabaG is offline   Reply With Quote
Old 29th December 2025, 07:48   #11  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
i found this tool:

https://github.com/david-pace/wave-recovery-tool

hope it's legal to put the link here.

it seems to have fixed most of what concerned me. i still have to test when i get the files to the workstation the problem arose on.

fwiw, this came about when i had some problems getting a six channel wav to play on brightsign players for a museum piece. after a ridiculous amount of trial and error, i decided to pull the six channels apart into stereo pairs, using ffmpeg. the FL/FR worked fine but the Lb/Rb retained the header info from the six channel file when i used ffmpeg to extract them, reporting as Lb/Rb instead of as simply 2 channels. that caused adobe premiere to see the channels as blank, presumably because there is no Lb/Rb in the 2 channel stereo file. i may be leaving out some detail here but that's the basic story of how this came about.

since i know the intended details of the wav file, depth, rate, channels and such, i included that in the command line for the tool. wave-recovery-tool seems to have gotten the header info, as reported by mediainfo, to pretty much match the FL/FR file that premiere reads without issue. there is an error reported, a discrepancy:
Code:
Chunk Size: 86102146
[WARNING] Chunk size does not match file size. Should be equal to total number of bytes - 8 = 86102122, but was: 86102146 (difference: 24)
not sure if that will make a difference. realistically, though, i'm not sure if any of this will work.

thanks,
babag

Last edited by BabaG; 29th December 2025 at 07:57.
BabaG is offline   Reply With Quote
Old 29th December 2025, 07:57   #12  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 7,368
1) A WAV file is a container that can hold different content. When the AudioFormat field (displayed by MediaInfo as Codec ID) is 1, it means it contains PCM samples in integer format; 3 means it contains PCM float samples; 85 means MP3 content, and so on.
Therefore, changing the AudioFormat involves converting the data, not just changing the header. ffmpeg can do it.

2) When the AudioFormat is 65534, it means the header has an extended format (WAVE_FORMAT_EXTENSIBLE) which includes additional information, primarily the MaskChannels, indicating the number of channels, and a new, extended Codec ID to support any content. The simple header format is only valid for mono (only C channel) or stereo (channels L-R) audio.

If we have stereo audio, as in your example, we could convert its header to a simple format with:

eac3to extensible.wav simple.wav -simple

That command converts all the data as you wish, but it's obviously only valid for mono or stereo PCM samples.

EDIT: I still not read your post

Last edited by tebasuna51; 29th December 2025 at 08:02.
tebasuna51 is offline   Reply With Quote
Old 29th December 2025, 08:08   #13  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 7,368
Quote:
Originally Posted by BabaG View Post
fwiw, this came about when i had some problems getting a six channel wav to play on brightsign players for a museum piece. after a ridiculous amount of trial and error, i decided to pull the six channels apart into stereo pairs, using ffmpeg. the FL/FR worked fine but the Lb/Rb retained the header info from the six channel file when i used ffmpeg to extract them, reporting as Lb/Rb instead of as simply 2 channels. that caused adobe premiere to see the channels as blank, presumably because there is no Lb/Rb in the 2 channel stereo file. i may be leaving out some detail here but that's the basic story of how this came about.
Your problem seems only downmix the 6 channels to stereo:

eac3to six.wav stereo.wav -downStereo
tebasuna51 is offline   Reply With Quote
Old 30th December 2025, 02:50   #14  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
thanks, tebasuna but, actually, no. i don't want a downmix. i need to extract the channels, two at a time so i get three stereo pairs. i don't want all six channels mixed into the stereo. what i need is 1/2 of 6ch file ---> stereo file 1, 5/6 of 6ch file ---> stereo file 2.

when i've used ffmpeg for the extraction, i get header info in the higher numbered channels that makes the file unreadable in adobe premiere. i'd like to be able to fix that without re-encoding if possible.

hope that's clear and thanks again,
babag

Last edited by BabaG; 30th December 2025 at 02:53.
BabaG is offline   Reply With Quote
Old 30th December 2025, 07:10   #15  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 7,368
I don't know for what you need that, but I say already how obtain the same wav data with a simple header (first mediainfo in your post) with the BL-BR file (second mediainfo in your post):

eac3to extensible.wav simple.wav -simple

BTW any modern sofware (Premiere ?) must accept a wav with WAVE_FORMAT_EXTENSIBLE header, if you change the maskchannel to 3 (FL-FR) with LeeWav.exe to avoid problems.

If you still have problems let me know how do you use ffmpeg to obtain the stereo files from 5.1 source.

Last edited by tebasuna51; 30th December 2025 at 07:33. Reason: add info
tebasuna51 is offline   Reply With Quote
Old 3rd January 2026, 07:25   #16  |  Link
BabaG
Registered User
 
Join Date: Dec 2003
Posts: 267
i've moved on to another approach as i never got this to work out well. i'm on linux and did get eac3to to work under a virtual windows machine but that's kind of a lot of extra work. sticking with ffmpeg seems preferable. i started another thread as i've drifted into more specifically ffmpeg questions.

at this point i don't recall the command i was using that gave me the problematic header. something to do with channelsplit=channel_layout=5.1 i think. when i switched to the pan filter things started working better for me.

that said, this is what i currently have and it seems to work well.
Code:
ffmpeg -i surround_input_file.m4a -af "pan=stereo|c0=c4|c1=c5" stereo_output_file_ch5_ch6.wav
thanks,
babag
BabaG is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 07:59.


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