Compare commits
4 commits
d223262047
...
d81d504ab0
Author | SHA1 | Date | |
---|---|---|---|
Nox Sluijtman | d81d504ab0 | ||
Nox Sluijtman | 161caa3c4d | ||
Nox Sluijtman | 2479e9a74e | ||
Nox Sluijtman | bf32f4d0b4 |
20
flake.lock
|
@ -5,11 +5,11 @@
|
|||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"lastModified": 1726560853,
|
||||
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -20,16 +20,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1707347730,
|
||||
"narHash": "sha256-0etC/exQIaqC9vliKhc3eZE2Mm2wgLa0tj93ZF/egvM=",
|
||||
"lastModified": 1727122398,
|
||||
"narHash": "sha256-o8VBeCWHBxGd4kVMceIayf5GApqTavJbTa44Xcg5Rrk=",
|
||||
"owner": "NixOs",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6832d0d99649db3d65a0e15fa51471537b2c56a6",
|
||||
"rev": "30439d93eb8b19861ccbe3e581abf97bdc91b093",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOs",
|
||||
"ref": "nixos-23.11",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -59,11 +59,11 @@
|
|||
"themes": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1707594839,
|
||||
"narHash": "sha256-VeoBv8LfsTLGSoGpiNlC8gd79xd4InG+bAC6TkBCSHw=",
|
||||
"lastModified": 1727424359,
|
||||
"narHash": "sha256-KFQm2wb8EbeRr2R6WKmDE/b9G0XWb7Wk8FzqPk9oLOk=",
|
||||
"owner": "EternalWanderer",
|
||||
"repo": "themes",
|
||||
"rev": "53560c95d3bd33362e5552cb9efeaf8234724868",
|
||||
"rev": "11b7a363dd47bfa418c97b82aa3d7a9951e9eb1c",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ description = "Voidcruiser website";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOs/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
themes = {
|
||||
url = "gitlab:EternalWanderer/themes";
|
||||
|
|
142
src/content/rambles/distortions.md
Normal file
|
@ -0,0 +1,142 @@
|
|||
---
|
||||
title: "Distortions"
|
||||
date: "2024-09-26T17:14:09+02:00"
|
||||
author: "$HUMANOID"
|
||||
tags: ["ffmpeg", "imagemagick"]
|
||||
description: I've been messing around with various tools to create some rather nasty looking and sounding things.
|
||||
---
|
||||
|
||||
# Festering Ideas
|
||||
|
||||
{{< start-details summary="Epilepsy warning" >}}
|
||||
{{< img src="/images/distortions/butchered.gif" alt="A gif with flickering text saying 'butchered'" >}}
|
||||
{{< end-details >}}
|
||||
|
||||
I've always liked glitchy looking images and videos. I just never bothered
|
||||
creating my own. That is until I came across the
|
||||
[`frei0r`](https://dyne.org/software/frei0r/) library by the
|
||||
[Dyne](https://dyne.org) project. Here I found the `glitch0r` effect and messed
|
||||
around with it for a bit in Kdenlive. However, as a terminal terminal user,
|
||||
using a graphical interface didn't feel right. So I figured out how to use the
|
||||
`frei0r` effects with `ffmpeg`.[^1] Now I could script the butchering of a bunch of
|
||||
files at once!
|
||||
|
||||
Among the effects in `frei0r`, I also found `scanline0r` and a bunch of other
|
||||
effect, but wasn't quite happy with the fact that the scanlines in question seem
|
||||
to be stuck at one resolution. Some time later (a few years), I heard someone
|
||||
complain about professional footage being interlaced and it looking like shit as
|
||||
a result. Upon closer inspection it had been the kind of ugly mess I'd been
|
||||
hoping to create with the `scanline0r` filter. So I got around to figure out how
|
||||
to interlace video using `ffmpeg` and butchered some videos further.
|
||||
|
||||
## First Manifestations
|
||||
|
||||
Here's a demonstration of what I managed to do so far using Big Buck Bunny as an
|
||||
example:
|
||||
|
||||
{{< video src="/videos/distortions/rabbit_original.mp4" type="video/mp4" width="500"
|
||||
caption="Original clip from Big Buck Bunny">}}
|
||||
|
||||
This snippet was chopped up using `ffmpeg` using the following command:
|
||||
```sh
|
||||
ffmpeg -ss 00:01:17 -i big_buck_bunny_720p_h264.mov -to 00:00:11.75 rabbit_original.mp4
|
||||
```
|
||||
|
||||
{{< start-details summary="Epilepsy warning" >}}
|
||||
|
||||
{{< video src="/videos/distortions/rabbit_mangled.mp4" type="video/mp4" width="500" caption="My butchered version">}}
|
||||
|
||||
{{< end-details >}}
|
||||
|
||||
```sh
|
||||
ffmpeg -ss 00:01:17 -i big_buck_bunny_720p_h264.mov -vf 'frei0r=filter_name=glitch0r:filter_params=0.05|0.8|.02|1,rgbashift=rh=6:bh=-4,interlace=scan=tff:lowpass=complex,format=yuva420p' -to 00:00:11.75 rabbit_mangled.mp4
|
||||
```
|
||||
The full original video can be found on [the Big Buck Bunny website](https://peach.blender.org/)
|
||||
|
||||
# Magick
|
||||
|
||||
In the mean time, I had been messing around with imagemagick as well. Using it
|
||||
to create pictures of words of phrases when I felt like it. Usually I would use
|
||||
something like the following to that end:
|
||||
```sh
|
||||
magick -font $(magick -list font | grep Font: | awk '{print $2}' | fzf) -pointsize 288 -fill white -stroke black -strokewidth 5 -background transparent label:"*Insert text here*" example.png
|
||||
```
|
||||
{{< img src="/images/distortions/example.png" caption="The font used is Iosevka" alt="Here I used the Iosevka font to create an image with the text *Insert text here*">}}
|
||||
|
||||
# Black Magick
|
||||
|
||||
So the other day, I thought it would be interesting to see if I could make some
|
||||
text using imagemagick and then feed it to `ffmpeg` to create a gif with an
|
||||
interesting glitch effect.
|
||||
|
||||
### Initial text
|
||||
|
||||
Some text made with imagemagick because its the easiest way I know to create a
|
||||
simple image with text.
|
||||
|
||||
```sh
|
||||
magick -font Iosevka -pointsize 300 -fill cyan -background transparent label:"Glitch" glitch.png
|
||||
```
|
||||
{{< img src="/images/distortions/glitch.png" alt="An image with cyan text saying 'Glitch'" >}}
|
||||
|
||||
> *Note*: The `pointsize` here is relevant as `ffmpeg` will complain if the image
|
||||
> has a pixel count not divisible by 2. 300 works with Iosevka, if it doesn't
|
||||
> work with your font of choice, try a few sizes until you find one that does.
|
||||
|
||||
### With glitch0r and some
|
||||
|
||||
```sh
|
||||
ffmpeg -loop 1 -i glitch.png -vf 'frei0r=filter_name=glitch0r:filter_params=0.05|0.8|.02|1' -t 10 glitch.gif
|
||||
```
|
||||
{{< img src="/images/distortions/glitch.gif" caption="" alt="The same image as above but with generated/artificial interference using the glitch0r effect from the frei0r library" >}}
|
||||
|
||||
### Mangled results with imagemagick
|
||||
|
||||
Initial results looked quite interesting. Then I thought it'd be funny to
|
||||
convert this gif to an apng -- animated png. This resulted in the gif being
|
||||
butchered in a really interesting way due to something in imagemagick being
|
||||
broken; when converting the gif to an apng using `ffmpeg`, it will come out on
|
||||
the other end in a state you'd expect.
|
||||
|
||||
{{< start-details summary="Epilepsy warning" >}}
|
||||
{{< img src="/images/distortions/glitch_butchered.gif" alt="A variant of the same image as before, but horrible broken due to the aforementioned bug in imagemagick" >}}
|
||||
{{< end-details >}}
|
||||
|
||||
```sh
|
||||
magick glitch.gif APNG:glitch_animated.png
|
||||
```
|
||||
> *Note*: You have to supply the fileformat in prefix form as apng isn't the
|
||||
> standard format for the 'png' file extension.
|
||||
|
||||
After creating the apng I decided to convert it back to a gif in order to save
|
||||
some space as the apng was 11M.
|
||||
|
||||
```sh
|
||||
magick APNG:glitch_animated.png glitch_butchered.gif
|
||||
```
|
||||
|
||||
I experimented a bit with both `ffmpeg` and imagemagick to see what the best
|
||||
results would be. `ffmpeg` is significantly faster with the default settings but
|
||||
has a slightly large filesize.
|
||||
|
||||
```sh
|
||||
$ ls -lh glitch_*
|
||||
-rw------- 1 yog-sothoth users 11M Sep 26 18:57 glitch_animated.png
|
||||
-rw-r--r-- 1 yog-sothoth users 5,1M Sep 27 09:48 glitch_ffmpeg.gif
|
||||
-rw-r--r-- 1 yog-sothoth users 4,2M Sep 27 09:49 glitch_magick.gif
|
||||
```
|
||||
|
||||
> *Note*: No, I have no idea why the apng has a umask of `077`. Imagemagick just
|
||||
> spat it out like that.
|
||||
|
||||
# Conclusion
|
||||
|
||||
I hadn't seen anyone butcher visuals quite like this before, so I thought I'd
|
||||
write a post about it with the idea that someone else might find it interesting.
|
||||
|
||||
So, go out there and butcher some visuals!
|
||||
|
||||
[^1]: For many of the frei0r effects I used Kdenlive to figure out their parameters.
|
||||
And for a list of available filters, I checked the `ffmpeg-filters(1)` manpage and
|
||||
looked for `frei0r`. Under the `filter_name` section, there are a few paths
|
||||
listed where ffmpeg checks for `frei0r` filters.
|
BIN
src/static/images/distortions/butchered.gif
Normal file
After Width: | Height: | Size: 10 MiB |
BIN
src/static/images/distortions/example.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
src/static/images/distortions/glitch.gif
Normal file
After Width: | Height: | Size: 496 KiB |
BIN
src/static/images/distortions/glitch.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
src/static/images/distortions/glitch_animated.png
Normal file
After Width: | Height: | Size: 11 MiB |
BIN
src/static/images/distortions/glitch_butchered.gif
Normal file
After Width: | Height: | Size: 4.1 MiB |
BIN
src/static/images/distortions/glitch_ffmpeg.gif
Normal file
After Width: | Height: | Size: 5.1 MiB |
BIN
src/static/images/distortions/glitch_ffmpeg.png
Normal file
After Width: | Height: | Size: 549 KiB |
BIN
src/static/images/distortions/glitch_magick.gif
Normal file
After Width: | Height: | Size: 4.1 MiB |
BIN
src/static/videos/distortions/rabbit_mangled.mp4
Normal file
BIN
src/static/videos/distortions/rabbit_original.mp4
Normal file
|
@ -1 +1 @@
|
|||
Subproject commit 53560c95d3bd33362e5552cb9efeaf8234724868
|
||||
Subproject commit 11b7a363dd47bfa418c97b82aa3d7a9951e9eb1c
|