General Utilities
Apart from Houdini, what are the most important things to a 3d artist? Animated gifs and a working bash shell of course, regardless of platform.
Gifs
Gif capture software
On Windows, use Screentogif. http://www.screentogif.com/
On Mac, Kap is nice. Kap is pretty nice. https://getkap.co/
On Linux, Alessandro Pepe suggests Peek. He's awesome, so I'd trust his word: https://www.geeksforgeeks.org/how-to-install-peek-on-linux-an-animated-gif-recorder-on-ubuntu/
ffmpeg to generate gifs
Good guide to how to avoid dithering here, which involves running ffmpeg twice; once to generate a palette, the second to generate a gif using that palette.
http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
Here's the important bits from that site in 2 lines:
ffmpeg -i invideo.mp4 -vf "palettegen" -y out_palette.png
ffmpeg -i invideo.mp4 -i out_palette.png -lavfi "paletteuse" -y out.gif
ffmpeg -i invideo.mp4 -vf "palettegen" -y out_palette.png
ffmpeg -i invideo.mp4 -i out_palette.png -lavfi "paletteuse" -y out.gif
The following examples don't do the palette trick, but show off how baroque you can get with ffmpeg to do all sorts of resizing and manipulation. This one shows how to crop:
ffmpeg -i "pyro.%04d.jpg" -lavfi "fps=50,crop=in_w:in_h-85:0:0,scale=400:-1:flags=lanczos" -y out.gif
ffmpeg -i "pyro.%04d.jpg" -lavfi "fps=50,crop=in_w:in_h-85:0:0,scale=400:-1:flags=lanczos" -y out.gif
- crop will use default width (in_h), and default height minus 85 pixels ( in_h-85), calculated from the top left corner (0,0).
- the scale command here will scale horizontally to 400 pixels, and keep the correct aspect ratio in y (because the y-axis is told to scale to -1, which is interpreted as 'keep the aspect ratio correct)
This one drops every 2nd frame:
ffmpeg -i "pyro.%04d.jpg" -lavfi "select=mod(n\,2),setpts=N/(25*TB),crop=in_w:in_h-85:0:0,scale=300:-1:flags=lanczos" -y out.gif
- select=mod(n\,2) -- every second frame, n is current frame, the \ is there to escape the comma
- setpts=N/(25*TB) -- magic command I don't quite understand, but I know that it stops it holding frames. Ie, if the previous command was mod(n,10), it would get every 10 frames, but without the setpts call each of those would be held for 10 frames, rather than only playing for 1 frame.
ffmpeg to generate super small gifs
For maximum pidgin victory (where there's an 8k limit):
ffmpeg -i input.gif -lavfi "fps=15,scale=20:-1:flags=lanczos" -y output.gif
- fps is fps, obviously
- scale=20:-1 the horizontal width is 20, the vertical will resize to suit.
Futzing with the fps and width can scrape most gifs under 8k.
Imagemagick/convert to make gifs
To my horror, I realised that my sweet 50fps mograph computationl art tumblr porn gifs were actually running at 24fps. Seems ffmpeg can't go any higher than that, despite specifying the framerate.
Had a go with convert (part of imagemagick) instead, and it lets you do 50fps in all its cpu melting glory. This command takes a sequence, resizes to 256x256 as its loading, then does a post-crop that lops off the lower 40 pixels. The delay of 2 means 2 miliseconds, ie 50fps.
convert -loop 0 -delay 2 flipbook/hexagon.*.jpg[256x256] -crop +0-40 hex2.gif
Super thorough notes on convert here:
http://www.imagemagick.org/script/command-line-processing.php#geometry
Here's another one with a few more tricks:
convert -loop 0 -delay 4 flipbook/cubesmarch.*.jpg[256x210+80+80] +repage -level 0,60% -layers OptimizeTransparency +map cubesmarch.gif
- -delay 4 4ms per frame, so 25fps
- [256x210+80+80] define a crop window of 256x210, starting 80 from the left and 80 from the top
- +repage actually do a crop (without this, it just masks out the rest of the image, which isn't very helpful)
- -level 0,60% a levels command, map the blackpoint to 0, and white point to 60%
- -layers OptimizeTransparency use transparency to try and get some savings. This brought a 1.8mb gif that was mostly white wireframes on black down to 1.4mb.
- +map generate a single optimised colour palette for the full gif, otherwise it tries to generate one per frame, which costs in file size
Video conversion
ffmpeg verbosity
add
-hide_banner
to the arguments you give to ffmpeg, it stops all that super verbose output ffmpeg likes to vomit every time it runs.
ffmpeg to generate mp4 from image sequence
The basics, old skool style.
ffmpeg -i "shot150_v06.%04d.jpg" -qscale 2 -r 10 -b 10M test.mp4
Here's a better way. I understand newer builds use libx264 by default now for mp4's, but I explicitly call it out of habit anyway. Assumes for 4 digit pad jpegs, no prefix on name:
ffmpeg -f image2 -r 24 -i folder/%04d.jpg -vcodec libx264 output.mp4
If the sequence doesn't start at frame 1, you need to specify that:
ffmpeg -f image2 -start_number 1000 -i myimages.%04d.jpg -vcodec libx264 out.mp4
ffmpeg hold first frame and last frame
I have a jpeg image sequence that runs from 0020.jpg to 0030.jpg, but I want to make a video that runs from frame 1 to frame 40. Ideally it'll hold frame 0020 for the first 20 frames, then hold 0030 for the last 10 frames. Here's a ffmpeg command to do that, using the loop filter. It also uses the drawtext command to overlay the frame number to verify its doing the right thing:
ffmpeg
-start_number 20 // first available frame of the image sequence
-framerate 24
-i %04d.jpg
-filter_complex
“loop=loop=20:size=1:start=0, // hold frame 0 for 20 frames, loop 1 time
loop=loop=10:size=1:start=31, // hold frame 31 for 10 frames, loop 1 time
drawtext=fontsize=56:fontcolor=yellow:text=‘%{n}’” // draw the frame number in the corner
out.mp4
ffmpeg screen record on linux
Yeah yeah, OBS, it's such a twitchy thing, while I've found ffmpeg super reliable:
ffmpeg -video_size 2560x1440 -framerate 30 -f x11grab -i :0.0 record.mp4
ffmpeg cropping to a window on linux
You've recorded a full screen video, but now need to crop it down to a single window. What to do? Annoyingly there's no simple GUI crop tools, but these steps under linux aren't too bad. You can query the dimensions of an applicaiton under linux with xwininfo, which you run, click a window, it returns something like:
xwininfo: Window id: 0x400001e "untitled.hip - Houdini FX Education Edition 16.5.405"
Absolute upper-left X: 320
Absolute upper-left Y: 178
...
Width: 940
Height: 660
The top-left corner and the width/height is what ffmpeg expects for its cropping tool. The syntax is width, height, left_edge, top_edge. So taking the info from above, to create a video 940 wide, 660 high, at an offset of 320 on X and 178 on Y:
ffmpeg -i my_fullscreen_video.mp4 -vf "crop=940:660:320:178" crop.mp4
ffmpeg batch convert many .mov to .mp4 with bash
probably more elegant ways, but this'll do in a pinch:
for i in *.mov; do ffmpeg -i "$i" -vcodec libx264 "${i%.mov}.mp4"; done;
via http://stackoverflow.com/questions/5784661/how-do-you-convert-an-entire-directory-with-ffmpeg
Resolve names things stupidly, so even though my timeline clips are named 01, 02, 03 etc, on export they are named '01 render 1.mov'. This uses bash variable tokenising to just get the first 2 characters and construct a new name, so the target becomes 01.mp4. The syntax is ${var:start:length}.
for i in *.mov; do ffmpeg -i "$i" -movflags faststart -vcodec libx264 -crf 20 -g 1 -pix_fmt yuv420p ${i:0:2}.mp4; done;
ffmpeg change speed
ffmpeg -i slow.mp4 -vf "setpts=0.5*PTS" fast.mp4
ffmpeg resize to power of two dimensions
mp4s need dimensions that are powers-of-twoish, this filter forces a resize to be correct:
for i in *.mov; do ffmpeg -i "$i" -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -vcodec libx264 "${i%.avi}.mp4"; done;
Unfortunately this is too hard to remember when working day to day, but I can usually remember the shorter 'scale=800:-1' version, but that'll complain about odd vertical pixel numbers.
Cheaty middle ground; just use the latter, let it error, but look at the error. It will tell you 'waaah, resolution 800x305 invalid', at which point you can just arrow up and replace
'scale=800:-1'
with
'scale=800:306'
Win!
ffmpeg clip start and end time
It's -ss [timecodestart] and -to [timecodeend]. Can also specify -c copy so ffmpeg doesn't try and do clever conversion, it just directly copies the input for speed.
This example clips out from 4m32s to 5m26s:
ffmpeg -ss 00:04:32 -i longvideo.mp4 -to 00:05:26 -c copy clip.mp4
ffmpeg make a very compatible mp4
As told by Lcrs:
ffmpeg -i prores.mov -strict -2 -pix_fmt yuv420p -profile:v main -level 3.1 -b:v 8000k out.mp4
Controlling mp4 file size with CRF
FFmpeg has a target file size flag, but all it does is encode video until it hits the target size then aborts, likely clipping your time range.
You can try and work out bitrates, multiply bits by seconds and whatnot, but I get myself in a twist convering mbits to mbytes and stuff. A lazy way is to just play with the compression quality via the -crf flag. I had a target of getting a 15 second clip to under 2mb, stackoverflow suggested crf between 20 and 30 as a good target, so tried this:
ffmpeg -i web_edit_v03.mov -c:v libx264 -crf 25 -an -lavfi "scale=800:-1:flags=lanczos" web.mp4
That got me to 1.7mb, under the target, a little overly compressed. Lower crf values generate bigger files, better quality, so tried CRF of 20:
ffmpeg -i web_edit_v03.mov -c:v libx264 -crf 20 -an -lavfi "scale=800:-1:flags=lanczos" web.mp4
That got me to 3.3mb, too big. Some trial and error got me to a CRF of 24, which got me to exactly 2.0mb:
ffmpeg -i web_edit_v03.mov -c:v libx264 -crf 24 -an -lavfi "scale=800:-1:flags=lanczos" web.mp4
Make a timelapse
A few ways, will collect here cos i keep losing the good links I find...
ffmpeg -itsscale 0.01666 -i inslow.mp4 -an outfast.mp4
That number is 1/60th of a second, so that takes a 40 min video down to 40 seconds.
The -an ensures audio is stripped, otherwise you get odd results like the video is fast by the audio runs for the original length, no good.
Alias or function to resize to 1920 x H and 30fps
Combining a few ideas from above and wrapping into a single alias, except its not an alias because bash alias can't do parameters. This is a function. I relearn this every 2 years.
Say the input video is 2422x1192. The target output is 1920xH. What's H?
It's the ratio of the height over the width, times 1920, ie in this case 1192/2422*1920. The ffmpeg video filter gives you the input dimensions as in_h and in_w, so thats easy enough, in_h/in_w*1920.
But we still face the issue of the height potentially being an odd number. To fix we'll do the trick used earlier here, and elsewhere for general quantisation stuff in vex; divide by 2, truncate, multiply by 2. So the height becomes
trunc(in_h / in_w * 1920 / 2 ) * 2
And now that wrapped into a function, so you can type ffhd foo.mov
, and it'll use bash substitution to make the output foo.mp4:
function ffhd {
ffmpeg -hide_banner -i "$1" -filter:v "scale=1920:trunc(in_h/in_w*1920/2)*2,fps=30" $(basename ${1%.*}).mp4
}
function ffhd {
ffmpeg -hide_banner -i "$1" -filter:v "scale=1920:trunc(in_h/in_w*1920/2)*2,fps=30" $(basename ${1%.*}).mp4
}
Audio
remove audio with 'an', or 'audio null' flag.
ffmpeg -i invid.mov -vcodec libx264 -an outvid.mp4
boost audio by 10 decibels (its case sensitive, so lowercase d, uppercase B):
ffmpeg -i invid.mp4 -vcodec copy -af "volume=10dB" outvid.mp4
convert to mono:
ffmpeg -i invid.mp4 -af "pan=mono|c0=.5*c0+.5*c1" -vcodec copy outvid.mp4
combine audio and video
ffmpeg -i "videoFile.mp4" -i "audioFile.mp3" -shortest outPutFile.mp4
ffmpeg quick audio removal and clip start and end
Combining ideas from above:
ffmpeg -i very_long_movie.mp4 -ss 00:22:12 -to 00:23:50 -vcodec copy -an shortclip.mp4
ffmpeg insert some silence to the start of an mp3
For some reason Soundcloud cuts off the first few hundred miliseconds of exports from Ableton. I've been shifting my Ableton tracks forward to insert a little gap, but realised its easier to do this with ffmpeg. This adds 0.2 seconds of silence, makes Soundcloud happy.
ffmpeg -f lavfi -t 0.2 -i anullsrc=channel_layout=stereo:sample_rate=44100 -i mysong.mp3 -filter_complex "[0:a][1:a]concat=n=2:v=0:a=1" mysong_sc.mp3
Alpha
Extract Alpha from input
ffmpeg -i inputrgba.mov -vf alphaextract alpha.mp4
Put RGB and alpha side by side
ffmpeg -framerate 24 -i inputrgba.mov -vf "split [a], pad=iw*2:ih [b], [a] alphaextract, [b] overlay=w" sidebyside.mp4
Output video with embedded alpha
This is very platform specific, the only high level container format that can be used to cross-encode to others like HEVC or webm is prores afaik. Don't forget that .mov suffix, I was shouting at this for ages when I realised I'd used .mp4 by mistake.
ffmpeg -i "foo.%04d.png" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444 rbga.mov
Esoterica
Remove florescent flicker
Shot some footage under florescent lighting, saw to our horror after importing the footage that it had pretty bad flicker. Ffmpeg has quite a few denoise and deflicker filters, most were either ineffectual or didn't remove this particular flicker pattern.
Then tried the 'hqdn3d' filter, magically removed 99% of the flicker! Details at https://ffmpeg.org/ffmpeg-filters.html#hqdn3d-1 , default for luma_spatial is 4, this is pushed to 16.
ffmpeg -lavfi "hqdn3d=luma_spatial=16.0" -i flickery.mp4 deflickered.mp4
h265 and samsung gearvr
Man the Gearvr is temperamental. After much fiddling and reading of The Internet, this works well:
ffmpeg -i in_4k_360.mp4 -vf "scale=3080:2160" -vcodec libx265 out_360_bt.mp4
The results are remarkable; as h264 a 4min 4k video is about 400mb, the h265 is 40mb, and looks way better. Now to play with the quality settings a little more. Its very slow to encode though, but the results feel worth it. Interestingly, I found occasionally that cross-encoding from one mp4 to a h265 mp4 can break it (feels like metadata from the original video leaks into the new one, and breaks stuff). In that case, encoding clean from a jpg sequence makes it happy again. Must look into an easier way to scrub any bad metadata from the video, see if that keeps the gearvr happy.
In a recent update, h264 videos won't play on the oculus 360 video app if they don't have an audio track (h265 is unaffected, strange). Here's how to add a null aac audio track onto an existing h264 video:
ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000 -i invideo_tb.mp4 -shortest -c:v copy -c:a aac outvideo_tb.mp4
Note that top/bottom stereo requires the _tb suffx in the name, that's how oculus video knows to unpack it into stereo.
To do quick clips for testing specificy the start timecode with -ss, and the duration with -t. Ie, this starts 30 seconds in, and runs for 10 seconds:
ffmpeg -i input.mp4 -ss 00:00:30.0 -c copy -t 00:00:10.0 output.mp4
Or if lazy, can skip timecode and just use seconds. This starts at the start, runs for 5 seconds:
ffmpeg -i input.mp4 -ss 0 -c copy -t 5 output.mp4
ffmpeg top bottom stereo pano to mono
To cut a stereo top/bottom video back into a mono 720p clip for avid and such:
ffmpeg -i in_stereo_tb.mp4 -filter:v "crop=in_w:in_h/2:0:0,scale=1280x720" -vcodec libx264 out_mono_720p.mp4
that does odd things to the pixel aspect ratio in player that understand it , adding the 'aspect' flag forces the pixels back to square:
ffmpeg -i in_stereop_tb.mp4 -aspect 2048:1024 -filter:v "crop=in_w:in_h/2:0:0,scale=2048x1024" -vcodec libx264 out_mono_2k.mp4
Combine image sequence and audio and fade and offset
ffmpeg -r 24 -i knower3d.%04d.jpg -itsoffset 0.150 -i ../knower_tt_long.mp3 -map 0:v:0 -map 1:a:0 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2,fade=type=out:duration=1:start_time=23" -af "afade=type=out:duration=1:start_time=23" -shortest tt3d5.mp4
In hindsight it would have been easier to just open Premiere, but its the principle of the thing.
Image sequences can be loaded with %04d, but by default they come in at 25fps. Specifying the rate with -r 24 was important here, as that was the framerate in Houdini.
itsoffset can be used to slip the video a little later, so the audio sync looked more correct.
The map controls basically say 'use video from the first input, and audio from the second input'.
The vf control here forces the dividable-by-two width and height that mp4 requires, and uses a fadeout command to fade to black for 1 second, starting 23 seconds in (the total sequence is 24 seconds long)
The af control does the same thing, but for audio
The shortest flag says to make the final output be as long as the shortest input, so there's not a long held frame at the end if the audio is substantially longer than the video.
Who says ffmpeg is hard to use?
Bash function to ffmpeg a gif
Put this in your .bashrc, and call it with
togif myvideo.mp4
It will drop a palettized gif in the current folder, at a maximum of 512 pixels across.
function togif {
touch /tmp/pal.png;
rm /tmp/pal.png;
ffmpeg \
-hide_banner \
-i "$1" \
-vf "palettegen" -y /tmp/pal.png;
ffmpeg \
-hide_banner \
-i "$1" \
-i /tmp/pal.png \
-lavfi "scale=512:-1:flags=lanczos,paletteuse" \
-y ${PWD}/$(basename ${1%.*}).gif
}
Rsync
sync standard command
rsync -havz source /path/to/destination
- h human readable
- a archive, recurse into folders
- v verbose
- z use compression
- n dry run, handy to test what'll happen without actually doing the sync
rsync no trailing slashes
Generally, don't put trailing slashes on source folders.
If you use
rsync -hav /path/to/source /path/to/target
It will put everything in to '/path/to/target/source'. If you use
rsync -hav /path/to/source/ /path/to/target
(not the slash after source), it will put all the contents of source directly under /path/to/target, which can get messy.
rsync compression not always the best idea
The -z option to compress on the fly will reduce bandwidth, but if you're just transferring between two local drives, or especially if you're using a low powered device like a NAS, it can actually run slower.
rsync progress bar
a handy trick when transferring big files and get a decent ETA on the command line:
rsync --progress /path/to/sourcefile /path/to/destination
OBS
Capture device audio into OBS with soundflower
Screen recordings for remote working often involves capturing sound from zoom, skype, gmeetings etc, but you also want a smooth capture of your local screen, while often the video recording stuff you get back from those systems are pretty janky.
OBS is capable of capturing sound from gmeet and whatnot, capture your screen, and mix togther. Setup is a bit painful though, and for some reason often stops working as you swap between different audio setups.
- Find and install OBS, soundflower
- Go to Audo Midi settings, create an aggrigate device
- In your general audio settings (the speaker in your OSX taskbar) set your audio device to 'multi-output'
- Conceptually now, system audio is treating 'soundflower' as a speaker, and its also made 'soundflower' as a virtual mic input.
- In audio inputs in obs, say for desktop audio, set input to 'soundflower 2ch'
- If things stop working after moving between different audio things, go back to audio midi utils, find soundflower, and double check on the output tab that the mute toggle isn't enabled (happens all the time for me for some reason)
- If you get echos in OBS, click on the geo of one of the audio devices, go 'advanced audio properties', disable 'active sources only', make sure all the options are in 'monitor off' mode.
Update: I think soundflower no longer works on apple silicon macs, or doesn't work with macs on corporate profiles, or both. Instead I bought soundsource that has a bunch of cool features too, worth it. https://rogueamoeba.com/soundsource/
Use non standard resolution for output
The video capture res for OBS is handled in settings -> Video. If you use the dropdown, there's only a handful of options. What if you want something oddball?
The answer is amusingly lowbrow; the dropdown isn't a dropdown, its also a textfield. Just type in the resolution you need as widthxheight (eg 640x480), and it'll work. I didn't bother with the downscaling stuff, I just made both the base and output resolutions the same.
Fitting big screens into the canvas
The OBS display doesn't respond to the scrollwheel or to mmb drag, how can you fit giant desktops (eg my crazy Samsung Ultrawide) into a 1920x1080 window?
The trick: spacebar.
Click once in empty space the canvas, then hold spacebar. spacebar+left drag will pan, spacebar+scrollwheel will zoom.
Finding this SUPER handy to now do quick selective cropping. Click a source, use the handles to scale it and pan it around to make sure bits you don't want to see are hidden, and now use your fancy spacebar skills to double check the corners.
Fix spaces in output
This drove me crazy, until I realised OBS has a checkbox to fix this. Doh. Settings -> Output, 'Generate File Name without Space' checkbox somewhere near the middle.
Floating webcam overlay in OBS
OBS can handle multiple sources (of course), and can put your webcam over whatever else your doing. Great in theory, but I've cursed my own stupidity more than once where I realise the webcam covered an essential part of the software I'm trying to explain. Because the webcam is only visible in the OBS window, and I'm not looking there, it's easy to miss.
Loom as a screenrecording app flared up for a while a couple of years ago. One of its simple tricks was to put your webcam in floating bubble directly on your desktop. Hard to make a mistake, you see the webcam right on the desktop, you move it when it's in the way.
I found you can use Loom with OBS, so just using the webcam bubble and nothing of the recording features. Fine, but wanted something more purpose build on Mac.
It exists, its called Hand Mirror. Does exactly what the Loom one does, simple, effective. Get it.
Ultrawide monitor
I took the plunge in 2022 and got an ultrawide monitor, the Samsung LC49RG90SEXXY (quite possibly the worst product name ever invented). There were a few requirements I had:
- I wanted to replicate my standard work setup of 2 x 21 inch monitors running 2560x1440
- It had to be really bright, I was in a very sunny office at the time
- Ideally support multiple machines connecting to it at once
- Be adjustable in height, tilt, rotation
- Not be crazy expensive.
That combo of features reduced to basically this screen. The next model up samsung ultrawide was stupid expensive using LED rather than LCD. The next model down had a vertical res of like 900 or something, too low. Most other ultrawides couldn't adjust their position, or didn't take multiple inputs, or didn't go very bright. Hence the SEXXY. (retch)
Size and weight
It's big and heavy. Like, BIG. I felt physically sick when I went to pick it up from the nearest computer store, sudden panic of buyers remorse. The box looks like its for a fridge more than a monitor. It barely fit in the car. The first couple of days you're kind of shocked/in awe/appalled by the size of the thing.
It's heavy as well, make sure your desk can handle it.
Base functions
It ticks all the boxes I wanted it to tick. Its 5120x1440, exactly 2 21 inch monitors as I wanted. It can go ridiculously bright, like 900 nits. At full strength its like looking at the Trinity tests. It has multiple inputs, I run the PC with displayport, and the mac with hdmi. It can be adjusted a reasonable amount. It didn't break the bank. All good so far.
Tricks
PBP - Switching displays is one thing, but it also has PBP, Picture by Picture. This literally splits the display into 2x21 inch displays, one source going to each. Really cool when required. You can do different splits, like half half or 1/3 and 2/3, but I usually stick with the half half.
Shortcut keys - The bright office I mentioned earlier would be glarey for an hour or so a day, but irritatingly so. There's 3 hotkeys next to the main menu button, you can dial in presets for each. So most of the time I'd be in 50% brightness (which is in itself brighter than my previous monitor could ever go), but with 1 tap I could go to max brightness, and then the third button could go to minimum brightness when trying to be discreet.
Fast USB hub - Most monitors do this, but was nice to find this one had a proper fast USB3 connector.
The curve - I wasn't sure about this before buying it, but I quite like it. Now flat screens feel weird to me.
Screenrecording is cool - For apps that can support regions, its great to be able to treat the center as a 16x9 display, and have 2 pretty big portrait zones to either side to put other windows.
Niggles
Not many, overall I'm happy with it, but some worth sharing:
Mac support is annoying - Not the monitors fault, apple being weird. I've used a intel mac with a hdmi port, and a m1 mac pro with an hdmi port. Neither would natively support the full res, so I'd need to run it in half PBP mode. I got a USB-C hub that has hdmi out, weirdly THAT works and can run the full display res. I assume a USB-C -> hdmi or displayport cable would also work, but I'm not gonna pay those crazy high street prices for a cable.
It's a little wobbly - To be fair I'm running it on a slightly wobbly floor, with a slightly wobbly standing desk, on a slightly wobbly monitor riser. But it's slightly wobbly, the sheer width of the thing, being supported at the center, means it can see-saw a bit. Not much, but again because of width, a tiny movement at the center is amplified at the edges.
Screenrecording is annoying - for apps that DON'T let you set a recording region, it's bad form to share a 5120x1440 screen over a google meet. In these cases the laptop is handy cos I'll just share that screen instead, or I'll lower the monitor res to regular 1920x1080, and it'll nicely center crop for me.
PBP keeps getting the order wrong I have my mac laptop on the left of my desk, so I naturally want the mac to connect to the right of the monitor to they're together. No. It always sends that display to the left, and I have do a little towers of hanoi dance to flip the screen order around. It never remembers, it's vaguely annoying.
Handy things
On windows, get powertoys and enable fancyzones. It lets you define regions to snap windows to, so I can put stuff in that center 16x9 bit really easily.
On OSX I use Rectangle, this lets you assign zones as well as shortcuts to move windows around to predefined locations. handy to go cmd-shift-left for the left third, cmd-shift-right for the right third, and cmd-shift-up for center.
Shells
Getting a shell under windows
Git bash is quick and simple, not as bloaty as cygwin, comes with all the major things you need (less vim cat curl git clone etc...)
Get a decent terminal by replacing cmd.exe with ConEmu
Bash is bash, and it runs within cmd.exe by default, the windows DOS shell. Use it for more than 30 seconds, you'll find cmd.exe is horrible. Can't resize it easily, copy paste is weird, ugh. ConEmu is a free cmd.exe replacement, much nicer. Tabs, resizable, better copy/paste etc.
Instructions for getting a 'conemu git bash here' context menu on folders can be found here:
http://superuser.com/questions/454380/git-bash-here-in-conemu
My shell muscle memory always kicks in when I try to copy paste, on linux most shells allow you to double left-click to copy a word, triple left-click copies a line, middle click pastes. You can do this in conemu, in the prefs (win-alt-p), mark/copy, set the text selection mode to 'always'.
Python and git bash
Just install regular python, and append its path to your .bashrc:
PATH=$PATH:/c/python27
export PATH
The best bash prompt ever
Don't question this, it just is. current directory in green, newline, prompt. Stick this in your .bashrc:
export PS1="
$$\e[32m$$\w
$$\e[m$$\\n\$ "
Looks like this (I pixellated the project path, but shows that the path is nice and easy to see and copy)
I never thought to look before, but now there's loads of interactive bash prompt builders online. Eg:
- http://www.kirsle.net/wizards/ps1.html
- http://ezprompt.net/
- https://www.google.com.au/search?q=bash+ps1+generator
Bash up arrow to search history
Put this in your .inputrc:
"\e[A": history-search-backward
"\e[B": history-search-forward
and this in your .bashrc:
set show-all-if-ambiguous on
set completion-ignore-case on
Now you can type 'cd', hit up arrow, and browse through the history of every time you typed cd.
From https://coderwall.com/p/oqtj8w/the-single-most-useful-thing-in-bash
Alias to set the terminal title
Well, function actually. From https://superuser.com/questions/84710/window-title-in-bash
function t {
PROMPT_COMMAND="echo -ne \"\033]0;$1\007\""
}
Make djv work with git bash
Again, just add the path, make an alias (I use rv cos old habits die hard)
PATH=$PATH:/c/python27:"/C/Program Files/djv-0.8.3-pre2_winxp-x64/bin"
export PATH
alias rv=djv_view.exe
There's still problems with calling it, you can't just do 'rv .' (it doesn't launch anything), and definitely not 'rv *' (it launches a separate djv for each image!). I suspect the * is interpreted by bash, so it just launches everything, while using hashes goes straight to djv. This works:
rv myimages.####.exr
Get a seqls/lseq/lss equivalent with pyseq
Pyseq is a python module that handles sequence listing, comes with a callable 'lss' command. Download it with git, install it, copy lss to your ~/bin folder
git clone
git://github.com/rsgalloway/pyseq.git
pyseq
cd pyseq/
ls
python setup.py install
mkdir ~/bin
cp lss ~/bin
You get this after all that hard work:
$ lss
1 .DS_Store
1 Thumbs.db
1 _tmpuntitled.png
150 shot150_v03.%04d.jpg 1-150
2 shot150_v%02d 6-7
1 tmp
Alias to run latest houdini
If you're like me and keep lots of daily builds around, its handy to have a shortcut to just load the latest. So if you have 18.5.499, 18.5.502, 18.5.588, you can type 'hou185' in a shell and it'll launch 18.5.588.
For OSX:
alias hou185='cd $(ls -td /Applications/Houdini/Houdini18.5* | head -1)/Frameworks/Houdini.framework/Versions/Current/Resources; source ./houdini_setup; cd -;houdini'
And the same for windows bash (specifically WSL Ubuntu bash, but should work in other bash's, adjust the path to taste)
alias hou185='cd "$(ls -td /mnt/c/Program\ Files/Side\ Effects\ Software/Houdini\ 18.5.* | head -1)"; source ./houdini_setup_bash; cd -;houdini.exe'
Quickly copy one file to a sequence with seq
There's a python version floating about on the wiki somewhere, but I caved and found a bash version too.
The seq command generates a sequence of numbers:
$ seq 1 5
1
2
3
4
5
it also lets you define formatting in the familiar %04d style, but here its g because... reasons?
$ seq -f %04g 1 5
0001
0002
0003
0004
0005
This can be sent to the bash 'for loop' as a variable, so you can rapidly copy 1 frame to many frames thus:
for i in $(seq -f "frame.%04g.png" 2 200); do cp frame.0001.png $i; done
xargs tricks with bash
Yet again, I go in with the best of intentions to write everything in clean reusable python, then when deadline panic hits I give up and shout at chatgpt to give me lazy dirty shell tricks.
You know what? There's less and less need to write these down, if there's one thing chatgpt is very good at, its these kind of hacks.
Here's the command for you future Matt. Next time dummy, ask chatgpt to write a python version.
ls /very/long/parent/paths/but/with/wildcarded_parent_folder_next/*/and/then/render.jpg | head -n 20 | xargs -I {} sh -c 'prefix=$(echo {} | cut -d"/" -f8| cut -c2-); file=$(basename {}); cp {} "${prefix}_${file}"'
ls /very/long/parent/paths/but/with/wildcarded_parent_folder_next/*/and/then/render.jpg | head -n 20 | xargs -I {} sh -c 'prefix=$(echo {} | cut -d"/" -f8| cut -c2-); file=$(basename {}); cp {} "${prefix}_${file}"'
Vim
Cool kids use vim. People who use emacs are smelly. Sublime and VSCode are fads along with fidget spinners, rainbow suspenders and spokey-dokes.
The :norm command as a easier macro
Regex is hard, macros are often overkill. The usual vim jumpy aroundy tricks in regular mode like w to jump to next word, or f to find the next character you type are quick and simple. If only there was a way to use those jumpy aroundy tricks in a more powerful way.
Well, there is! :norm will let you enter regular vim movement commands, but execute them in batch. For example, say you wanted to delete from the start of the line to the next double quote, but on every line. That regex is a little tricky, but with norm its
:%norm df"
meaning
% : for the entire file
norm : do the following commands on every line
d : delete until the next thing you define
f" : find the next double quote, which is where the delete will run to.
that could be :%norm dW to delete the first complete word on every line, and so on. Very handy.
Text select blocks with the in and a modifiers
If your text has matching brackets, or quotes, or some kind of clear start-end syntax, you can do operations on that with the 'in' command. Typing i after most select/delete/change operations will setup the 'in' command, then you specify what the block is you're wanting to modify. Eg
di"
Will setup a delete within the double quotes.
If you want to include the delimiters themselves, use 'a', as in 'delete a block' instead of 'delete in block'.
da"
Combining with the norm command above, I had a huge list of strings separated by commas, I wanted to just visually check that there were 3 entries on each row. I figured it'd be easy to just replace the first string with a 1, second with 2, third with 3. Rather than get tied with regex commands, I just thought I'd change a doublequote**"** block to 1, then the next to 2, third to 3:
:%norm ca"1
:%norm ca"2
:%norm ca"3
I hate to think how long I would've wasted trying to regex my way out of that. 😃
Other
Find a word in lots of files of specific type
grep --include=\*.{glsl,txt} -rnw '/path/to/somewhere/' -e "pattern"
Via http://stackoverflow.com/questions/16956810/how-to-find-all-files-containing-specific-text-on-linux
Eg, someone wanted to know where the r.click menu was for the Lops Scene Graph Tree. If you open it up one of the more unique pieces of text in that menu is 'Clear Overrides on this Branch'. I figure searching the entire sidefx install for 'clear overrides' will probably find what I'm after. Open a shell, get to the top of the $HFS location, run this:
grep --include=*{py,xml} -rnw '.' -e "Clear Overrides"
Menus are usually defined in xml for Houdini, maybe in python, may as well search for both. It turns up this result:
./houdini/UsdStagePrimMenu.xml:233: ``<label>
Clear Overrides on This Branch``</label>
Hooray!
Find all hips in all subdirs and zip them
find . -type f -name "*.hip*" -print | zip hips.zip -@
Jquery
I have my reasons.
Bookmarklet to embed jquery on the current page, so you can call it from the chrome interactive console:
javascript:if(!window.jQuery||confirm('Overwrite\x20current\x20version?\x20v'+jQuery.fn.jquery))(function(d,s){s=d.createElement('script');s.src='https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.js';(d.head||d.documentElement).appendChild(s)})(document);
javascript:if(!window.jQuery||confirm('Overwrite\x20current\x20version?\x20v'+jQuery.fn.jquery))(function(d,s){s=d.createElement('script');s.src='https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.js';(d.head||d.documentElement).appendChild(s)})(document);
Good quick intro: http://jqfundamentals.com/chapter/jquery-basics
$( '#header' ); // select the element with an ID of 'header'
$( 'li' ); // select all list items on the page
$( 'ul li' ); // select list items that are in unordered lists
$( '.person' ); // select all elements with a class of 'person'
$( '#header' ); // select the element with an ID of 'header'
$( 'li' ); // select all list items on the page
$( 'ul li' ); // select list items that are in unordered lists
$( '.person' ); // select all elements with a class of 'person'
Futzing with GWT tables in jQuery:
var thumbs = $('.tableThumbsPanel')
thumbs.children;
var thumbs = $('.tableThumbsPanel')
thumbs.children;
Online shared jukebox websites
Gnome and swapping ctrl start alt opt cmd keys
Ahh cross platform fun with a shared bluetooth keyboard.
I have a Logitech MX keys that has the modifier keys labelled for both Windows and Mac. When I login to a Linux VM from the Mac however, it does an oddball reinterpretation of Mac-to-Linux, the alt key for houdiin feels weird, I keep accidentally dragging whole windows. I just want the keys to behave like windows keys. My target is this:
- osx : ctrl - opt - cmd
- windows : ctrl - start - alt
- linux : ctrl - start - alt
gnome-tweak-tool lets you fix this. Once installed (it should be available through usual package installers), I went to 'keyboard and mouse', and set overview shortcut to 'right super' (basically i keep accidentally knocking it, i don't want it at all).
More importantly, click 'additional shortcuts', open 'Alt/Win key behavior', and choose 'Alt is swapped with Win'.
Hardware
MSI GS63VR 7RG
https://www.msi.com/Laptop/GS63VR-7RG-Stealth-Pro.html#hero-overview
Haven't found any useful reviews on this laptop, had it for about a week, figured I'd blat some thoughts down.
Update Dec 6: Hmm, had it a few months now, and a little concerned about build quality. One of the USB ports has stopped working (middle left), as has the headphone jack. Getting it looked at by MSI Australia, but that's not a good sign so early in the life of this thing. I know someone else with one (hey Michela@Mod!), as far as I know her machine is running fine.
Update Dec 19: Service was actually pretty quick and hassle free. MSI Australia (in Sydney) organised a courier, and had the machine back to me in a few days. Full points. 😃
Requirements
I needed a laptop to run an Oculus Rift VR headset. When researching I could break the requirements into needs, wants, and unimportant:
Need to have:
- GPU powerful enough to drive a Rift (meaning Nvidia 960 minimum, anything extra a bonus)
- 3 regular USB ports (one for the rift, and 2 for the rift cameras)
- Native HDMI port (displayport adapters have caused issues)
Nice to have:
- 4 or more USB ports (add a mouse, game controller, 3rd camera for 360 tracking... native ports are better, usb hubs have caused issues)
- Ethernet port (downloading vr apps, builds of unreal, houdini etc on a regular basis is a chore over wifi)
- Quiet as possible (yes I know that's a crazy ask when talking about gaming laptops)
- 15 inch (13 is too small, 17 is too big)
- Not look like a stupid gaming laptop
And things that are NOT important:
- 4k screen, touchscreen
- Long battery life
- Be super crazy bleeding cutting edge performance, as long as its within the current bound of 'vr capable' that's fine
- Build quality, keyboard quality, trackpad quality etc (its mainly gonna be used for launching vr apps, so its all secondary, but nice if its at least 'ok')
Max-Q
I started looking in early June 2017, and had accepted that I wasn't going to be able to get all those things. Turns out my timing was pretty fortunate, as nvidia just announced a reference platform called 'Max-Q'. To my surprise it aligned almost perfectly with my shopping list; to make a thin, quiet, high performance laptop capable of gaming (and thus capable of VR). Asus, MSI, HP all announced they'd be shipping stuff 'soon', so I waited a little, and sure enough, out they came. The Asus was the first available, but pushed too far into 'stupid gaming laptop', so I was reluctant to get it. The HP Omen range was delayed (and also too gamey for my tastes), but the MSI looked ideal.
Design
The design is surprisingly understated (apart from their awful faux Ferrari dragon badge), and build quality pretty good. It sits between the 2011 macbook pro (before they went to the unibody design), the modern macbooks, and a lenovo thinkpad. My reference point for everything I didn't want is the Alienware 17 I had got about 6 months earlier; huge, cheap looking, heavy, loud. Even looks and noise aside, the main problem with the Alienware and the Rift was insufficient ports; even running a fairly up to date external usb hub, it would drop its connection randomly, incredibly frustrating.
The MSI is a perfectly reasonable size (15.6 inches), and about half the weight and thickness of the Alienware. I can carry it in a backpack without thinking about it (could never do that with the Alienware), and when not gaming or VR-ing is a sensible quiet machine.
VR
Regarding its primary purpose, 'can it do VR?', it does that flawlessly. The model I'm running has a Nvidia 1070 in the Max-Q config; that means its about 10% slower than a desktop model, but that substantially lowers the cooling and power requirements, hence it can squeezed into this form factor. Having handled a few high-end desktop Nvidia cards, its remarkable how small and thin this laptop is. Re performance, it's fine. Robo Recall, Lone Echo, Unreal in VR edit mode, all run smoothly and happily.
Noise
Noise wise, its pretty good. It's not as quiet as a macbook or a surface pro in idle; those 2 for all intents and purposes are silent. The MSI always has a fan running, but its very quiet in idle mode; quieter than most desktops. The airconditioning in most offices would be louder than the MSI when just typing and browsing. There's a certain 'growl' to the fan noise, not objectionable in any way, but again having used silent machines for so long, and knowing that other companies have tried to replace the 'whirrrrrrr' of old cooling fans with a less objectionable white noise 'shhhhhh', I notice it, but don't mind it.
When the GPU requires cooling during a VR or game, the fans kick up into 'noticable'. Think like your car air-con on 2, but less low frequency. Annoying to your partner if they were trying to watch tv, they'd have to turn the sound up to compensate, but they wouldn't demand you leave the room. If you're wearing headphones (or in the case of the Rift, you're using the built in headphones), they easily drown out the sound of the fan. Compare that to the Alienware, which sounded like a hair dryer, loud enough that I'd miss quiet audio cues with the Rift headphones, and took to building a little book fort around the laptop to try and muffle the sound. It got so tiring (combined with the USB hub dropouts) that I actively avoided using it, which isn't great. You might've guessed I'm quite prissy when it comes to system noise, so I really appreciate how pleasant the MSI is to use.
Nice things
- You have the option to run a standard 1920x1080, non touchscreen display. Saves a few bucks if you don't need a 4k touchscreen (I don't)
- Ethernet port, so I don't need to run a usb-ethernet dongle, or suffer through wifi when getting huge oculus downloads
- Keyboard has a number pad and is nice n clicky
- Touchpad is probably the best I've used on a PC. Macbooks have got that perfect, I always found its surprising that it took PC companies so long to match it. The surface pro 4 with its keyboard+trackpad cover came close, but was still a little buggy, the MSI has no issues. 2 finger scroll, light tap vs click to select, all that stuff finally works as it should
- Very reliable with just closing and opening the lid to sleep/wake, again Macbooks mostly get this right, PC laptops mostly don't.
- Display can fold flat to the desk, handy to get it out of the way of the rift cameras
- Build quality for the most part feels great, nice brushed metal design, fairly minimal flex, and the underside is covered in a soft touch felt, mmm.
Issues
The issues I've had are fairly minor:
- Trying to de-l33t the keyboard was an amusing ride. The default backlight mode is pure red, I wanted just white. Installing the keyboard drivers pushed it into full rainbow pride mode, the software interface was the typical gaming laptop brushed steel and non intuitive wierdness. After randomly stabbing I found how to create a new preset, pushed the colours to pure white, instead I get a sort of light purple, with occasional spots of green; its like a pastel take on the Joker. It also starts pure red when woken from sleep or a hard reboot, then pops to lilac once the drivers kick in. Ah gamer laptops.
- Pc laptops can't get past their sticker fixation; a fun few hours removing intel stickers, nvidia stickers, l33t gamer tech stickers, then cleaning up all the icky residue.
- When in battery or quiet mode, occasional system stutters; most apparent when playing video. It'll play fine for 20 seconds, then do a Max Headroom glitch for half a second. Similarly when typing at speed on battery power the keyboard will similarly get stuck and glitch out, when on full power the problems mostly go away. I'm sure a driver update will fix.
- Just like the old macbooks, the metal around the ports is super thin, like the metal bit on a pen to hook it on a pocket that no-one uses. And just like those metal bits on pens, they've already warped a little after only a week. Utterly cosmetic and trivial, but each time I see it I think 'tsk'.
- The shiny 'msi' logo on the bezel beneath the display is super shiny. So shiny that it casts a specular highlight onto the base of the laptop. When typing at speed, I see a distracting warpy reflection of my fingers dancing away. Tempting to cover it with some black tape.
- The power button is on the side, right near the front right corner. Right where I keep holding the machine steady to unplug/replug cables, don't realise I'm pressing it, and power down the machine. I'm sure with time I'll learn to stop pushing that button by accident, but grrrr.
- That red badge. Jeez.
Summary
All in all, very happy. I spoke to a few people before getting this setup, most warned against the idea of 'a laptop for VR development'. All laptops that claimed to be VR ready before the Max-Q design arrived tended to be filled with compromise or issues. The G63VR does everything I need it to do, in a design that doesn't make me cringe, or require me to wear earplugs. I'd recommend it to anyone in a similar situation to me.
Oh, and yes, Houdini runs great on it. 😃
Gigabyte Aero 15X
Overview
With a new job comes a new laptop. I had identical requirements to before, so was prepped to get the same machine. Matt Ebb pointed me towards his new Aero15, I was intrigued. It seemed to cover all the same base features of the MSI (it's also a Max-Q laptop), with the added bonus of crazy battery life; promising 10 hours. What's not to like?
When systems tried to order it though, we were surprised to hear it was unavailable. Turns out the model was getting an update, and here it is; an updated CPU, a screen that runs at 144hz (vs the original 60, which apparently gamers weren't happy with), and coming soon will be an option for a 4k screen. I didn't need that, so we placed the pre-order, it arrived today.
Good features
- Understated design, feels like a modern office laptop trying to be edgy, rather than a gaming laptop trying to be muted like the MSI.
- Construction more solid than the MSI; its more rigid plastic, ports aren't likely to bend and warp like the thin metal surrounds on the MSI.
- Keyboard font is clean, MSI one was 2000s Spiderman movie font, annoying
- Keyboard backlight can go white, and it looks mostly white; MSI always had a weird pastel green/purple thing. Aero has it too, but not as much.
- Trackpad is good (same as MSI)
- Very thin screen bezel, makes overall laptop feel more svelte and thin than it really is
- Control center software is actually useful. Can set it to silent mode straight away, which indeed kills the fans 99% of the time (they occasionally kick up very quietly for 5 seconds then stop). Design is typical cheesy bad sci-fi, but it works and is unobtrusive.
- Doesn't do too many on-screen-display stuff that irritates; alienware and msi laptops constantly push big animated icons over the center of your screen to tell you the volume has changed. I know, I did that, stop annoying me.
- Default silly pulsing rainbow keyboard was easy to reset to a constant white, I remember it took me a while to find that on the MSI. Also, the keyboard stays white during a reboot, the MSI would flip to gamer red just to annoy.
- My word, the battery life.
Things better on the MSI
- The MSI is more comfortable; corners are slightly rounded, had fuzzy felt on the underside (mmm). Aero edges are a bit sharp (lots of needlessly triple bevelled/scored lines that cut into your wrists a bit)
- Key travel is higher than the msi, little harder to type, typing was quieter and more 'solid' on MSI. I'm sure I'll get used to this one though. (update: no I didn't)
- Screen can't go flat to the desk like the MSI, so can't fold it out of the way on a crowded desk
- Aero has 3 regular USB ports, MSI has 4. Means if you connect a Rift, you need to use bluetooth controllers/mouse, or get a usb hub
Bad features
<s>
The key repeat bug.</s>
Nothing! I was suffering the same random key repeat bug that many had reported online, but gigabyte just released a firmware fix, and the problem is gone.- Well, I take that back. The keyboard is bad. Having used it now for about 6 months, I've had to adjust my typing style to suit the Aero. Having used many computers and many keyboards over many years, this is the first time I've had to consciously think about how I strike keys. It needs a hard attack, certain keys in particular won't fire under regular pressure (o and . in particular), its juuuuust shy of the border of unpleasant. If i'd known a refresh of the MSI was also due within a month or two of getting the Aero, with better battery life than the first model, I would've got that instead.
Summary
Had it now for <s>
2 days</s>
6 months, was very surprised and pleased by the fast firmware update for the keyboard bug. Now with that gone, I'm mostly ok with the rest of the machine, but the keyboard is irritating. Get the updated MSI instead.