Some thoughts on the importance of names

I often go to a lot of effort finding, and using, the correct spelling of a person's name, if that person's name originates from a non-Latin alphabet (Cyrillic, Hebrew, Chinese, logographic, etc.). Sometimes I don't even bother writing the transliterated version in brackets after it, if writing space is limited (e.g. Twitter).

Writing a person's name in a local character-set is okay for phonetical ease, but it should never be confused with the persons actual real name.

Even if one dislikes a person, one should do their best to spell the name as it should be spelled, in the correct alphabet. It is not politeness, it is correctness.

There is also the heinous practice [as personally witnessed in Irish schools], where a person's name is translated between languages. Not just transliteration, but actual translations of the words used in a name.¹

You cannot translate a name. A name is syntax, not semantics. The person is the semantic.

¹ Example: "Game of Thrones" translation into Irish, changes 'Jon Snow' into a literal 'Seán an tSneachta' https://twitter.com/DirkVanBryn/status/790155947490549760
N.B. I am still undecided about the process of reversing name order during transliteration (as can happen with 
Asian names).

Summer in February (2013)



An unfortunate film. What could have been an engaging and scenic period-drama was ultimately ruined by bad story telling. Based on a true story, perhaps the film-makers were just too familiar with the subject material, and got lost sketching a field of mere junctures, only hinting at the stories and personalities beyond. The film lacks the zest of surrealism to excuse the, frankly, bizarre choices made by the characters.



info: https://en.wikipedia.org/wiki/Summer_in_February
discussion: https://www.filmboards.com/board/12184287/

FFmpeg: Temporal slice-stacking ['slit-scan'] effect (aka 'Wobbly Video')


An old video effect¹, experimented with in 2013 (using processing.org)², revisited now again using FFmpeg³. The concept is to take one line of pixels (x or y) of a frame, relative to its position in the video, and stack those lines into a new frame. Then increment their starting point while progressing through the timeline of the video.

This is somewhat similar to the effect commonly seen (these days) with the "rolling shutter" artefact of certain digital photography. See 'Ancillary footage' at the bottom of the post for an overlay version that may help as visual aid in understanding.

In the demonstration above (and longer videos below) the frame is divided into four quadrants: Top-left is the original; top-right are horizontal stacked frames (btt); bottom-left are vertical stacked frames (rtl); bottom-right are vertical-stacked frames that have then been stacked horizontally.

#!/bin/bash
# Temporal slice-stacking effect with FFmpeg (aka 'wibbly-wobbly' video).
# See 'NOTES' at bottom of script.

# Ver. 2017.10.01.22.14.08
# source: http://oioiiooixiii.blogspot.com

function cleanUp() # tidy files after script termination
{
   rm -rf "$folder" \
   && echo "### Removed temporary files and folder '$folder' ###"
}
trap cleanUp EXIT

### Variables
folder="$(mktemp -d)" # create temp work folder
duration="$(ffprobe "$1" 2>&1 | grep Duration | awk  '{ print $2 }')"
seconds="$(echo $duration \
         | awk -F: '{ print ($1 * 3600) + ($2 * 60) + $3 }' \
         | cut -d '.' -f 1)"
fps="$(ffprobe "$1" 2>&1 \
      | sed -n 's/.*, \(.*\) fps,.*/\1/p' \
      | awk '{printf("%d\n",$1 + 0.5)}')"
frames="$(( seconds*fps ))"
width="640" # CHANGE AS NEEDED (e.g. width/2 etc.)
height="360" # CHANGE AS NEEDED (e.g. height/2 etc.)

### Filterchains
stemStart="select=gte(n\,"
stemEnd="),format=yuv444p,split[horz][vert]"
horz="[horz]crop=in_w:1:0:n,tile=1x${height}[horz]"
vert="[vert]crop=1:in_h:n:0,tile=${width}X1[vert]"
merge="[0:v]null[horz];[1:v]null[vert]"
scale="scale=${width}:${height}"

#### Create resized video, or let 'inputVideo=$1'
clear; echo "### RESIZING VIDEO (location: $folder) ###"
inputVideo="$folder/resized.mkv"
ffmpeg -loglevel debug -i "$1" -vf "$scale" -crf 10 "$inputVideo" 2>&1 \
|& grep 'frame=' | tr \\n \\r; echo

### MAIN LOOP
for (( i=0;i<"$frames";i++ ))
do
   echo -ne "### Processing Frame: $i of $frames  ### \033[0K\r" 
   ffmpeg \
   -loglevel panic \
      -i "$inputVideo" \
      -filter_complex "${stemStart}${i}${stemEnd};${horz};${vert}" \
      -map '[horz]' \
         -vframes 1 \
         "$folder"/horz_frame${i}.png \
      -map '[vert]' \
         -vframes 1 \
         "$folder"/vert_frame${i}.png
done

### Join images (optional sharpening, upscale, etc. via 'merge' variable)
echo -ne "\n### Creating output videos ###"
ffmpeg \
   -loglevel panic \
   -r "$fps" \
   -i "$folder"/horz_frame%d.png \
   -r "$fps" \
   -i "$folder"/vert_frame%d.png \
   -filter_complex "$merge" \
   -map '[horz]' \
      -r "$fps" \
      -crf 10 \
      "${1}_horizontal-smear.mkv" \
   -map '[vert]' \
      -r "$fps" \
      -crf 10 \
      "${1}_verticle-smear.mkv"

### Finish and tidy files 
exit

### NOTES ######################################################################

# The input video is resized to reduce frames needed to fill frame dimensions 
# (which can produce more interesting results). 
# This is done by producing a separate video, but it can be included at the 
# start of 'stemStart' filterchain to resize frame dimensions on-the-fly. 
# Adjust 'width' and 'height' for alternate effects.

# For seamless looping, an alternative file should be created by looping
# the desired section of video, but set the number of processing frames to 
# original video's 'time*fps' number. The extra frames are only needed to fill 
# the void [black] area in frames beyond loop points.

download: ffmpeg_wobble-video.sh

Alien:Covenant (2017)



Milking a dead horse: I kept asking myself while watching, "but haven't we seen this film before‽"

Related note:



info: https://en.wikipedia.org/wiki/Alien:_Covenant

FFmpeg: Rainbow trail chromakey effect


An effect loosely inspired by old Scanimate¹ analogue video effects. The process involves stacking progressively delayed, and colourised, instances of the input video on top of each other. These overlays are blended based on a chosen colourkey, or chromakey. The colour values and number of repetitions can be easily changed, though with higher numbers [in test cases, 40+], buffer underflows may be experienced.

#!/bin/bash

# Generate ['Scanimate' inspired] rainbow trail video effect with FFmpeg
# (N.B. Resource intensive - consider multiple passes for longer trails) 
# version: 2017.08.08.13.47.31
# source: http://oioiiooixiii.blogspot.com

function rainbowFilter() #1:delay 2:keytype 3:color 4:sim val 5:blend 6:loop num
{
   local delay="PTS+${1:-0.1}/TB" # Set delay between video instances
   local keyType="${2:-colorkey}" # Select between 'colorkey' and 'chromakey'
   local key="0x${3:-000000}"     # 'key colour
   local chromaSim="${4:-0.1}"    # 'key similarity level
   local chromaBlend="${5:-0.4}"  # 'key blending level
   local colourReset="colorchannelmixer=2:2:2:2:0:0:0:0:0:0:0:0:0:0:0:0
                     ,smartblur"
   # Reset colour after each colour change (stops colours heading to black)
   # 'smartblur' to soften edges caused by setting colours to white

   # Array of rainbow colours. Ideally, this could be generated algorithmically
   local colours=(
      "2:0:0:0:0:0:0:0:2:0:0:0:0:0:0:0" "0.5:0:0:0:0:0:0:0:2:0:0:0:0:0:0:0"
      "0:0:0:0:0:0:0:0:2:0:0:0:0:0:0:0" "0:0:0:0:2:0:0:0:0:0:0:0:0:0:0:0"
      "2:0:0:0:2:0:0:0:0:0:0:0:0:0:0:0" "2:0:0:0:0.5:0:0:0:0:0:0:0:0:0:0:0"
      "2:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0"
   )

   # Generate body of filtergraph (default: 7 loops. Also, colour choice mod 7)
   for (( i=0;i<${6:-7};i++ ))
   {
      local filter=" $filter
                     [a]$colourReset,
                        colorchannelmixer=${colours[$((i%7))]},
                        setpts=$delay,
                        split[a][c];
                     [b]colorkey=${key}:${chromaSim}:${chromaBlend}[b];
                     [c][b]overlay[b];"
   }
   printf "split [a][b];${filter}[a][b]overlay"
}

ffmpeg -i "$1" -vf "$(rainbowFilter)" -c:v huffyuv "${1}_rainbow.avi"
download: ffmpeg_rainbow-trail.sh

This is a top-down approach to building the effect. Another [possibly better] solution is to build the layers from the bottom up (pre-calculate the PTS delay for each layer i.e. "layer number x PTS delay"). This might improve the fidelity of the top layer in certain videos. Another idea is split input into three instances rather than two, and 'key overlay the third at the very end of the filter.


A concatenation of all videos generated during testing and development.

¹ Scanimate video synthesizer: http://scanimate.com/
original video: https://www.youtube.com/watch?v=god7hAPv8f0

FFmpeg: Extract section of video using MPV screen-shots



An unorthodox, but simple and effective way of accurately extracting a section of video from a larger video file, using MPV screen-shots (with specific file naming scheme) for 'in' and 'out' points.

Bash commands below serve only to demonstrate the general idea. No error handling whatsoever.
#!/bin/bash
# Extract section of video using time-codes taken from MPV screen-shots
# Requires specific MPV screen-shot naming scheme: screenshot-template="%f__%P"
# N.B. Skeleton script demonstrating basic operation

filename="$(ls -1 *.jpg | head -1)"
startTime="$(cut -d. -f-2 <<< "${filename#*__}")"
filename="${filename%__*}"
endTime="$(cut -d_ -f3 <<<"$(ls -1 *.jpg | tail -1)" | cut -d. -f-2)"
ffmpeg \
   -i "$filename" \
   -ss "$startTime" \
   -to "$endTime" \
   "EDIT__${filename}__${startTime}-${endTime}.${filename#*.}"
Another approach to this (and perhaps more sensible) is to script it all through MPV itself. However, that ties the technique down to MPV, whereas, this 'screen-shot' idea allows it to be used with other media players offering timestamps in the filename. Also, it's a little more tangible: you can create a series of screen-shots and later decide which ones are timed better.

video shown in demo: “The Magic of Ballet With Alan and Monica Loughman" DVD (2005)

FFmpeg: Simple video editor with Zenity front-end


A proof-of-concept implementation of a simple, but extensible, video editor, based on FFmpeg with a Zenity interface. Presented as a proof-of-concept as bugs still remain and the project is abandoned.

The goal was to create a video editor with the simplest of requirements; tools found on most popular GNU/Linux distributions, with a standard installation of FFmpeg (+FFplay). The original idea was to create just a video clipping tool, however, the facility to add functionality was included. Extending the functionality involved creating separate scripts with Zenity dialogs relating to the feature added.

While the effectiveness of the implementation is questionable, some interesting concepts remain, such as: a scrub-bar for FFplay created from just a set of filterchains, a novel approach to referencing time-stamps from FFplay, and the correct FFmpeg switches to force edit video clips on non-keyframes (the results of which are demonstrated in the video above).

download: ZenityVideoEditor_0.1.tar.gz

original version: 2016, 15th February https://twitter.com/oioiiooixiii/status/699239047806500864

Filthy Frank: "Pinku Dragon"


The effect was created by first extracting the foreground in Flowblade video editor [the FFmpeg version of this process was demonstraited previously¹]


In the animation, the Flowblade window is shown. The blur amount of a filter on the mask is being altered, which demonstraits the mask area growing and shrinking, and the edges of the mask get fuzzier.

Each cut-out frame was then sequentially merged, and overlayed on a background frame, creating the final animation. However, this was not the original goal of the process. If it were, it may have been easier to create using ImageMagick's stacking functionality²

[ Demonstrating the full procedure involved in foreground extraction using Flowblade may appear in a future blog post ]
¹ see also: https://oioiiooixiii.blogspot.com/2016/09/ffmpeg-extract-foreground-moving.html
² see also: https://oioiiooixiii.blogspot.com/2017/01/long-exposure-photography-compared-to.html
source video: https://www.youtube.com/watch?v=S6bQibFNs2E
original upload: (Twitter) August 5, 2016