Blender

From Bitpost wiki
Revision as of 05:17, 24 February 2021 by M (talk | contribs) (→‎Object Modeling)

Blender IS FUCKING LIT. But deep as hell.

Installation

It's in apt in Ubuntu:

sudo apt install blender

Configuration

To use my 3dconnexion mouse, use this driver:

[~/app] git clone https://github.com/FreeSpacenav/spacenavd.git
cd spacenavd && ./configure && make && sudo make install # to install to /usr/local

Then set up a systemd service:

cp contrib/systemd/spacenavd.service ~/config/etc/systemd/system/
setup_stow.sh
sudo systemctl enable --now spacenavd

Object Modeling

Object rotation

  • Left-click an object, numeric . to center on it
  • Use spacemouse to rotate objects - see tutorials on config, default is f8xxed
  • R key + mouse to rotate around center
  • G key + mouse to move on x-y plane

Face/edge/vertice selection

  • TAB Hit tab to toggle object/edit modes
  • 1 2 3 Once in edit mode, use 1 (vertex) 2 (edge) 3 (face) selection modes
  • Shift-click to add to selection
  • Drag rectangle to group-select
  • You can also invert-select to select all BUT what you click
  • You can also x-ray select to get occluded object vertices

Video Editing

Set up project

  • Start blender, make sure "Info" view is selected in top left Editor Type dropdown
  • Change the "screen block" (first dropdown to the right of the File-Render-Window menu in the far top-left corner) to Video Editing
  • Now you have three areas, what I'll call top-left "graph", top-right "video preview", middle "video sequence", bottom "video playback"; each has a viewbar at the bottom of the area
  • in the "graph" area, select the area type dropdown (far left) and change it to "properties"; note that strangely, the properties ares has its area type dropdown at the TOP of the area, doh
  • In the video playback (very bottom toolbar), set the End frame to give enough width to fit the videos, eg 250 > 25000 (or more)
  • In video playback (the very bottom toolbar), change the "how to sync playback" combo from [No Sync] to [AV-sync] before importing anything.
  • Once you have the first video imported, hover over the preview clip, press N, select Proxy render size 25% - you should only have to do this once

Set up Render

  • In the top-right preview window, you are viewing VSE output (looks like a filmstrip S shape)
  • Carefully change that to Properties (remembering that the fucking toolbar will POP from bottom to top of the window - you want to set it BACK to VSE when done configuring the render properties)
  • Now you can change "Render Settings"
    • Dimensions > Resolution > (default is 1920x1080, you might want 1920x1920 if you have both vertical and horizontal footage); See Add a movie, below, to use Image Offset when importing to center each one accordingly
    • Output > directory to (project)/output
    • Output > ffmpeg video, RGB
    • Encoding > Container > MPEG-4, Codec H.264
    • Encoding > Audio Codec > AAC
    • Always select a different framerate, then select the correct framerate, at least once (to avoid a bug initializing the setting)
    • (used to have Presets > MPEG-4, Codec > H.264, Audio Codec > AAC (these codecs play on iphone + android + chrome + firefox!))

Add a movie

  • In the "video sequence" area, click Add > Movie to get a file browser and pick a movie file
    • I find it easiest to drag from a project folder visible in nautilus
    • You can also change the view to list and sort to by date by using the toolbar
  • Set up smaller "proxy" videos for each video strip you import; right-click video strips to select them, select Proxy/Timecode in properties, 25%, then click rebuild proxy and timecodes - YOU HAVE TO DO THIS FOR EVERY STUPID CLIP

Rotating Zooming Panning Video

Annoyingly Blender does not use the camera metadata to rotate the video, so you often need to fix this manually. It's not too bad once you're used to the process. You have to attach a "transform" strip to the video strip you want to ... transform.

  • select the target video strip (rclick or G)
  • VSE menu one up from the bottom > Add > Effect strip > Transform
  • select it, set the rotation to whatever you need
  • You can also zoom and crop the video with this same process, it's very useful
  • There is a way to set up a "driver" for dynamic panning etc. but I'm not smart enough for that yet

You can also rotate video FIRST with ffmpeg. But I got shit results, as it always seems to decode+encode, f that. This will strip the metadata so make sure you rotate the raw video to the correct rotation:

# To simply remote metadata:
ffmpeg -i VID_20180712_202358.mp4 1_grandentry.mp4

# To rotate
# transpose=1 means CW 90 degrees
# transpose=2 means CCW 90 degrees
# Use -vf "transpose=2,transpose=2" for 180 degrees
ffmpeg -i VID_20180712_202358.mp4 -vf transpose=2 -codec:a copy -metadata:s:v:0 rotate=0 1a_grandentry.mp4

Rendering output

  • Once you want to spend time to render the final output, go to the VSE, switch to properties, and set Render > Display to New Window
  • Hit the animation button and a new window should open and start rendering.
  • If nothing happens, check the log for errors. Usually a bug shows up that says "The encoder timebase is not set". You have to select a different framerate in properties, then reselect the correct framerate, to fix the error.
  • You can also use the Info view Render menu > Render Animation.

Important keys

  • Use the scrollwheel to zoom out, and ctrl-scrollwheel to center the sequence
  • Ctrl-s to save (Or use the Info view's File menu)
  • Shift-Ctrl-s to save-as
  • A to unselect all, then B to "box select", then drag the mouse
  • On a strip...
    • press K to cut it
    • press X to delete it
    • press G to move it left/right/across tracks
  • Click in the video sequence to set the current position; press M to leave a Marker there that can be returned to using the Marker menu
  • Alt-A to play/pause