Stupid Dot Tricks #2 - Making a video

https://drive.google.com/file/d/17-NnnwejwcYTMSwQ_oixUCfsn8FUZ2wi/view?usp=sharing
Making a video from a collection of Graphviz output files is fiddly work. Many things can go wrong. I’ve found that using layers can help by pinning the nodes and edges to keep them from moving around the screen (though sometimes that is what you want).
[I am not skilled in ffmpeg, but the command below works]
Here are the (Linux shell) commands I used to create this video:

#  there is a bug in layerselect 
#  it only works for xdot, svg & postscript (?)
for n in 1 2 3 4 5 6 7 8 9 10 11 12;do L=L$n;set -x;f=unix2Layers.gv;F=`basename $f .gv`;dot -Glayerselect=$L -Tsvg $f  >${F}_$L.svg; done

#  converting these svg files to png is slow, but it works
#  convert is part of the imagemagick package
for f in unix*_L*svg;do F=`basename $f .svg`;echo $f; convert $f   $F.png;done

# make the movie (with soundtrack!)
ffmpeg -r 1/4 -i unix2Layers_L%01d.png -c:v libx264 -r 30 -pix_fmt yuv420p unix2Layers.mp4

And here is the source file:

/* Courtesy of Ian Darwin <ian@darwinsys.com>
 * and Geoff Collyer <geoff@plan9.bell-labs.com>
 * Mildly updated by Ian Darwin in 2000.
 */
digraph unix {
	size="6,6";
	layers="L1:L2:L3:L4:L5:L6:L7:L8:L9:L10:L11:L12";
	"5th Edition" [layer = "L1:L12"];
	"5th Edition" -> "6th Edition" [layer = "L2:L12"];
	"5th Edition" -> "PWB 1.0" [layer = "L2:L12"];
	"6th Edition" -> "LSX" [layer = "L3:L12"];
	"6th Edition" -> "1 BSD" [layer = "L3:L12"];
	"6th Edition" -> "Mini Unix" [layer = "L3:L12"];
	"6th Edition" -> "Wollongong" [layer = "L3:L12"];
	"6th Edition" -> "Interdata" [layer = "L3:L12"];
	"Interdata" -> "Unix/TS 3.0" [layer = "L6:L12"];
	"Interdata" -> "PWB 2.0" [layer = "L4:L12"];
	"Interdata" -> "7th Edition" [layer = "L4:L12"];
	"7th Edition" -> "8th Edition" [layer = "L9:L12"];
	"7th Edition" -> "32V" [layer = "L5:L12"];
	"7th Edition" -> "V7M" [layer = "L6:L12"];
	"7th Edition" -> "Ultrix-11" [layer = "L10:L12"];
	"7th Edition" -> "Xenix" [layer = "L5:L12"];
	"7th Edition" -> "UniPlus+" [layer = "L5:L12"];
	"V7M" -> "Ultrix-11" [layer = "L10:L12"];
	"8th Edition" -> "9th Edition" [layer = "L10:L12"];
	"9th Edition" -> "10th Edition" [layer = "L11:L12"];
	"1 BSD" -> "2 BSD" [layer = "L8:L12"];
	"2 BSD" -> "2.8 BSD" [layer = "L9:L12"]
	"2.8 BSD" -> "Ultrix-11" [layer = "L10:L12"];
	"2.8 BSD" -> "2.9 BSD" [layer = "L10:L12"];
	"32V" -> "3 BSD" [layer = "L6:L12"];
	"3 BSD" -> "4 BSD" [layer = "L7:L12"];
	"4 BSD" -> "4.1 BSD" [layer = "L8:L12"];
	"4.1 BSD" -> "4.2 BSD" [layer = "L9:L12"];
	"4.1 BSD" -> "2.8 BSD" [layer = "L9:L12"];
	"4.1 BSD" -> "8th Edition" [layer = "L9:L12"];
	"4.2 BSD" -> "4.3 BSD" [layer = "L10:L12"];
	"4.2 BSD" -> "Ultrix-32" [layer = "L10:L12"];
	"4.3 BSD" -> "4.4 BSD" [layer = "L11:L12"];
	"4.4 BSD" -> "FreeBSD" [layer = "L12"];
	"4.4 BSD" -> "NetBSD" [layer = "L12"];
	"4.4 BSD" -> "OpenBSD" [layer = "L12"];
	"PWB 1.0" -> "PWB 1.2" [layer = "L3:L12"];
	"PWB 1.0" -> "USG 1.0" [layer = "L3:L12"];
	"PWB 1.2" -> "PWB 2.0" [layer = "L4:L12"];
	"USG 1.0" -> "CB Unix 1" [layer = "L4:L12"];
	"USG 1.0" -> "USG 2.0" [layer = "L4:L12"];
	"CB Unix 1" -> "CB Unix 2" [layer = "L5:L12"];
	"CB Unix 2" -> "CB Unix 3" [layer = "L6:L12"];
	"CB Unix 3" -> "Unix/TS++" [layer = "L7:L12"];
	"CB Unix 3" -> "PDP-11 Sys V" [layer = "L7:L12"];
	"USG 2.0" -> "USG 3.0" [layer = "L5:L12"];
	"USG 3.0" -> "Unix/TS 3.0" [layer = "L6:L12"];
	"PWB 2.0" -> "Unix/TS 3.0" [layer = "L6:L12"];
	"Unix/TS 1.0" -> "Unix/TS 3.0" [layer = "L6:L12"];
	"Unix/TS 3.0" -> "TS 4.0" [layer = "L8:L12"];
	"Unix/TS++" -> "TS 4.0" [layer = "L8:L12"];
	"CB Unix 3" -> "TS 4.0" [layer = "L8:L12"];
	"TS 4.0" -> "System V.0" [layer = "L9:L12"];
	"System V.0" -> "System V.2" [layer = "L10:L12"];
	"System V.2" -> "System V.3" [layer = "L11:L12"];
	"System V.3" -> "System V.4" [layer = "L12:L12"];
}
1 Like