mergeplanes

Watch on youtube.com
doc

https://ffmpeg.org/ffmpeg-filters.html#mergeplanes

Example 1

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

#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
format=yuv444p,mergeplanes=0x000201:yuv444p
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

0x000201:

  • Y → Y

  • V → U

  • U → V

Example 2

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

#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
format=yuv444p,mergeplanes=0x000000:yuv444p
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

0x000000:

  • Y → Y

  • Y → U

  • Y → V

Example 3

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

#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
format=yuv444p,mergeplanes=0x010101:yuv444p
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

0x010101:

  • U → Y

  • U → U

  • U → V

Example 4

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

#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
format=yuv444p,mergeplanes=0x020202:yuv444p
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

0x020202:

  • V → Y

  • V → U

  • V → V

Example 5

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

#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
format=yuv444p,mergeplanes=0x010200:yuv444p
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

0x010200:

  • U → Y

  • V → U

  • Y → V

Example 6

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

#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
format=yuv444p,mergeplanes=0x020001:yuv444p
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

0x020001:

  • V → Y

  • Y → U

  • U → V

Example 7

00:02:20
#! /bin/sh
ifn1="Pexels_2877_2880.mp4"
ifn2="Pexels_2880_2877.mp4"

ifnb1="`basename \"${ifn1}\" .mp4`"
ifnb2="`basename \"${ifn2}\" .mp4`"

pref="`basename $0 .sh`"

#
ffmpeg -y -i "${ifn1}" -i "${ifn2}" -filter_complex "
[0:v]format=yuv444p[0v];
[1:v]format=yuv444p[1v];
[0v][1v]mergeplanes=0x100102:yuv444p[v]" \
  -map '[v]' -an "${pref}_${ifnb1}_${ifnb2}.mp4"

0x100102:

  • Y (of 2nd input) → Y

  • U (of 1st input) → U

  • V (of 1st input) → V