Associated URLs:
FFmpeg: RGB affected luma cycle
Utilising the 'extractplanes', 'blend', and 'xfade' filters found in FFmpeg 4.2.2. In the examples shown here, the following script and arguments were run (in order):
$ rgbLumaBlendCycle_FFmpeg.sh 'image1.jpg' 'screen'
$ rgbLumaBlendCycle_FFmpeg.sh 'image2.jpg' 'difference'
$ rgbLumaBlendCycle_FFmpeg.sh 'image3.jpg' 'pinlight' 'REV'
Image Credits:
Henry Huey - "Alice in Wonderland - MAD Productions 5Sep2018 hhj_6811"
Attribution-NonCommercial 2.0 Generic (CC BY-NC 2.0)
https://www.flickr.com/photos/henry_huey/43768692515/
Henry Huey - "Alice in Wonderland - MAD Productions 5Sep2018 hhj_6869"
Attribution-NonCommercial 2.0 Generic (CC BY-NC 2.0)
https://www.flickr.com/photos/henry_huey/29740096427/
Henry Huey - "Alice in Wonderland - MAD Productions 5Sep2018 hhj_6848"
Attribution-NonCommercial 2.0 Generic (CC BY-NC 2.0)
https://www.flickr.com/photos/henry_huey/29740096117/
$ rgbLumaBlendCycle_FFmpeg.sh 'image1.jpg' 'screen'
$ rgbLumaBlendCycle_FFmpeg.sh 'image2.jpg' 'difference'
$ rgbLumaBlendCycle_FFmpeg.sh 'image3.jpg' 'pinlight' 'REV'
#!/usr/bin/env bash # FFmpeg ver. 4.2.2+ # RGB affected luma cycle: Each colour plane is extracted and blended with the # original image to adjust overall image brightness. The result of each blend # is faded into the next, before belnding back to the original image. # Parameters: # $1 : Filename # $2 : Blend type (e.g. average, screen, difference, pinlight, etc.) # $3 : Reverse blend order (any string to enable) # version: 2020.07.15_12.28.31 # source: https://oioiiooixiii.blogspot.com function main() { local mode="$2" local name="$1" local layerArr=('[a][colour1]' '[b][colour2]' '[c][colour3]' '[colour1][a]' '[colour2][b]' '[colour3][c]') local layerIndex="${3:+3}" && layerIndex="${layerIndex:-0}" # Array contains values for both blend orders; index is offset if $3 is set ffmpeg \ -i "$name" \ -filter_complex " format=rgba,loop=loop=24:size=1:start=0, split=8 [rL][gL][bL][colour1][colour2][colour3][o][o1]; [rL]extractplanes=r,format=rgba[a]; [gL]extractplanes=g,format=rgba[b]; [bL]extractplanes=b,format=rgba[c]; ${layerArr[layerIndex++]}blend=all_mode=${mode}[a]; ${layerArr[layerIndex++]}blend=all_mode=${mode}[b]; ${layerArr[layerIndex]}blend=all_mode=${mode}[c]; [o][a]xfade=transition=fade:duration=0.50:offset=0,format=rgba[a]; [a][b]xfade=transition=fade:duration=0.50:offset=0.51,format=rgba[b]; [b][c]xfade=transition=fade:duration=0.50:offset=1.02,format=rgba[c]; [c][o1]xfade=transition=fade:duration=0.50:offset=1.53,format=rgba " \ ${name}-${mode}.mkv } main "$@"download: rgbLumaBlendCycle_FFmpeg.sh
Image Credits:
Henry Huey - "Alice in Wonderland - MAD Productions 5Sep2018 hhj_6811"
Attribution-NonCommercial 2.0 Generic (CC BY-NC 2.0)
https://www.flickr.com/photos/henry_huey/43768692515/
Henry Huey - "Alice in Wonderland - MAD Productions 5Sep2018 hhj_6869"
Attribution-NonCommercial 2.0 Generic (CC BY-NC 2.0)
https://www.flickr.com/photos/henry_huey/29740096427/
Henry Huey - "Alice in Wonderland - MAD Productions 5Sep2018 hhj_6848"
Attribution-NonCommercial 2.0 Generic (CC BY-NC 2.0)
https://www.flickr.com/photos/henry_huey/29740096117/
Subscribe to:
Posts
(
Atom
)