[FFmpeg-user] Dual Mono Support
Lucas
bigheadrodeo at gmail.com
Thu Apr 17 06:21:53 EEST 2025
I think ffmpeg should support dual mono directly. It can already be done
manually in ffmpeg, but it should be implemented as a convenience feature.
1. Background
"Dual mono" is when a 1.0 mono signal is copied into a 2.0 stereo track.
The stereo track is identical in the L/R channels. This cannot be achieved
with a simple 2.0 downmix (-ac 2) because an L signal will be on the L
track (not in the R track at all), and likewise the R signal will not
appear in the L track.
2. Use cases
There are a few reasons to use dual mono, some of which have been
implemented in commercial products:
a. Compatibility
DVDs and blu-rays are hardly ever manufactured for true mono. They are
technically supported by AV receivers ("AVRs") in e.g. AC3, DTS-HD, and so
on. However, it seems for best compatibility and experience for
non-audiophiles, the discs simply put an identical or near-identical mono
stream in each of L and R signal. That way if the viewer happens to have an
L/R 2.0 system, they get sound out of both speakers. AVRs are capable of
receiving dual-mono and mixing it down into a true 1.0 signal for the
center channel (e.g. FC in 5.1).
Stereo is supported by millions of devices that have already been
manufactured. It goes back to the 1950s or so (1970s for sure). Stereo
sound is the de facto standard of older and cheaper computers, TVs, and so
on.
b. Accessibility
Some devices (cell phones) implement a mono downmix feature. This can help
with various disabilities and neurodiversities which I will not go into
here.
c. Earbud sharing
With dual mono, two people can watch on one pair of earbuds. This can be
useful when traveling.
d. Simpler support for true mono
The real reason this concept interests me is that with dual mono, you can
turn a stereo amp and a single speaker into a 'true mono' amp and speaker
setup. As mentioned in (2a), most devices are built for 2.0 or 5.1. They
don't come with specific "mono out". If you want to save money and have one
single speaker, you'd have to buy a 5.1 AVR, 5.1-capable player, and
possibly a 5.1-capable TV. Further, only since 2005 or so have "HD" AVRs
been available, supporting uncompressed 5.1 sound. This needlessly adds to
the cost, when a receiver from 1990 can still play uncompressed stereo. At
least 2 TVs I own, of varying price points and model years, do not offer
mono out.
By letting ffmpeg handle the dual-mono mix, all you need is a
stereo-capable playback chain.
3. Existing ffmpeg support
The best way I've found to do dual-mono in ffmpeg is to manually specify a
custom downmix. This is really designed for a 5.1->2.0 dual mono mix, and I
can't speak to how other channel layouts into dual mono will compare with
ffmpeg's default `-ac 2` mix. It looks like ffmpeg implements the ATSC
formula [1] but I can't find where in the code it does this.
In theory, you could also just set `-ac 1` and let your player work it out.
But this relies on correct player behavior.
# ATSC spec, same as ffmpeg -ac 1 (but creates dual mono not single mono)
-af "pan=stereo|FL < 1.0*FL + 1.414*FC + 1.0*FR + 0.707*SL + 0.707*SR|FR <
1.0*FL + 1.414*FC + 1.0*FR + 0.707*SL + 0.707*SR"
4. Implementing in ffmpeg
This is where I need help. Would it be best to implement it as a "channel
layout" in channel_layout.c ?
5. Links
1:
https://superuser.com/questions/852400/properly-downmix-5-1-to-stereo-using-ffmpeg
https://ffmpeg.org/ffmpeg-utils.html#Channel-Layout
https://trac.ffmpeg.org/wiki/AudioChannelManipulation
6. Detailed notes on ATSC downmix and mono in ffmpeg
set FL to this, "<" normalizes without clipping
FL < 1.0*FL + 2.0*clev*FC + 1.0*FR + slev*BL + slev*BR
set FR to the same (mono mix, same audio in FL and FR)
FR < 1.0*FL + 2.0*clev*FC + 1.0*FR + slev*BL + slev*BR
clev may be one of:
0.707 (-3.0 dB)
0.595 (-4.5 dB)
0.500 (-6.0 dB)
"reserved"
slev may be one of:
0.707 (-3.0 dB)
0.500 (-6.0 dB)
0.000
"reserved"
If the cmixlev or surmixlev bit fields indicate the reserved state (value
of ‘11’), the decoder should use the intermediate coefficient values
indicated by the bit field value of 0 1. If the Center channel is missing
(2/1 or 2/2 mode), the same equations may be used without the C term. If
the surround channels are missing, the same equations may be used without
the Ls, Rs, or S terms.
# ATSC spec, same as ffmpeg -ac 1 (but creates dual mono not single mono)
-af "pan=stereo|FL < 1.0*FL + 1.414*FC + 1.0*FR + 0.707*SL + 0.707*SR|FR <
1.0*FL + 1.414*FC + 1.0*FR + 0.707*SL + 0.707*SR"
# other ATSC formulas, not used by default
-af "pan=stereo|FL < 1.0*FL + 1.414*FC + 1.0*FR + 0.500*SL + 0.500*SR|FR <
1.0*FL + 1.414*FC + 1.0*FR + 0.500*SL + 0.500*SR"
-af "pan=stereo|FL < 1.0*FL + 1.414*FC + 1.0*FR + 0.0*SL + 0.0*SR|FR <
1.0*FL + 1.414*FC + 1.0*FR + 0.0*SL + 0.0*SR"
More information about the ffmpeg-user
mailing list