{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Video\n", "How to capture videos!\n", "\n", "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/VirtualBrainLab/urchin-examples/blob/main/basics/videos.ipynb)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Install Urchin\n", "\n", "Urchin is a Python package stored on PyPI, the following code needs to be run the first time you use Urchin in a Python environment. \n", "\n", "Urchin's full documentation can be found [on our website](https://virtualbrainlab.org/urchin/installation_and_use.html)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!pip install oursin -U" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup Urchin and open the renderer webpage \n", "\n", "By default Urchin opens the 3D renderer in a webpage. Make sure pop-ups are enabled, or the page won't open properly. You can also open the renderer site yourself by replacing [ID here] with the ID that is output by the call to `.setup()` at https://data.virtualbrainlab.org/Urchin/?ID=[ID here]\n", "\n", "Note that Urchin communicates to the renderer webpage through an internet connection, we don't currently support offline use (we hope to add support in the future)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import oursin as urchin\n", "urchin.setup()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Capturing videos\n", "Urchin's current video capture system is a bit janky, but it does work. Basically, we're just going to capture repeated screenshots over and over and tack them all together into a video.\n", "\n", "For now we only support simple animations where you rotate around a single axis." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "await urchin.camera.main.capture_video('output.mp4', start_rotation=[22.5, 22.5, 225], end_rotation=[22.5, 22.5, 0], size=(600,400))" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 2 }