====== ffmpeg - Audio - Audio Channels - Change Audio Channels - Stereo to Mono ======
===== Downmix both channels =====
{{:ffmpeg:audio:audio_channels:audio_channels_-_stereo_to_mono.png?200|}}
ffmpeg -i "input.mkv" -map 0:0 -c:v copy -ac 1 mono.mkv
**WARNING:** Any out of phase stereo will cancel out.
* **-map 0:0 -c:v copy** to preserve the video stream.
The following filtergraph can be used to bring out of phase stereo in phase prior to downmixing:
-af "asplit[a],aphasemeter=video=0,ametadata=select:key=lavfi.aphasemeter.phase:value=-0.005:function=less,pan=1c|c0=c0,aresample=async=1:first_pts=0,[a]amix"
----
===== Choose a specific channel =====
{{:ffmpeg:audio:audio_channels:audio_channels_-_stereo_to_mono_-_exclude.png?200|}}
==== ...using the channelsplit audio filter ====
ffmpeg -i stereo.wav -filter_complex "[0:a]channelsplit=channel_layout=stereo:channels=FR[right]" -map "[right]" front_right.wav
**NOTE:** This uses the [[https://ffmpeg.org/ffmpeg-filters.html#channelsplit|channelsplit]] audio filter to include only the right channel.
* If you only want the left channel use **FL** instead of **FR**.
* For a list of channel names, run ffmpeg -layouts
----
==== ...using the pan audio filter ====
ffmpeg -i "input.mkv" -map 0:0 -c:v copy -af "pan=mono|c0=c1" "mono.mkv"
**NOTE:** This uses the [[https://ffmpeg.org/ffmpeg-filters.html#pan|pan]] audio filter to include only the right channel.
* **-map 0:0 -c:v copy** to preserve the video stream.
* Alternatively, you could use **c0=FR** instead.
* If you only want the left channel, use **c0=c0** or **c0=FL** instead.
----
===== References =====
https://trac.ffmpeg.org/wiki/AudioChannelManipulation#stereomonostream
https://ffmpeg.org/ffmpeg-filters.html#channelsplit
https://ffmpeg.org/ffmpeg-filters.html#pan