Editing School: CLI Image Moshing with SoX

Editing School: CLI Image Moshing with SoX

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

Now we open the file in Audacity, I’ll use the default U-Law import options and apply a reverb on seconds 2-3 with the default options.

audacity frame

Now that we have some kind of baseline, lets see if we can replicate that in SoX.

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)

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

Not exactly the same but pretty close!

Here’s a couple of seconds of that video applying the reverb effect frame-by-frame.

animation