Last active
July 4, 2019 14:49
-
-
Save artificialsoph/16fca07a56c7d902eda00e67ab37efea to your computer and use it in GitHub Desktop.
Revisions
-
artificialsoph revised this gist
Apr 12, 2019 . 1 changed file with 216 additions and 21 deletions.There are no files selected for viewing
-
artificialsoph revised this gist
Apr 12, 2019 . 1 changed file with 196 additions and 233 deletions.There are no files selected for viewing
-
artificialsoph revised this gist
Apr 12, 2019 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,7 +77,7 @@ "source": [ "!apt install imagemagick -q" ], "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -134,7 +134,7 @@ "!pip install youtube-dl -U\n", "!youtube-dl https://www.youtube.com/watch?v=_cz-wwxmmto -o mitski.mkv" ], "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -199,7 +199,7 @@ "\n", "clip.ipython_display()" ], "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -259,7 +259,7 @@ "source": [ "clip.duration" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", @@ -307,7 +307,7 @@ "\n", "Path(\"mitski.srt\").write_text(SRT)" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", @@ -356,7 +356,7 @@ "new_policy = orig_policy.replace('<policy domain=\"path\" rights=\"none\" pattern=\"@*\"/>', '<policy domain=\"path\" rights=\"read|write\" pattern=\"@*\"/>')\n", "policy_path.write_text(new_policy)" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", @@ -430,7 +430,7 @@ "\n", "clip_sub.ipython_display()" ], "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -491,7 +491,7 @@ "\n", "files.download(\"mitski_subtitle.mp4\")" ], "execution_count": 0, "outputs": [ { "output_type": "stream", -
artificialsoph revised this gist
Apr 12, 2019 . 1 changed file with 25 additions and 25 deletions.There are no files selected for viewing
-
artificialsoph revised this gist
Apr 12, 2019 . 1 changed file with 203 additions and 198 deletions.There are no files selected for viewing
-
artificialsoph revised this gist
Apr 10, 2019 . 1 changed file with 30 additions and 28 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,25 +32,27 @@ }, "cell_type": "markdown", "source": [ "Big shoutout to [Zuklo](https://github.com/Zulko) for this [blog post](https://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python/) that was the basis for much of this notebook.\n", "\n", "First let's start by installing a bunch of stuff!" ] }, { "metadata": { "id": "k5Yup9gOti_F", "colab_type": "code", "outputId": "035618cf-7c30-482a-afc3-0e293b9b4088", "colab": { "base_uri": "https://localhost:8080/", "height": 435 } }, "cell_type": "code", "source": [ "!pip install -U youtube-dl moviepy\n", "!apt install imagemagick" ], "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -101,11 +103,11 @@ "metadata": { "id": "B1okZpYX3DqT", "colab_type": "code", "outputId": "130513d1-282a-4c18-feea-be8decb2e46a", "colab": { "base_uri": "https://localhost:8080/", "height": 35 } }, "cell_type": "code", "source": [ @@ -116,7 +118,7 @@ "new_policy = orig_policy.replace('<policy domain=\"path\" rights=\"none\" pattern=\"@*\"/>', '<policy domain=\"path\" rights=\"read|write\" pattern=\"@*\"/>')\n", "policy_path.write_text(new_policy)" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", @@ -146,17 +148,17 @@ "metadata": { "id": "L3PeYsQgt23h", "colab_type": "code", "outputId": "e1da1bc3-dc9f-45cc-d65b-416e74fdc397", "colab": { "base_uri": "https://localhost:8080/", "height": 190 } }, "cell_type": "code", "source": [ "!youtube-dl _cz-wwxmmto -o mitski.mp4" ], "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -190,11 +192,11 @@ "metadata": { "id": "JPsLpusYuJaq", "colab_type": "code", "outputId": "9375fa2b-a655-4e09-d610-a07ff80d6bf4", "colab": { "base_uri": "https://localhost:8080/", "height": 293 } }, "cell_type": "code", "source": [ @@ -208,7 +210,7 @@ "\n", "clip.ipython_display()" ], "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -289,17 +291,17 @@ "metadata": { "id": "keRqDM0MA-Or", "colab_type": "code", "outputId": "2a71b121-7672-44f7-d77c-8eaceba3ff4c", "colab": { "base_uri": "https://localhost:8080/", "height": 35 } }, "cell_type": "code", "source": [ "clip.duration" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", @@ -319,11 +321,11 @@ "metadata": { "id": "hzq9qflyyEo4", "colab_type": "code", "outputId": "fa569d80-921e-44aa-df1c-17b6eef87ffc", "colab": { "base_uri": "https://localhost:8080/", "height": 35 } }, "cell_type": "code", "source": [ @@ -347,7 +349,7 @@ "\n", "Path(\"mitski.srt\").write_text(SRT)" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", @@ -377,11 +379,11 @@ "metadata": { "id": "RIQJ6zSPy3e9", "colab_type": "code", "outputId": "d867b2c3-4e91-464a-f3f3-3eae11796b1b", "colab": { "base_uri": "https://localhost:8080/", "height": 623 } }, "cell_type": "code", "source": [ @@ -396,7 +398,7 @@ "\n", "clip_sub.ipython_display()" ], "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -475,11 +477,11 @@ "metadata": { "id": "BtdWzstzwXaZ", "colab_type": "code", "outputId": "85ab2d20-69ac-40e0-d388-32ad132d4d94", "colab": { "base_uri": "https://localhost:8080/", "height": 138 } }, "cell_type": "code", "source": [ @@ -490,7 +492,7 @@ "\n", "files.download(\"mitski_subtitle.mp4\")" ], "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -554,18 +556,18 @@ "metadata": { "id": "d-tPwyt6FSOc", "colab_type": "code", "outputId": "5d110f7e-62af-4aed-ba21-4ffd40924ac7", "colab": { "base_uri": "https://localhost:8080/", "height": 797 } }, "cell_type": "code", "source": [ "!ffmpeg -v warning -i mitski_subtitle.mp4 -vf \"fps=15,scale=320:-1:flags=lanczos,palettegen=stats_mode=diff\" -y /tmp/palette.png\n", "!ffmpeg -i mitski_subtitle.mp4 -i /tmp/palette.png -lavfi \"fps=15,scale=320:-1:flags=lanczos,paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle\" -y mitski_subtitle.gif" ], "execution_count": 0, "outputs": [ { "output_type": "stream", -
artificialsoph revised this gist
Apr 10, 2019 . 1 changed file with 12 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,14 +6,25 @@ "name": "Gif demo", "version": "0.3.2", "provenance": [], "collapsed_sections": [], "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "<a href=\"https://colab.research.google.com/gist/artificialsoph/16fca07a56c7d902eda00e67ab37efea/gif-demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" ] }, { "metadata": { "id": "ESWiNLw4G8V9", -
artificialsoph created this gist
Apr 10, 2019 .There are no files selected for viewing