shuffleplanes, swapuv

Watch on youtube.com
doc

https://ffmpeg.org/ffmpeg-filters.html#shuffleplanes, https://ffmpeg.org/ffmpeg-filters.html#swapuv

“shuffleplanes” and “swapuv” are both specialized versions of “mergeplanes”.

  • “swapuv” literally swaps U-plane and V-plane.

  • “shuffleplanes” is completely equivalent to “mergeplanes” only handling one input stream.

Therefore, it can be said that “mergeplanes alone is sufficient”. However, as a matter of course, these methods are a little easier to use.

shuffleplanes

00:00:25
#! /bin/sh
ifn="Pexels_2877_2880.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"

#
# * U(1) → Y
# * Y(0) → U
# * V(2) → V
#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
format=yuv444p,shuffleplanes=1:0:2:3
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

swapuv

00:00:45
#! /bin/sh
ifn="Pexels_2877_2880.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"

#
# * V → U
# * U → V
#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
swapuv
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"