{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "id": "JQMhqZ2CvisM" }, "outputs": [], "source": [ "# Mount Google Drive\n", "from google.colab import drive\n", "drive.mount(\"/content/drive\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "-BikYlAEvmlD" }, "outputs": [], "source": [ "# Unmount Google Drive\n", "drive.flush_and_unmount()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "id": "_lJkjDsMwHx8" }, "outputs": [], "source": [ "#@title vsd v0.3.0\n", "\n", "import shutil\n", "import os\n", "\n", "if shutil.which(\"vsd\") is None:\n", " !curl -L https://github.com/clitic/vsd/releases/download/v0.3.0/vsd-v0.3.0-x86_64-unknown-linux-musl.tar.gz | tar xz -C /usr/local/bin\n", "\n", "url = \"https://test-streams.mux.dev\" #@param {type:\"string\"}\n", "output = \"/content/downloads/test-stream.mp4\" #@param {type:\"string\"}\n", "quality = \"select-later\" #@param [\"select-later\", \"highest\", \"8k\", \"4k\", \"1440p\", \"2k\", \"1080p\", \"720p\", \"480p\", \"360p\", \"240p\", \"144p\", \"lowest\"]\n", "\n", "if not os.path.exists(\"/content/downloads\"):\n", " os.makedirs(\"/content/downloads\")\n", "\n", "!KDAM_NCOLS=40 vsd save \"{url}\" --raw-prompts -o \"{output}\" -q \"{quality}\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "id": "Ve_He_yCWVga" }, "outputs": [], "source": [ "#@title Download and preview first 30s of downloaded stream\n", "\n", "path = \"/content/downloads/test-stream.mp4\" #@param {type:\"string\"}\n", "seconds = 30 #@param {type:\"integer\"}\n", "\n", "!ffmpeg -y -hide_banner -i \"{path}\" -t $seconds -c copy /tmp/vsd-trimmed-stream.mkv 2> /dev/null\n", "\n", "from google.colab import files\n", "files.download(\"/tmp/vsd-trimmed-stream.mkv\")" ] } ], "metadata": { "colab": { "collapsed_sections": [], "name": "vsd-on-colab.ipynb", "provenance": [] }, "kernelspec": { "display_name": "Python 3.10.6 64-bit", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.10.6" }, "vscode": { "interpreter": { "hash": "b78a8d74843af7dac556e96825c923b905d97bc0fd02250c48d3fcc7fd487986" } } }, "nbformat": 4, "nbformat_minor": 0 }