/* * title "Editing School: CLI Image Moshing with SoX" * author "Dylan Lom" * date "2022-04-17" * link stylesheet "/main.css" */ # $(echo $title) I'll start with a random frame from a video (`ffmpeg -i in.mp4 -frames:v 1 /tmp/out.bmp`), and make a simple change in Audacity to start with. ![original frame](./2022-04-17-original-frame.bmp) Now we [open the file in Audacity](http://datamoshing.com/2016/06/15/how-to-glitch-images-using-audio-editing-software/), I'll use the default `U-Law` import options and apply a reverb on seconds 2-3 with the default options. ![audacity frame](./2022-04-17-audacity-frame.bmp) Now that we have some kind of baseline, lets see if we can replicate that in [SoX](http://sox.sourceforge.net/). I played with the import options until I got a `.wav` that looked the same in Audacity as our original file, giving me this `sox -t raw -e u-law -c 2 -L -r 44100 src.bmp out.wav`. Looking at the documentation for the `reverb` effect, we have a problem, in that there is now `position`/`time` argument -- applying reverb to the whole file suprisingly doesn't break anything but doesn't replicate the effect from audacity obviously. ![sox frame (whole file)](./2022-04-17-sox-frame-whole.bmp) I couldn't figure out how to partially apply the effect in one command so I used `newfile` and just `cat`'ed the file at the end: sox -t raw -e u-law -c 2 -L -r 44100 src.bmp \ -t raw tmp-%n.bmp.part \ trim 0 2 : newfile : \ trim 0 1 reverb : newfile cat *.bmp.part > sox-frame.bmp ![final sox frame](./2022-04-17-sox-frame.bmp) Not exactly the same but pretty close! Here's a couple of seconds of that video applying the reverb effect frame-by-frame. ![animation](./2022-04-17-animation.gif)