Monday, 4 December 2023

Verlustkontrolle - Loosing control - getting lost

GL*T©H ::::
LOO$*NG CONTROL _ GETT*NG LO$T


Introduction


Most of us making or studying glitch art have a glitch art origin story where we notice and then become fascinated by glitch. It might be through machine malfunction, a blue screen of death, broken images recovered from a failed hard-drive, a rhythmically skipping cd or a mangled image file downloaded from a camera that suddenly changes from being a banal family photo into something new and compelling, or a satellite signal drops out and reveals a new landscape in which faces melt into each other and narrative is halted and slowly lost. We only notice the technology that surrounds us when that technology works in a way other than expected. Loss can lead to transformation. Glitch art works by understanding, replicating and expanding those transformations and in that process ( and glitch art is very much a process) reveals the fragility of digital media and the cultural and technological assumptions digital media stems from.


Digital art is inherently fragile, to make digital art is to work with loss, we change computers, we change operating systems, equipment fails, software that we use either becomes ‘updated’ so it doesn’t have the same functionality or won’t work unless we ‘upgrade’ to a newer machine. The environment where our work lives is also fragile, websites and social media companies change moderation policies, social media sites may vanish taking down whole swathes of work, I may not keep up hosting fees and my carefully constructed website might disappear, the environment in which we work is in a state of constant flux.


The one constant in making digital art is change and loss, part of control must be about archiving, not only work , but software and hardware. A lot of what I do as an artist revolves around researching older versions of Linux and how it interacts with various hardware and file formats, to that end I collect and maintain an archive of older machines and software as well as maintaining an archive of my own work and techniques.


There is a paradox at the heart of what I do, I embrace loss within my own processes but try to reduce it in the archiving of my own work – knowing that all digital work tends towards entropy and that ideas of permanence are futile.


A quick discussion of generational loss


Far from being a perfect record a digital file is often compressed or lossy, subject to bit rot or corruption over time, susceptible to being lost, over written or destroyed by hard-drive failure, files may live on in online copies on google drive or via Instagram which can itself inadvertently glitch images ,


The classic Instagram glitch

Facebook or whichever social media network survives the next few years but those copies are often different to the originals due to the differing ways that social media networks compress images – Facebooks’ compression algorithm is especially egregious so in effect these are copies of copies of copies and many people have experimented with repeatedly uploading and downloading images and videos to demonstrate this or work with it


For instance to quote from a gizmodo article from 2015 on Pete Ashton’s ‘I am sitting in stagram’, with a nod to loss this article can only be accessed via archive.orgs wayback machine : https://web.archive.org/web/20160321010334/http://gizmodo.com/heres-what-happens-when-you-repost-the-same-photo-to-in-1685260122


(See also Pete Ashton’s website on this https://art.peteashton.com/sitting-in-stagram/)


‘Artist and photographer Pete Ashton has sped up this gradual disintegration process in his recent project entitled "I am sitting in stagram." He began with a single photo, uploaded it to Instagram, took an unfiltered screenshot and reposted the resulting image, repeating the process 90 times to produce an effect akin to the real-life aging process.’


Pete Ashton – Lucier grid


This work in turn was inspired by the work of composer Alvin Lucier ( thus lucier grid) specifically his work ‘I am sitting in a room’


From the wikipedia article on that work https://en.wikipedia.org/wiki/I_Am_Sitting_in_a_Room ‘ The piece features Lucier recording himself narrating a text, and then playing the tape recording back into the room, re-recording it. The new recording is then played back and re-recorded, and this process is repeated. Due to the room's particular size and geometry, certain frequencies of the recording are emphasized while others are attenuated. Eventually the words become unintelligible, replaced by the characteristic resonant frequencies of the room itself’


There is also a video homage to Luciers work by Patrick Liddel which illustrates video decay via youtube upload and download - ‘VIDEO ROOM 1000’ https://www.youtube.com/watch?v=icruGcSsPp0

 

 




There are technical explanations around ‘generational loss’ with jpegs which explain what is happening each time we save a jpeg https://photo.stackexchange.com/questions/99604/what-factors-cause-or-prevent-generational-loss-when-jpegs-are-recompressed-mu but wikipedias definition is probably better https://en.wikipedia.org/wiki/Generation_loss


To quote from that article ‘ Generation loss is the loss of quality between subsequent copies or transcodes of data. Anything that reduces the quality of the representation when copying, and would cause further reduction in quality on making a copy of the copy, can be considered a form of generation loss. File size increases are a common result of generation loss, as the introduction of artifacts may actually increase the entropy of the data through each generation.’


In their work Alvin Lucier, Pete Ashton and Patrick Liddle are not talking about loss as a bad thing rather loss becomes the basis of the work in a similar way to the use of feedback in analog video art where a screen and a camera gradually interact too create new, unique ever changing work.


Each copying or sharing of a work changes it subtly, in effect creating a new work or as I’ll talk about later a remix, digital work may be inherently fragile but it is also inherently mutable, loss rather than being an enemy can also be a useful tool, control of that process is via the environment it lives in , be it storage, the internet, the work itself, as well as setting the conditions under which that work can be reused.


Other forms of loss to consider


Where you display your work determines the quality its seen at, Facebook has notoriously bad image compression and videos uploaded there can be really badly artifacted, you could ask ‘but don’t we want this?’ – yes but the artifacts we want to see are the ones we generate, though allowing for the happy accident and working with the internet as a medium there are limits to how much we want these happy accidents to remake the work. Instagram stubbornly insists on a square format which in itself influences the work we make and post – a landscape image becomes a square selection of part of an image so loss is inherent in that platform which also does not allow for posting gifs and has a narrow range of video codec options, the texture of some work relying on a specific codec for impact or texture (see the differences in texture between h261, h264 or webp/ogv for example) – but to mitigate that loss we begin to use that format to our advantage, see chan something stars baobab users project - https://www.instagram.com/baobab_users/ ( which I’ll talk about shortly) where both the format of Instagram and the format of smartphone galleries, screenshotting and cropping is used to its fullest extent reflecting online culture in a collision of collected or shared images, personal photographs’ memes and underground stars reflecting a stream of consciousness poetry which is like watching the internet dreaming and thinking.


Generation loss via platforms and within online communities


Glitch art lives on the internet – but web sites disappear or appear , content moderation policies change, website ownerships change. Tumblr ( arguably one of the birth places and incubators of glitch art as we know it now) passes through different hands and new owners ban content that they deem to be NSFW – YouTube content disappears in a haze of copyright strikes or is rendered unviewable by constant adbreaks – the job of an artist who exists to any degree online is to manage what happens when content policies change or websites disappear – control of loss is what we do – when Tumblr policies changed after it was bought by Verizon , leading to mass takedowns of blogs back in 2018 ( articles here https://www.businessinsider.in/tech/tumblr-users-are-leaving-in-droves-as-it-bans-nsfw-images-heres-where-theyre-going-instead/articleshow/67002132.cms and here https://www.fastcompany.com/90277836/meet-the-tumblr-refugees-trying-to-safe-its-adult-content-from-oblivion and many other articles) the internet archive swung into action to try and save many of these blogs but much good online work was lost, distorting the space that was Tumblr and the narrative / conversation going on within glitch art.


Those works might exist on the artists hard drives but often those making this work don’t back up their work, one of our primary responsibilities as artists working on the internet must be to archive and keep our own work safe and also to start building mechanisms to save the work of others we and the wider community see as important. We can’t expect the traditional art world or art historians to do this for us because they either don’t care, aren’t looking in the right places or don’t know what to look for in the first place – these spaces move so quickly we can’t wait for hindsight, academia or others to write and preserve our history for us because by then it might be gone.


The frankly odd moderation policies on nudity or that defined nebulously as NSFW on Facebook and Instagram lead to strange situations like shadow banning –


Shadow bans


wikipedia definition of a shadow ban


‘Shadow banning, also called stealth banning, hellbanning, ghost banning, and comment ghosting, is the practice of blocking or partially blocking a user or the user's content from some areas of an online community in such a way that the ban is not readily apparent to the user, regardless of whether the action is taken by an individual or an algorithm. For example, shadow-banned comments posted to a blog or media website would be visible to the sender, but not to other users accessing the site.’


Many glitch artists will use a pseudonym, not something Meta or other platforms approve of and they will try anything to get you to use a real name or interact more fully with the platform even though you may only be there for that one group, it soon becomes obvious to a user when shadow banning is happening to their account. Pseudonyms are an important part of glitch art, they allow artists to take on personas for safety reasons or that reflect better their idea of self, gender identity or to take on a degree of anonymity which separates personhood from work, glitch art is a great community for allowing us to be who we are rather than our given or assumed roles irl, shadow banning becomes problematic when it forces us to give up identities we have fought hard to take on as our own.


These kind of bans make the community's themselves a less vibrant and inclusive place as much of what is termed NSFW or falls foul of content moderation algorithms is often work by marginalized and more diverse communities, communities such as queer or trans which have been the bedrock on which movements like glitch art have been built, for them to be excluded or shadow banned from platforms makes movements like ours poorer – if you don’t control the platform the platform controls you and we lose the richness and diversity of what made our online communities great in the first place. Its the digital equivalent of gentrification.


  To the Fediverse


There are good decentralized( not in the nft sense) fediverse alternatives to mainstream social media sites such as peertube ( a youtube alternative) , mastodon ( a good alternative to twitter), pixelfed an instagram alternative but I’m not going to talk about those now but they are good directions to go in to take back ownership of our own social online presence.


Further research

pixelfed - https://pixelfed.org/

peertube - https://joinpeertube.org/

mastodon - https://joinmastodon.org/


Working with loss


The work I’m currently making embraces loss by purposefully shrinking images down to a tiny fraction of their original resolution and then blowing them back up again to work with the artifacts created in that transition and then turning those images into grids which are mirrored and cropped and rebuilt. Originally these works started as an attempt to replicate the methodology of Xavier Dallet and his baobab users project find that here - https://www.instagram.com/baobab_users/?hl=en


Baobab Users



Xavier Dallet, Baobab users, extreme replication

Xavier Dallet, Baobab users, extreme replication

specifically the grid structure and repetition I found appealing which derives from using smartphones to build sets of images and meaning passed between users via the messenger platform, I wanted to do that on a desktop rather than smartphone so I created a set of scripts to replicate that.


Icewm Icons


Reduced to Pbm 10x10pixels


which led me to find a basic set of images like these icons from Icewm window manager as starting points . These are already at a small resolution typically between 32x32 or 16x16 pixels – I transcoded those from jpg to pbm ( black and white bit map) then made repeating grids


Wopa wopa wopa


But the process I created which takes groups of images and grids them and crops them randomly into smaller and smaller grids within a larger grid started me exploring what could be done by shrinking images down deliberately almost to the point where they lose meaning and become just material doing this I’ve found creates small islands of distortion around which further techniques anchor themselves ( something I’d experimented with before but I’ll explain that later) .

As an example I can scrape the images from a news website https://www.spiegel.de/kultur/

 

Spiegel kultur page 26/11/2023



The scraped images


Now reduce those images in size to 80x80px from original sizes and make them square


Original size


Use a script to rearrange blocks of pixels in a specific way and use gmic to displace originals against that output.

 


 


Or using a slightly different technique run those images through a computer with a specific type of graphics card using an old version of Linux and record the output using a capture card.


The same Image on a computer with ATI graphics card running LinuxMint Bea 2.1


Japans’ ghosts original


Or we could take the original video for japans 1982 performance of ghosts and play that through the same computer and record that output



Ghosts versus ati graphics card and mint bea 2.1 In this version I reduced the original video file down from 640x480 pixels to 352x288 and changed the format of the video from h264 mp4 to h261, h261 one of the earliest codecs created for video is more blocky and more prone to artifacts , and more useful when used in conjunction with an ati graphics card and mintbea 2.1 – the smaller the image the richer the output.


Or I could combine the techniques I talked about earlier , by turning the original ghosts video into stills , reducing those stills from 640x480 to 20x20px  

 


 then displacing every other still against its previous still , and colourising them in the process

 


Then recombining those into a new work, the audio taken from the original cut up stretched and glitched ( this was 10000 images)


Ghosts part 1

 So Just to illustrate the difference without and with ATI graphics card


LinuxMint Bea 2.1 without ATI graphics card


LinuxMint Bea 2.1 without ATI graphics card

LinuxMint Bea 2.1 with ATI graphics

LinuxMint Bea 2.1 with ATI graphics

These images all started as 640x480 pixels but at lower resolutions like 256x256 or even 80x80 more interesting things happen.


 

As I change resolution the artifacts created change, each new technique used adding to those artifacts like wind blowing sand around obstacles in real life.

Lower resolutions = more artifacts

Or we could just cut the original images up and attempt to reassemble them a technique I’ve started to use a lot more of late , its useful as a technique in its own right but also for creating displacement maps in scripts. This script happened by accident – I was actually trying to create a simple cut up and rejoin routine and to test that I worked on this process which didn’t work how I intended but I like what it does .



  Output as displacement maps for originals.




Loss or reduction of quality can lead to a rich breeding ground for artifacts. And discovering and exploring these flaws had a serious effect on how I viewed resolution and quality , the lower the resolution the more interesting things became for me when working in this way.

These images were made on a Dell Wyse 5010 Dx0D Thin client from 2016 with AMD G-T48E apu early versions of this technique used a standard mid 2000’s mini-atx motherboard and AMD Radeon HD 3650 agp graphics card ( these give different colours and effects) the hardware was not altered in any way and these images are direct output as seen on screen – this effect can also be replicated with variations in more modern versions of linux such as Gnuinos chimera .

To return to the theme of this talk

Part of our work as artists is to fight against the entropy of generational loss, we keep copies of work on hard drives, have back up strategies to keep our originals intact, all the while these images are being accessed, changed, uploaded, downloaded and remixed, an image on the internet is always changing, its meaning changing with each iteration, context or even the device it is viewed on, whatever we think about copyright or ownership an image or video or file on the internet is always a remix away from being turned into something else, it is a thing in itself but it is also a base material.

To work in this environment means giving up a large degree of control, but how then do we retain authorship if anything can be copied and remixed – essentially we have to change our ideas of what authorship and ownership mean – controlling work online is a losing game unless we take lessons from the the open source and free software movement. One way of controlling authorship is by giving others the right to use a work, remix it, or keep a copy of it, as long as those others grant the same rights to others if they make work based on what I have made – a culture of sharing rather than denying ( and also legally binding) which fosters rather than restricts. To gain control we must lose control and give up on the now absurd idea of a unique or investment work beloved of the old art establishment.

Scarcity value.

As a side note NFT’S also slyly acknowledge this absurdity whilst still charging for files in editions similar to the way that artist printmakers print limited editions giving the illusion of ownership via block-chain ledger entries and the notional passing of notional money ( cryptocurrency) most of the ideas that underpin these ‘markets’ reflect old art world practices and fight against the reality of digital art which is that if it is on a screen or a device or in an accessible file it can be copied, remixed, shared as part of a cultural commons.

Traditional printmakers may make a limited edition of prints from their own original plates for sale, the value of those prints reflecting their scarcity, the printmaker could still run off a few hundred extra prints which could be sold but that would reduce the artificial scarcity value on which the old art gallery system/establishment works and which controls artists and what is seen and valued culturally and monetarily.

Scarcity value and greed = New Warhols = Art as commodity

In a particularly interesting turn of events the artist Paul Stephenson tracked down original Andy Warhol acetates and made ‘New’ Warhol works. From the BBC article from 2017 https://www.bbc.com/news/entertainment-arts-41634496

‘Stephenson has made new versions of Warhol works by posthumously tracking down the pop artist's original acetates, paints and printer, and recreating the entire process as precisely as possible.’

‘While Warhol's assistants did many parts of the physical work, the artist, who died in 1987, was the only one who worked directly on these acetates, touching up parts of the portraits to prepare them for printing.’

‘Stephenson took the acetates to one of Warhol's original screenprinters in New York, Alexander Heinrici, who offered to help use them to make new paintings.’

An artists value as a commodity for investment and speculation increases after death and to be able to print new works to satisfy demand seems logical from a money making persepctive but what does it say about authorship and the ethical state of the art market itself? In a way I can only applaud the artist doing this as eventually it will reduce the monetary value of all Warhol works ( and Warhol would probably be quite amused and approving of this making of ‘new’ works) But old world copyright laws might have something to say about this, scarity value and ownership could be viewed as anti-cultural and anti society.

To be a digital artist also means to acknowledge the absurdity of the ‘original’ unique work and questions interacting with the old art world, the need for commercial galleries or even the notion of curatorship, as in the online communities where we work such as the glitch artists collective network we become

Self organising – self curating

See festivals such as The Wrong Biennial , Glitch art is dead, Fu:bar, Glitch art Brazil.

There is parallel self curating and self organizing within the NFT space but my take on it is that though laudable from a community aspect ultimately these are only seeking legitimacy from or aping pre-existing structures within the traditional art market , they are less about creating or reflecting a shared cultural commons and more about money and reputation and the next generation of investible art stars. 

 

Creative Commons reject the notion of scarcity foster abundance.

I share my work under creatives commons licence CC BY-NC-SA 4.0 which states ( find legal code here https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.en#s3


creative commons licence CC BY-NC-SA 4.0


Terms and conditions

This aspect of sharing and remixing is fundamental to glitch art ( though not many artists use creative commons licenses there is an unwritten understanding that sharing and remixing is good) both in source material, final work ( in that any digital work can be final ) and the sharing of techniques, software and scripts.

My work is made using pretty much entirely free or Libre software which relies on an open and free software eco system and its one I strongly believe in and advocate for , creative commons goes hand in hand with it – libre software being founded on the principles of the fsf Foundation and its list of four software freedoms

0) The freedom to run the program as you wish, for any purpose (freedom 0).
1) The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.
2) The freedom to redistribute copies so you can help your neighbor (freedom 2).
3) The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.

see also definition of free cultural works here - https://freedomdefined.org/Definition

The four freedoms applied to cultural works

1) the freedom to use the work and enjoy the benefits of using it

2) the freedom to study the work and to apply knowledge acquired from it

3) the freedom to make and redistribute copies, in whole or in part, of the information or expression

4) the freedom to make changes and improvements, and to distribute derivative works

To sum up - Control of authorship (other than attribution and crediting the original source) does not exist within digital art other than through peer pressure which often states its okay to remix, but wrong to steal and claim work as your own. We could fight to control our work and our ownership of an image or a video or a music file, a document, whatever, but ultimately there is a copy of that somewhere someone has made for their own use and purposes – but as I believe in remix culture and the idea that culture and art should be available that is a problem only if we adhere to the old ideas of copyright and ownership – if a digital file is not a thing who can truly own what is intangible ?

This attitude also reflects a culture of realism – most of us who make art will not make money from it or even be able to support ourselves through it, instead taking up jobs outside of art, in teaching, research or looking for funding through grants, residencies etc , or working completely outside of the art world, but that also makes us free to make the work we want to – it does not make the work we make any less valid, far from it, it allows us to work freely outside of old establishments and paradigms which no longer understand or serve us, free to create newer more relevant structures which operate along lines of a culture of abundance, sharing and a more open access to the means of artistic production and dissemination. It allows us to build a cultural commons where work has value for what it is rather than how much it is worth or a received assignment of value.

Because seriously who goes to galleries ? Contrast the number of people who wouldn't be seen dead in a gallery but will quite happily look at work on their devices – definitions of art have changed with the onset of the internet and the audience has grown and often the audience makes art in response to what they see, they don’t just passively receive it – we as the makers and consumers define what it is rather than old institutions and vested interests, it as an alive thing rather than a dead thing to be studied and dissected.

Towards a cultural commons

Lawrence Lessig is the originator of creative commons and from creative commons we can infer the idea of a cultural commons, where art, culture and learning are shared and valued without ideas of scarity value and ownership, something which already exists at the heart of glitch art where ideas, techniques and work are shared freely and openly and from Lawrence lessig we also get the formulation of ideas and discussion around the idea of remix culture through his book ‘Remix: Making Art and Commerce Thrive in the Hybrid Economy’

What is remix culture and why do I say everything is a remix? If we talk about generational loss then the remix element is obvious as a file is physically copied, recopied and remixed by transmission, in terms of culture itself its the act of taking a pre-existing work or idea and making something with that , In glitch art the use of archive dot org is near ubiquitous as a source of material, much of it out of copyright or public domain ( its safer to remix a work that's public domain) or say a photo library like pixabay we could also consider collage art as a precursor to glitch art in that pre-existing works are used and re-contextualised through deconstruction and the reassigning of meaning through proximity beyond the inadvertent remixes engendered by device or generational loss.

Remix culture is at the heart of any art going back to the renaissance or further – each generation looks at a previous generations work and borrows themes , iconography , techniques or just plain copies as Lawrence Lessig states:

‘ I’ve described what I mean by remix by describing a bit of its prac-

tice. Whether text or beyond text, remix is collage; it comes from

combining elements of RO (read-only) culture; it succeeds by leveraging the

meaning created by the reference to build something new.

‘There are two goods that remix creates, at least for us, or for our kids, at least now. One is the good of community. The other is education.’

And:

‘Remixes happen within a community of remixers. In the digital

age, that community can be spread around the world. Members of

that community create in part for one another. They are showing

one another how they can create, as kids on a skateboard are show-

ing their friends how they can create. That showing is valuable,

even when the stuff produced is not.’

Glitch art is fundamentally a community, people sharing their latest technique or work, trying to one up each other – but it is also an inviting community in a way that traditional art communities are often not .

In the example I showed towards the beginning of this talk I scraped the images from a website, downloaded the probably copyrighted images and turned them into something new, who then owns these images – and at what point does a remix become a new work ? If everything can be looked at as source material who owns it ? My answer to that question is that we all do, if we look at cultural hoarding and gatekeeping in the old art world as a cultural loss to all of us then remixing allied with the free software movement and creative commons can be seen as cultural gain expanding as it does the access to tools, audience and participation. But this also implies a duty on us as artists to further participation, inclusivity, curatorship and opportunity.

But we must also be wary of creeping academicization – the need to study, dissect and classify within terms the establishment understands and can use to co-opt, curate and fit within an old art world narrative – we must forcefully resist this by writing our own histories, our own studies and our own narratives – work which is already under way.

Getting back to the theme beyond  philosophical implications

With glitch art we often work in ways that turn the idea of control on its head, if control means retaining everything including physical objects , all the information, all the detail if anything glitch art reflects the idea that loss is an integral part of existence and to try and hold on to anything is a losing game – digital art exists in an inherently fragile ecosystem – without power it doesn't exist , or rather it does but as the inaccessible content of hard-drives or remote servers – without power it cannot be seen without networks it cannot propagate . I make work which realistically will sooner or later disappear and probably more completely than previous generations of artists work.

We may be one of the first generations of artists in recent history to leave no trace of our work other than the physical and broken devices on which they were made and an oral history of practices which gets lost or changed over time. Therefore it is of primary importance that we both archive our work individually and collectively ( to take control of those processes) and also to record an oral history of practices and timelines and to have control of that process as well – asking the traditional art establishment to critique, write about, or show glitch art or digital art in general risks at the very least misunderstanding or at worst misrepresentation and caricature. We must also control the narrative around what we do.

Control the means of production

Control the means of digital production , understand your tools , maintain your hardware become good at managing your files , don’t rely on big tech to keep a record of your work fight the scourge of bit rot and dead links, record our shared history.

I neither use or endorse Apple products. No proprietary  or Apple hardware/software was used in the preparation of this talk, which was written on completely libre operating systems ( Trisquel, Gnuinos and PureOS) and partially written on a libre-booted Dell Latitude E6400.
CC BY-NC-SA 4.0










 




 
 


Saturday, 2 December 2023

Multigifatron - make gifs from single files and videos from those gifs

 Multigifatron - make gifs from single files and videos from those gifs


* if using windows and git bash you will need to add magick to begining of imagemagick commands like convert or mogrify you will need to install imagemagick and ffmpeg to use webscraping via lynx you will have to install lynx on linux on windows you will have to download lynx and place it into the git bash /usr/bin folder

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
mkdir $h/work
mkdir $h/originals
p=$(date +%Y-%m-%d_%H%M%S)
mkdir $p
mkdir $h/discard
echo -n "Grab images from website (y/n) ? : "
read yn
# If yes then grab images from specified website if no carry on to next section
if [ $yn == "n" ] || [ $yn == "null" ]
          then   
          echo -n "Source image format ? : "
          read f
          echo -n "Image format to use  ? : "
          read t      
          z=$(ls *.$f | wc -l)
          echo $z         
           elif [ $yn == "y" ]
           then
           mkdir scraped_images
            cd $h/scraped_images
            echo -n "Url to grab ? : "
            read url
             echo -n "Image format to transcode to ( Downloaded images in jpg) ? : "
            read t
             
              for i in `lynx -image_links -dump $url | grep 'jpg' \
| grep http | awk '{print $2}'`; do wget $i; done
#remove nonstandard characters
find . -maxdepth 1 -name '*' |while read filename; do echo ${filename}; mv ${filename} ${RANDOM}.jpg; done
mv *.jpg $h/
cd $h/
z=$(ls *.jpg | wc -l)
echo $z     
            fi
cp *.$f $h/originals/       
echo -n "colourize ? (y/n) : "
read cz
if [ $cz == "y" ] || [ $cz == "null" ]
then
echo -n "Color depth ? : "
read c
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename};
mv ${filename} test.$f
convert +dither -posterize $c test.$f ${filename};
rm test.$f
done
elif [ $cz == "n" ]
           then
           echo -n "Not colorizing"
           fi       

echo -n "How many iterations per image (whole number) : "
read ng

#get required width and height
echo -n "Width ? : "
read gw
echo -n "height ? : "
read gh
echo -n "Randomise images (y/n) ? : "
read yn
#mogrify to desired width and height
find . -maxdepth 1  -type f -name '*.'$f''|while read filename; do echo ${filename};
convert -resize "$gw"x"$gh"\! ${filename} test.$f
mv test.$f ${filename};done
#randomise if yes to randomise
if [ $yn == "y" ] || [ $yn == "null" ]
          then  
          echo -n "Randomising "
              find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; mv ${filename} ${RANDOM}.$f; done       
              elif [ $yn == "n" ]
            then
           echo -n "Not randomising "
              #sleep 1
            fi
#loop over images and do stuff to them below here

find . -maxdepth 1 -type f -name '*.'$f''|while read filename; do echo ${filename} ;
convert ${filename} $h/work/test.$t
mv ${filename} $h/originals/

cd $h/work/

i=0
while [ $i -lt $ng ]
do
    ((i++))

 #get header
  #sed '2,$d' test.$t > head.$t;

#strip header ( to avoid damaging it)
  #sed '1d'  test.$t > swap.$t
 from=$(openssl rand -hex 1)
  to=$(openssl rand -hex 2)
sed 's/\x'$from'/\x'$to'\xDA/g' test.$t > help.$t
#xxd -p swap.$t | sed 's/'$from'/'$to'/g' | xxd -p -r > help.$t

#put the header back
#cat head.$t help.$t> headswap.$t;

convert help.$t  ${RANDOM}.$f

rm help.$t



done
rm test.$t

#mogrify -format $f *.$t

#convert -delay 5 *.$f -morph 14  gifatron-${RANDOM}.gif
convert -delay 20 -loop 0 *.$f $h/$p/${RANDOM}.gif
#rm *.$t
mv *.$f $h/discard/
cd $h
done
cd $h/$p/
#mkdir $h/baseline
find . -type f -name '*.gif'|while read filename; do echo ${filename} ;
sleep 3


ffmpeg -nostdin -i ${filename} -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 1 ${RANDOM}.mp4


done







Saturday, 30 September 2023

Xor everything - script to use gmic displacement on multiple images

 




A script to use gmic to displace adjacent images in a folder and output into a second folder - should work on Linux and Windows ( using git-bash and downloading gmic cli and placing it in the C:\Program Files\Git\usr\bin directory) . Copy script into notepad ++ and save as file with .sh extension. It also handily resizes all images to the same size before operating the gmic function.

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
#make folder to store originals
mkdir $h/originals
mkdir $h/frames
p=$(date +%Y-%m-%d_%H%M%S)
mkdir $p
echo -n "Source image format ? : "
read f
#copy originals to $h/originals
cp *.$f $h/originals/
#randomise
echo -n "Randomise ? (y/n) : "
read rn
if [ $rn == "y" ] || [ $rn == "null" ]
          then
          find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; mv ${filename} ${RANDOM}.$f; done  
          elif [ $rn == "n" ]
           then
           echo -n "Not randomising"
           fi
                     
#get dimensions
echo -n "Landscape(l),square(s),portrait(p)? : "
read lsp
#modify to size depending lsp variable
if [ $lsp == "s" ] || [ $lsp == "null" ]
          then   
          mogrify -resize 800x800! *.$f      
             
           elif [ $lsp == "l" ]
           then
           mogrify -resize 800x600! *.$f
           elif [ $lsp == "p" ]
           then
           mogrify -resize 600x800! *.$f
          
           fi
i=$(ls *.$f | wc -l)
echo $i
while [ $i -gt 0 ]
do
#move 2 files to $h/frames with find
find . -maxdepth 1 -name '*.'$f'' | head -n 2 | xargs -d $'\n' mv -t $h/frames/

#move to frames directory
cd $h/frames/
z=1
#rename files to swap1 and swap2
find . -maxdepth 1 -type f -name '*.'$f''|while read filename; do echo ${filename};
mv ${filename} swap$z.$f
((z++));
done
gmic swap1.$f swap2.$f  -blend xor -o swap3.$f
d=$(date +%Y-%m-%d_%H%M%S)
mv swap3.$f $h/$p/$d.$f
sleep 1
rm swap1.$f
rm swap2.$f
cd $h
i=$((i-=2))
done



Tuesday, 26 September 2023

Grid and split your images.

 

With Xavier Dallet aka chan-something star


Whoppa whoppa whoppa

Ever wanted to take a series of images and make grids from them? Ever wanted to loop over the images and create ever more fractured but yet somehow consistent glitchy grids? Then this script is for you. Inspired by Xavier Dallet aka chan somethingstar and his Instagram group Baobab users  https://www.instagram.com/baobab_users/

Requires imagemagick, bash and a basic knowledge of how to run shell scripts. Linux Script below. Name it and save with .sh extension.  Modified version for  windows 10+ using git bash, after the linux version - I've tested both as working.

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
#make folder to store originals
mkdir $h/originals
mkdir $h/frames
#make folder to hold output
mkdir rotator
#get formats to use
echo -n "Source image format ? : "
read f
echo -n "Image format to use  ? : "
read t
echo -n "Discard cut in ? : "
read disin
echo -n "No to discard ? : "
read dis
#get grid dimensions
echo -n "Grid height ? : "
read gw
echo -n "Grid width ? : "
read gh
echo -n "Number of loops ? : "
read lo
echo -n "Use apple corer ? (no(n) OR /north/east/south/west/center)  : "
read ac
#calculate no of frames to move to frames gw x gh
gwgh=$(($gw * $gh))
echo $gwgh   
echo -n "Landscape(l),square(s),portrait(p)? : "
read lsp           
#copy originals to $h/originals
cp *.$f $h/originals/
#new stuff should go between here and infinite loop
#infinite loop
lp=0
while [ $lp -lt $lo ]
do
    ((lp++))
echo "Press Ctrl+C to stop..."
#count how many files we have
cd $h
i=$(ls *.$f | wc -l)
echo  $i
#convert everything to specified format or convert then randomise
#randomise yes
echo -n "Randomising "
mogrify -format $t *.$f
find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; mv ${filename} ${RANDOM}.$t; done
#crop to 1:1 4:3 or 3:4 depending on lsp before resizing details here https://stackoverflow.com/questions/21262466/imagemagick-how-to-minimally-crop-an-image-to-a-certain-aspect-ratio
if [ $lsp == "s" ] || [ $lsp == "null" ]
          then   
          find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; convert ${filename} -gravity center -crop 1:1 swap.$t; mv swap.$t ${filename};done
          elif [ $lsp == "l" ]
           then
           find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; convert ${filename} -gravity center -crop 4:3 swap.$t; mv swap.$t ${filename};done
            elif [ $lsp == "p" ]
           then
           find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; convert ${filename} -gravity center -crop 3:4 swap.$t; mv swap.$t ${filename};done
        fi
#resize for preffered size grid
#mogrify -resize 600x600! -gravity center -extent 600x600 *.$t
#modify to size depending lsp variable
if [ $lsp == "s" ] || [ $lsp == "null" ]
          then   
          mogrify -resize 800x800! *.$t      
             
           elif [ $lsp == "l" ]
           then
           mogrify -resize 800x600! *.$t
           elif [ $lsp == "p" ]
           then
           mogrify -resize 600x800! *.$t
          
           fi


#mogrify -rotate 90 *.$t
#mogrify -flop *.$t
#loop to make montages $gwgh at a time so as not to exhaust imagemagick cache
while [ $i -gt 0 ]
do
#move gwxgh images to frames
find . -maxdepth 1 -name '*.'$t'' | head -n $gwgh | xargs -d $'\n' mv -t $h/frames/
#move to frames directory
cd $h/frames/
d=$(date +%Y-%m-%d_%H%M%S)
montage *.$t -geometry +3+3 -tile $gwx$gh $d.$t
#move output back to source folder
convert $d.$t $d.$f
mv $d.$f $h/rotator
#decrease counter by gwgh
i=$((i-="$gwgh"))
#tidy up
rm *.$t
cd $h
done
cd $h/rotator

if [ $ac == "n" ] || [ $ac == "null" ]
          then   
          mv *.$f $h       
             
           elif [ $ac == "center" ]
           then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; convert ${filename} -gravity center -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "north" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; convert ${filename} -gravity north -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "east" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; convert ${filename} -gravity east -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "south" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; convert ${filename} -gravity south -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "west" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; convert ${filename} -gravity west -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
 
 
 fi
#mirror vertically
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename};
convert ${filename} -gravity east -chop 50%x0 output.$f
convert output.$f -flop output2.$f
convert output.$f output2.$f -gravity North +append ${RANDOM}.$f
rm output.$f
rm output2.$f;
done
#mogrify -monochrome *.$f

#uncomment below to create a negative image on each alternate run
#mogrify -negate *.$f
mv *.$f $h
cd $h

# move x no of images to to new folder
new=$(ls *.$f | wc -l)
if (($new > $disin ))
then
dd=$(date +%Y-%m-%d_%H%M%S)
mkdir $h/$dd
find . -maxdepth 1 -name '*.'$f'' | head -n $dis | xargs -d $'\n' mv -t $h/$dd
fi

done

(Below is a modified version for Windows 10 running gitbash with imagemagick installed and on path)

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
#make folder to store originals
mkdir $h/originals
mkdir $h/frames
#make folder to hold output
mkdir rotator
#get formats to use
echo -n "Source image format ? : "
read f
echo -n "Image format to use  ? : "
read t
echo -n "Discard cut in ? : "
read disin
echo -n "No to discard ? : "
read dis
#get grid dimensions
echo -n "Grid height ? : "
read gw
echo -n "Grid width ? : "
read gh
echo -n "Number of loops ? : "
read lo
echo -n "Use apple corer ? (no(n) OR /north/east/south/west/center)  : "
read ac
#calculate no of frames to move to frames gw x gh
gwgh=$(($gw * $gh))
echo $gwgh   
echo -n "Landscape(l),square(s),portrait(p)? : "
read lsp           
#copy originals to $h/originals
cp *.$f $h/originals/
#new stuff should go between here and infinite loop
#infinite loop
lp=0
while [ $lp -lt $lo ]
do
    ((lp++))
echo "Press Ctrl+C to stop..."
#count how many files we have
cd $h
i=$(ls *.$f | wc -l)
echo  $i
#convert everything to specified format or convert then randomise
#randomise yes
echo -n "Randomising "
magick mogrify -format $t *.$f
find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; mv ${filename} ${RANDOM}.$t; done
#crop to 1:1 4:3 or 3:4 depending on lsp before resizing details here https://stackoverflow.com/questions/21262466/imagemagick-how-to-minimally-crop-an-image-to-a-certain-aspect-ratio
if [ $lsp == "s" ] || [ $lsp == "null" ]
          then   
          find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; magick convert ${filename} -gravity center -crop 1:1 swap.$t; mv swap.$t ${filename};done
          elif [ $lsp == "l" ]
           then
           find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; magick convert ${filename} -gravity center -crop 4:3 swap.$t; mv swap.$t ${filename};done
            elif [ $lsp == "p" ]
           then
           find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; magick convert ${filename} -gravity center -crop 3:4 swap.$t; mv swap.$t ${filename};done
        fi
#resize for preffered size grid
#mogrify -resize 600x600! -gravity center -extent 600x600 *.$t
#modify to size depending lsp variable
if [ $lsp == "s" ] || [ $lsp == "null" ]
          then   
          magick mogrify -resize 800x800! *.$t      
             
           elif [ $lsp == "l" ]
           then
           magick mogrify -resize 800x600! *.$t
           elif [ $lsp == "p" ]
           then
           magick mogrify -resize 600x800! *.$t
          
           fi


#magick mogrify -rotate 90 *.$t
#magick mogrify -flop *.$t
#loop to make montages $gwgh at a time so as not to exhaust imagemagick cache
while [ $i -gt 0 ]
do
#move gwxgh images to frames
find . -maxdepth 1 -name '*.'$t'' | head -n $gwgh | xargs -d $'\n' mv -t $h/frames/
#move to frames directory
cd $h/frames/
d=$(date +%Y-%m-%d_%H%M%S)
magick montage *.$t -geometry +3+3 -tile $gwx$gh $d.$t
#move output back to source folder
magick convert $d.$t $d.$f
mv $d.$f $h/rotator
#decrease counter by gwgh
i=$((i-="$gwgh"))
#tidy up
rm *.$t
cd $h
done
cd $h/rotator

if [ $ac == "n" ] || [ $ac == "null" ]
          then   
          mv *.$f $h       
             
           elif [ $ac == "center" ]
           then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; magick convert ${filename} -gravity center -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "north" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; magick convert ${filename} -gravity north -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "east" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; magick convert ${filename} -gravity east -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "south" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; magick convert ${filename} -gravity south -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "west" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; magick convert ${filename} -gravity west -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
 
 
 fi
#mirror vertically
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename};
magick convert ${filename} -gravity east -chop 50%x0 output.$f
magick convert output.$f -flop output2.$f
magick convert output.$f output2.$f -gravity North +append ${RANDOM}.$f
rm output.$f
rm output2.$f;
done
#magick mogrify -monochrome *.$f
magick mogrify -negate *.$f
mv *.$f $h
cd $h

# move x no of images to to new folder
new=$(ls *.$f | wc -l)
if (($new > $disin ))
then
dd=$(date +%Y-%m-%d_%H%M%S)
mkdir $h/$dd
find . -maxdepth 1 -name '*.'$f'' | head -n $dis | xargs -d $'\n' mv -t $h/$dd
fi

done







Monday, 3 July 2023

Gmic and sox script redux.




 I started using Windows 10 again recently (22h2 with all relevant updates) because I'm doing more online stuff again with Format C and pragmatically when talking to  people who are trying to learn glitch art  techniques for the first time most will be using windows ( mac os people you are on your own I just cant be bothered ), I needed to relearn stuff myself so fresh install of Windows 10 , deal with the usual frustrations and on I go.

 Sooooo long story short I discovered that having used gmic cli in Windows 10 previously , installing it via chocolatey so it was available for use via scripts in git-bash that that option was no longer there , no gmic in chocolatey ( to avoid messing around with path) and worse the gmic add on for gimp was now being identified by windows security as a pup plus the cli version I wanted to use couldnt be added to path or even function within git-bash - oh yea I could use cmd , but who wants to go back to the dark ages of dos cli ( unless im using dos but thats a different post altogether - freedos rocks) 

So whats the solution, and I have to admit this post is mainly for me when I next have to use windows 10 ( god I really hope not - its illogical and ridiculous - where is everything stored why cant I use techniques i use on linux in windows the ridiculous cr lf v's lf - why arent we using utf 8 ? why why why - but I digress) 

The solution is simple , download the gmic cli zip file for windows 10, unzip it then go into the folder copy everything then paste all of that into the git bash folder at C:\Program Files\Git\usr\bin , which then allows me to use this shiny new script which is a work in progress so use at your own risk ( oh yes you need to install sox portable via chocolatey for it to work)- what does it do - it sonifies images and optionally applies a gmic xor blend to your images if you want - it can apply sonification or not ( the none option) and gmic or not - the y/n option or neither !! Its a work in progress so if you enter wrong values it prolly wont work as intended - I may or may  not add more features . Inspired by Vedran Gligo's Megaglitchatron script ( find that here - https://gitlab.com/hacklab01/MegaGlitchATron) copy it and post it into notepad++ or similar  save it as whatever name you want to give it with the .sh extension then run it as 'bash whateveryounameit.sh' via git-bash :

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
mkdir $h/frames
mkdir $h/originals
#get input formats
echo -n "Source image format ? : "
read f
#get destination format
echo -n "Image format to use ? : "
read t
#get effect
echo -n "Effect to use ? : "
read fx
#are we using gmic ( after downloading gmic cli zip and placing that in  C:\Program Files\Git\usr\bin )
echo -n "Use gmic y/n ? : "
read yn
cp *.$f $h/originals

find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename};
#get date to rename file
d=$(date +%Y-%m-%d_%H%M%S)

mv ${filename} test.$f
magick mogrify -format $t test.$f
#rm test.$f
#strip header section for windows
#get header
  head -n 3 test.$t > head.$t;
#strip header ( to avoid damaging it)
  sed -b '1d'  test.$t > swap.$t
 
  #copy that to raw file so we can use sox
cp swap.$t frame.raw
 
#apply effect specified by fx variable
 if [ $fx == "echo" ] || [ $fx == "null" ]
          then
           effect="echos 0.8 0.7 700 0.25 900 0.3 norm"
        elif [ $fx == "reverb" ]
          then
           effect="gain -3 pad 2 8 reverb"
        elif [ $fx == "hilbert" ]
          then
           effect="hilbert -n 5001"
        elif [ $fx == "phaser" ]
          then
           effect="phaser 0.8 0.74 3 0.7 0.5"
        elif [ $fx == "flanger" ]
          then
           effect="flanger 0 2 0 71 0.5 25 lin"
        elif [ $fx == "overdrive" ]
          then
           effect="overdrive 17"   
        elif [ $fx == "none" ]
          then
           effect=""
        fi
#add the effect

sox -r 482170 -e u-law frame.raw frame2.raw $effect
    #try or add these
    #"bass 5"
    #"echo 0.8 0.88 60 0.4"
    #"flanger 0 2 0 71 0.5 25 lin"
    #"hilbert -n 5001"
    #"loudness 6"
    #"norm 90"
    #"overdrive 17"
    #"phaser 0.8 0.74 3 0.7 0.5"
    #"phaser 0.8 0.74 3 0.4 0.5"
    #"pitch 2"
    #"riaa"
    #"sinc 20-4k"
    #"vol 10"

cp frame2.raw swap.$t;
cat head.$t swap.$t > test.$t;

if [ $yn == "n" ] || [ $yn == "null" ]
          then
              magick convert test.$t  $h/frames/$d.$f
           elif [ $yn == "y" ]
          then
            gmic test.$f  test.$t -blend xor -o $h/frames/$d.$f;
        rm test.$f
        fi
#if using displacement comment out line below
#cat head.$t swap.$t > test.$t;
#magick convert test.$t  $h/frames/$d.$f
#mv test.$t $h/frames/$d.$t

rm head.$t
rm test.$f
rm test.$t
rm swap.$t
rm frame.raw
rm frame2.raw

done




 


Saturday, 3 June 2023

3gifomaticwin.sh

 This is a script for windows ( using git-bash terminal and with imagemagick installed) to glitch images in batches of 3 and then makes those images into a single gif - it  copies the original source files into a folder called originals to keep them safe, then moves each batch of three files into the frames folder , glitches them then creates a gif from them then dletes the original images - it does this until images in directory where script is running from are gone !! A work in progress use at your peril .

 

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
mkdir $h/frames
mkdir $h/originals
echo -n "Source image format ? : "
read f
cp *.$f $h/originals/
i=$(ls *.$f | wc -l)

echo $i
echo -n "Image format to use  ? : "
read t
#for loop should go here

while [ $i -gt 0 ]
do
d=$(date +%Y-%m-%d_%H%M%S)
#move three files to $h/frames with find
find . -maxdepth 1 -name '*.'$f'' | head -n 3 | xargs -d $'\n' mv -t $h/frames/
cd $h/frames/

 
magick mogrify -format $t *.$f
find . -type f -name '*.'$t''|while read filename; do echo ${filename};
#do the random number thing
 #generate no from 1 to 16
sugar1=$(( $RANDOM % 16 + 1 ))
sugar3=$(( $RANDOM % 16 + 1 ))
sugar2=$(( $RANDOM % 16 + 2 ))
sugar4=$(( $RANDOM % 16 + 2 ))
#convert to hex
from=$(printf '%x\n' $sugar1)
to=$(printf '%x\n' $sugar2)
from2=$(printf '%x\n' $sugar3)
to2=$(printf '%x\n' $sugar4)

magick convert -resize 640x640\! ${filename} test.$t
xxd -p test.$t| sed -b '5,$s/'"$from""$from2"/"$to""$to2"'/g' | xxd -p -r > ${filename};
done
magick convert -delay 20 -loop 0 *.$t $d.gif
rm *.$f
rm *.$t
cd $h
i=$((i-=3))
#cd $h/frames/
done




Thursday, 11 May 2023

Burner - video and scripts

 

(*Note these scripts were created using before recent changes to ffmpeg's syntax ie -s now becomes -video_size, -pix_fmt becomes -pixel_format)

 Two ffplay windows generating feedback via two cli scripts plus an extra script to keep the mouse pointer present. 


First script is simpleish - 

ffplay -f x11grab -follow_mouse centered -framerate 23 -vf "rotate=-1.23" -vf vflip -video_size 640x640 -i :0.0
 

Second script is slightly more complex - 

ffmpeg -f x11grab -follow_mouse centered -framerate 23 -video_size 640x640 -i :0.0 -f x11grab -follow_mouse centered -framerate 23 -video_size 640x640 -i :0.0 -lavfi '[1]split[x][y],[0][x][y]displace' -f rawvideo -pix_fmt yuv420p - | ffplay -f rawvideo -pix_fmt yuv420p -vf "rotate=1.23" -s 640x640 -


The most complex script is the one to focus the mouse and keep it awake and move it slightly every so often - run as a bash script from the command line -

echo "Press CTRL+C to stop…"
sleep 10
eval $(xdotool getmouselocation --shell)
echo $X,$Y
while :
do

xdotool mousemove $X $Y
sleep 5
xdotool mousemove_relative -- 0 -5
sleep 2
xdotool mousemove_relative -- 5 -5
sleep 2
xdotool mousemove_relative 0 5
sleep 2
xdotool mousemove_relative -- -5 5

#list for user change of mouse position

xdotool click 5
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
eval $(xdotool getmouselocation --shell)
echo $X,$Y
fi
done


For topicality here is a chatgpt explanation of the second ffmpeg script.I originally fed the script in and asked it to suggest or add different filters and it just regurgitated the original script I'd just asked it to add too, but the explanation is pretty spot on I do love stochastic parrots). Maybe bard will do a better job!!

'Here's a breakdown of the filters used in this script:

    Input: -f x11grab -follow_mouse centered -framerate 23 -video_size 640x640 -i :0.0
    This sets up the first x11grab input for capturing the screen at a framerate of 23, with a video size of 640x640 pixels. The follow_mouse centered option captures the region around the mouse cursor and centers it in the output.

    Input: -f x11grab -follow_mouse centered -framerate 23 -video_size 640x640 -i :0.0
    This sets up the second x11grab input, similar to the first one.

    Filter: -lavfi '[1]split[x][y];[0][x][y]displace'
    This filter splits the second input into two streams ([x][y]) and performs the displace filter on the first input using the two streams. The split filter is used to duplicate the second input stream, so it can be used in both the [x] and [y] parts of the displace filter.

    Filter: -vf "rotate=1.23"
    This filter applies a rotation transformation to the video frames. The 1.23 value represents the rotation angle in radians.

    Output: -f rawvideo -pix_fmt yuv420p -
    This sets up the output format as raw video with YUV420 pixel format and pipes it to the next command.

    Player: | ffplay -f rawvideo -pix_fmt yuv420p -s 640x640 -
    This pipes the raw video output to ffplay for playback. The -s 640x640 option specifies the output display size as 640x640 pixels.

Feel free to adjust the parameters or add more filters as per your requirements.


I've also experimented with using the mandelbrot filter in place of one of the x11grab inputs ie replacing this -f x11grab -follow_mouse centered -framerate 23 -video_size 640x640 -i :0.0 with this -f lavfi -i mandelbrot=s=640x640 -framerate 23 which will give me this :

 


so there is a lot of room for variation and exploration within this space.



So ya gotta shiny new mac and want to run linux scripts?

 So, you've sold your soul to the devil and bought a shiny new or second hand ( in my case ) mac book pro ( with the shiny new apple sil...