Showing posts with label ballet. Show all posts
Showing posts with label ballet. Show all posts

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)

UPDATE: September 11, 2018



I recently happened upon a MPV lua script created for practical video extraction.


It really works well, and I now find myself using it every time I need to clip a section of video.
link: https://github.com/ekisu/mpv-webm

MacMillan's "The Rite of Spring" + Magma - 'Slag Tanz'.








source video: https://www.youtube.com/watch?v=GEOi4ZzUud4

FFmpeg: The recursive effects of stacking tblend filters


# Twelve stacked 'tblend=all_mode=difference128' filters.
# Deblocking 'spp' and 'average' filters used to mimimise strobing effects.
# Due to latency issues, the result in ffplay will differ from a ffmpeg rendering.

ffplay \
   -i video.mp4 \
   -vf \
   "
      scale=-2:720,
      tblend=all_mode=difference128,
      tblend=all_mode=difference128,
      tblend=all_mode=difference128,
      spp=4:10,
      tblend=all_mode=average,
      tblend=all_mode=difference128,
      tblend=all_mode=difference128,
      tblend=all_mode=difference128,
      spp=4:10,
      tblend=all_mode=average,
      tblend=all_mode=difference128,
      tblend=all_mode=difference128,
      tblend=all_mode=difference128,
      spp=4:10,
      tblend=all_mode=average,
      tblend=all_mode=difference128,
      tblend=all_mode=difference128,
      tblend=all_mode=difference128 
   "



In the video above, 4 versions of the effect are shown. In order:
- The effects of the tblend filter chain as given
- A tblend fliter chain four-times as long
- The 'mode' alternates between 'difference128' and 'difference'
- A 'average' mode between each 'difference128' tblend filter


Here, the result of the shown tblend filter chain is combined with the original video, using various modes. In order:
- all_mode=difference128
- all_mode=difference
- all_mode=multiply128
- all_mode=multiply
- c0_mode=difference128
- unknown 'average_test.mkv'
- unknown 'all_average_test.mkv'
- unknown 'difference_test.mkv'
- unknown 'difference128_test.mkv'
- Original source material

source video: https://www.youtube.com/watch?v=50lAMbJUXfc

FFmpeg: Display and isolate macroblock motion-vectors in mpeg video


# Isolate motion-vectors using 'difference128' blend filter
# - add brightness, contrast, and scaling, to taste

ffplay \
   -flags2 +export_mvs \
   -i "video.mp4" \
   -vf \
   "
      split[original],
      codecview=mv=pf+bf+bb[vectors],
      [vectors][original]blend=all_mode=difference128,
      eq=contrast=7:brightness=-0.3,
      scale=720:-2
   "

Works best with higher-resolution videos; 4K source used in this case.

more info: https://trac.ffmpeg.org/wiki/Debug/MacroblocksAndMotionVectors
source video: Czech National Ballet - https://www.youtube.com/watch?v=bn12Ffi15Go
shorter alt. version: https://www.youtube.com/watch?v=KN_c4mdBpvg

The Google Juice

A group of beautiful dancers, all yearning forward, towards a mystical bottle of Google Juice.


source image: https://www.flickr.com/photos/royaloperahouse/16637249717/
source image: http://gregladen.com/blog/2015/03/seo-social-networking-blogging/

A novel approach to encrypting images in the clear


A novel, but impractical, method of encrypting an image in clear view. Randomising the position of each pixel, and keeping a record of that position, for later decryption. The cypher-key can be a text file or another image [similar to below-left]. The ARGB integer value of each pixel corresponds to the coordinates of where the pixel, in that space, has been moved to. The image below is a RGB key, without an alpha channel. With this RGB key-image, the maximum size of image that can be encoded is 16 megapixels (256*256*256). Adding an alpha channel increases the maximum size to 4 gigapixels.


The reason that this idea, in it's current form, is impractical is because the encrypted image can not be compressed with regular image compression algorithms, like jpeg. If it is saved as a jpeg, chromatic information is lost and what results when the image is decoded, is a monochromatic image [above-right]. To stop this, images can be saved as PNG files, but file size then becomes a problem with larger images [original jpeg image = 47.6KB / encrypted PNG = 278KB]

A solution to this, is to split the image into red, green, and blue components, and save them individually as jpegs. By merging these images together and running the decoding algorithm, the original image reemerges, with just a slight amount of noise added. The problem here is that the three images together still add up to roughly the same size as a single PNG [236KB], and noise has been added, but if we accept the existence of noise, then we can take it to it's logical conclusion.


Applying heavy compression of each of the three images, such that the jpeg quantising matrices can be seen, the total filesize has been reduced to [39.5KB]. Surprisingly, even with so much distortion, a recognisable version of the original can be still created. There is excessive noise but if a secret message were written in the image, it would still be quite legible.


Original image: Igone de Jongh - Dutch ballerina. http://www.operaballet.nl/en/node/2241?destination=peopleoverview/dancers

PNB's Nutcracker: The ever increasing athleticism of ballet


I had never felt inclined to watch an entire version of the Nutcracker ballet, until last December, when I happened upon a Pacific Northwest Ballet GIF animation on tumblr, and decided to source a copy of PNB's 1986 movie version, choreographed and designed by Kent Stowell and Maurice Sendak. And what a wonderful production it is. The Peacock divertissement alone, as danced by Maia Rosal, made it worth watching.

Leah Merchant's arabesque in the GIF of the modern version is stunning. One must comment however, that it does lose the context of the move representing a bird preening it's tail feathers. It is now a show piece, offering the dancer a chance to show off her technical prowess. That's not meant as a criticism by any means, but as an observation of the increasing athleticism of ballet.

I once had a blog post sketched out, which documented the increasing heights of leg extensions and the evolution of the arabesque through the centuries, and ended in a humerous envisioning of what obtuse angles the leg would take in the not too distant future.

notes:
http://oioiiooixiii.tumblr.com/post/69584518064
http://www.imdb.com/title/tt0091658/
http://www.pnb.org/Artists/Corps/LeahMerchant.aspx