Commit 3946f652 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

ffmpeg

parent e3bb2065
......@@ -6,20 +6,32 @@ import os.path
import xml.etree.ElementTree as ET
from pathlib import Path
import ffmpeg
from reportlab.graphics import renderPM
from svglib.svglib import svg2rlg
from download_bbb import parser
def process_shapes(meeting):
"""Extract images from shapes.svg"""
vids = []
for child in ET.parse(f'data/{meeting}/shapes.svg').getroot():
if child.attrib['class'] != 'slide':
continue
attrs = {key: val for key, val in child.attrib.items() if key != 'style'}
svg = ET.Element('svg', {'xmlns': 'http://www.w3.org/2000/svg'})
ET.SubElement(svg, 'image', attrs)
with open(f'data/{meeting}/{child.attrib["id"]}.svg', 'wb') as fileh:
fname = f'data/{meeting}/{child.attrib["id"]}.svg'
with open(fname, 'wb') as fileh:
for line in ET.tostringlist(svg):
fileh.write(line)
drawing = svg2rlg(fname)
fname = fname.replace('svg', 'png')
renderPM.drawToFile(drawing, fname, fmt="PNG")
vid_in = ffmpeg.input(fname)
fname = fname.replace('png', 'mp4')
ffmpeg.output(vid_in, fname, f='mp4', vcodec='libx264', pix_fmt='yuv420p', profile='baseline', level=3)
def main():
......
[[package]]
category = "dev"
description = "Disable App Nap on OS X 10.9"
marker = "sys_platform == \"darwin\""
name = "appnope"
version = "0.1.0"
description = "Disable App Nap on OS X 10.9"
category = "dev"
optional = false
python-versions = "*"
version = "0.1.0"
marker = "sys_platform == \"darwin\""
[[package]]
category = "dev"
description = "Specifications for callback functions passed in to an API"
name = "backcall"
version = "0.2.0"
description = "Specifications for callback functions passed in to an API"
category = "dev"
optional = false
python-versions = "*"
version = "0.2.0"
[[package]]
category = "main"
description = "Screen-scraping library"
name = "beautifulsoup4"
version = "4.9.1"
description = "Screen-scraping library"
category = "main"
optional = false
python-versions = "*"
version = "4.9.1"
[package.dependencies]
soupsieve = [">1.2", "<2.0"]
[package.extras]
html5lib = ["html5lib"]
lxml = ["lxml"]
[package.dependencies]
soupsieve = [">1.2", "<2.0"]
[[package]]
category = "main"
description = "Dummy package for Beautiful Soup"
name = "bs4"
version = "0.0.1"
description = "Dummy package for Beautiful Soup"
category = "main"
optional = false
python-versions = "*"
version = "0.0.1"
[package.dependencies]
beautifulsoup4 = "*"
[[package]]
category = "main"
description = "Python package for providing Mozilla's CA Bundle."
name = "certifi"
version = "2020.6.20"
description = "Python package for providing Mozilla's CA Bundle."
category = "main"
optional = false
python-versions = "*"
version = "2020.6.20"
[[package]]
category = "main"
description = "Universal encoding detector for Python 2 and 3"
name = "chardet"
version = "3.0.4"
description = "Universal encoding detector for Python 2 and 3"
category = "main"
optional = false
python-versions = "*"
version = "3.0.4"
[[package]]
category = "dev"
description = "Cross-platform colored terminal text."
marker = "sys_platform == \"win32\""
name = "colorama"
version = "0.4.3"
description = "Cross-platform colored terminal text."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "0.4.3"
marker = "sys_platform == \"win32\""
[[package]]
category = "main"
description = "CSS selectors for Python ElementTree"
name = "cssselect2"
version = "0.3.0"
description = "CSS selectors for Python ElementTree"
category = "main"
optional = false
python-versions = ">=3.5"
version = "0.3.0"
[package.extras]
doc = ["sphinx", "sphinx-rtd-theme"]
test = ["pytest-runner", "pytest-cov", "pytest-flake8", "pytest-isort"]
[package.dependencies]
setuptools = ">=39.2.0"
tinycss2 = "*"
webencodings = "*"
[package.extras]
doc = ["sphinx", "sphinx-rtd-theme"]
test = ["pytest-runner", "pytest-cov", "pytest-flake8", "pytest-isort"]
[[package]]
category = "dev"
description = "Decorators for Humans"
name = "decorator"
version = "4.4.2"
description = "Decorators for Humans"
category = "dev"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*"
version = "4.4.2"
[[package]]
name = "ffmpeg-python"
version = "0.2.0"
description = "Python bindings for FFmpeg - with complex filtering support"
category = "main"
description = "Internationalized Domain Names in Applications (IDNA)"
optional = false
python-versions = "*"
[package.extras]
dev = ["future (0.17.1)", "numpy (1.16.4)", "pytest-mock (1.10.4)", "pytest (4.6.1)", "Sphinx (2.1.0)", "tox (3.12.1)"]
[package.dependencies]
future = "*"
[[package]]
name = "future"
version = "0.18.2"
description = "Clean single-source support for Python 3 and 2"
category = "main"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]]
name = "idna"
version = "2.10"
description = "Internationalized Domain Names in Applications (IDNA)"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "2.10"
[[package]]
category = "dev"
description = "IPython: Productive Interactive Computing"
name = "ipython"
version = "7.16.1"
description = "IPython: Productive Interactive Computing"
category = "dev"
optional = false
python-versions = ">=3.6"
version = "7.16.1"
[package.extras]
all = ["Sphinx (>=1.3)", "ipykernel", "ipyparallel", "ipywidgets", "nbconvert", "nbformat", "nose (>=0.10.1)", "notebook", "numpy (>=1.14)", "pygments", "qtconsole", "requests", "testpath"]
doc = ["Sphinx (>=1.3)"]
kernel = ["ipykernel"]
nbconvert = ["nbconvert"]
nbformat = ["nbformat"]
notebook = ["notebook", "ipywidgets"]
parallel = ["ipyparallel"]
qtconsole = ["qtconsole"]
test = ["nose (>=0.10.1)", "requests", "testpath", "pygments", "nbformat", "ipykernel", "numpy (>=1.14)"]
[package.dependencies]
appnope = "*"
......@@ -120,47 +153,36 @@ pygments = "*"
setuptools = ">=18.5"
traitlets = ">=4.2"
[package.extras]
all = ["Sphinx (>=1.3)", "ipykernel", "ipyparallel", "ipywidgets", "nbconvert", "nbformat", "nose (>=0.10.1)", "notebook", "numpy (>=1.14)", "pygments", "qtconsole", "requests", "testpath"]
doc = ["Sphinx (>=1.3)"]
kernel = ["ipykernel"]
nbconvert = ["nbconvert"]
nbformat = ["nbformat"]
notebook = ["notebook", "ipywidgets"]
parallel = ["ipyparallel"]
qtconsole = ["qtconsole"]
test = ["nose (>=0.10.1)", "requests", "testpath", "pygments", "nbformat", "ipykernel", "numpy (>=1.14)"]
[[package]]
category = "dev"
description = "Vestigial utilities from IPython"
name = "ipython-genutils"
version = "0.2.0"
description = "Vestigial utilities from IPython"
category = "dev"
optional = false
python-versions = "*"
version = "0.2.0"
[[package]]
category = "dev"
description = "An autocompletion tool for Python that can be used for text editors."
name = "jedi"
version = "0.17.2"
description = "An autocompletion tool for Python that can be used for text editors."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "0.17.2"
[package.dependencies]
parso = ">=0.7.0,<0.8.0"
[package.extras]
qa = ["flake8 (3.7.9)"]
testing = ["Django (<3.1)", "colorama", "docopt", "pytest (>=3.9.0,<5.0.0)"]
[package.dependencies]
parso = ">=0.7.0,<0.8.0"
[[package]]
category = "main"
description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API."
name = "lxml"
version = "4.5.2"
description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, != 3.4.*"
version = "4.5.2"
[package.extras]
cssselect = ["cssselect (>=0.7)"]
......@@ -169,90 +191,94 @@ htmlsoup = ["beautifulsoup4"]
source = ["Cython (>=0.29.7)"]
[[package]]
category = "dev"
description = "A Python Parser"
name = "parso"
version = "0.7.1"
description = "A Python Parser"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "0.7.1"
[package.extras]
testing = ["docopt", "pytest (>=3.0.7)"]
[[package]]
category = "dev"
description = "Pexpect allows easy control of interactive console applications."
marker = "sys_platform != \"win32\""
name = "pexpect"
version = "4.8.0"
description = "Pexpect allows easy control of interactive console applications."
category = "dev"
optional = false
python-versions = "*"
version = "4.8.0"
marker = "sys_platform != \"win32\""
[package.dependencies]
ptyprocess = ">=0.5"
[[package]]
category = "dev"
description = "Tiny 'shelve'-like database with concurrency support"
name = "pickleshare"
version = "0.7.5"
description = "Tiny 'shelve'-like database with concurrency support"
category = "dev"
optional = false
python-versions = "*"
version = "0.7.5"
[[package]]
category = "main"
description = "Python Imaging Library (Fork)"
name = "pillow"
version = "7.2.0"
description = "Python Imaging Library (Fork)"
category = "main"
optional = false
python-versions = ">=3.5"
version = "7.2.0"
[[package]]
category = "dev"
description = "Library for building powerful interactive command lines in Python"
name = "prompt-toolkit"
version = "3.0.3"
description = "Library for building powerful interactive command lines in Python"
category = "dev"
optional = false
python-versions = ">=3.6"
version = "3.0.3"
[package.dependencies]
wcwidth = "*"
[[package]]
category = "dev"
description = "Run a subprocess in a pseudo terminal"
marker = "sys_platform != \"win32\""
name = "ptyprocess"
version = "0.6.0"
description = "Run a subprocess in a pseudo terminal"
category = "dev"
optional = false
python-versions = "*"
version = "0.6.0"
marker = "sys_platform != \"win32\""
[[package]]
category = "dev"
description = "Pygments is a syntax highlighting package written in Python."
name = "pygments"
version = "2.7.0"
description = "Pygments is a syntax highlighting package written in Python."
category = "dev"
optional = false
python-versions = ">=3.5"
version = "2.7.0"
[[package]]
category = "main"
description = "The Reportlab Toolkit"
name = "reportlab"
version = "3.5.49"
description = "The Reportlab Toolkit"
category = "main"
optional = false
python-versions = "*"
version = "3.5.49"
[package.dependencies]
pillow = ">=4.0.0"
[[package]]
category = "main"
description = "Python HTTP for Humans."
name = "requests"
version = "2.24.0"
description = "Python HTTP for Humans."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "2.24.0"
[package.extras]
security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"]
[package.dependencies]
certifi = ">=2017.4.17"
......@@ -260,33 +286,29 @@ chardet = ">=3.0.2,<4"
idna = ">=2.5,<3"
urllib3 = ">=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26"
[package.extras]
security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"]
[[package]]
category = "dev"
description = "Python 2 and 3 compatibility utilities"
name = "six"
version = "1.15.0"
description = "Python 2 and 3 compatibility utilities"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
version = "1.15.0"
[[package]]
category = "main"
description = "A modern CSS selector implementation for Beautiful Soup."
name = "soupsieve"
version = "1.9.6"
description = "A modern CSS selector implementation for Beautiful Soup."
category = "main"
optional = false
python-versions = "*"
version = "1.9.6"
[[package]]
category = "main"
description = "A pure-Python library for reading and converting SVG"
name = "svglib"
version = "1.0.1"
description = "A pure-Python library for reading and converting SVG"
category = "main"
optional = false
python-versions = ">=3"
version = "1.0.1"
[package.dependencies]
cssselect2 = ">=0.2.0"
......@@ -295,55 +317,55 @@ reportlab = "*"
tinycss2 = ">=0.6.0"
[[package]]
category = "main"
description = "Low-level CSS parser for Python"
name = "tinycss2"
version = "1.0.2"
description = "Low-level CSS parser for Python"
category = "main"
optional = false
python-versions = ">= 3.5"
version = "1.0.2"
[package.dependencies]
setuptools = ">=39.2.0"
webencodings = ">=0.4"
[package.extras]
doc = ["sphinx", "sphinx-rtd-theme"]
test = ["pytest-runner", "pytest-cov", "pytest-flake8", "pytest-isort"]
[package.dependencies]
setuptools = ">=39.2.0"
webencodings = ">=0.4"
[[package]]
category = "main"
description = "Fast, Extensible Progress Meter"
name = "tqdm"
version = "4.49.0"
description = "Fast, Extensible Progress Meter"
category = "main"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*"
version = "4.49.0"
[package.extras]
dev = ["py-make (>=0.1.0)", "twine", "argopt", "pydoc-markdown"]
[[package]]
category = "dev"
description = "Traitlets Python config system"
name = "traitlets"
version = "4.3.3"
description = "Traitlets Python config system"
category = "dev"
optional = false
python-versions = "*"
version = "4.3.3"
[package.extras]
test = ["pytest", "mock"]
[package.dependencies]
decorator = "*"
ipython-genutils = "*"
six = "*"
[package.extras]
test = ["pytest", "mock"]
[[package]]
category = "main"
description = "HTTP library with thread-safe connection pooling, file post, and more."
name = "urllib3"
version = "1.25.10"
description = "HTTP library with thread-safe connection pooling, file post, and more."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
version = "1.25.10"
[package.extras]
brotli = ["brotlipy (>=0.6.0)"]
......@@ -351,24 +373,25 @@ secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "pyOpenSSL (>=0
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"]
[[package]]
category = "dev"
description = "Measures the displayed width of unicode strings in a terminal"
name = "wcwidth"
version = "0.2.5"
description = "Measures the displayed width of unicode strings in a terminal"
category = "dev"
optional = false
python-versions = "*"
version = "0.2.5"
[[package]]
category = "main"
description = "Character encoding aliases for legacy web content"
name = "webencodings"
version = "0.5.1"
description = "Character encoding aliases for legacy web content"
category = "main"
optional = false
python-versions = "*"
version = "0.5.1"
[metadata]
content-hash = "77acde3319e7cd6b3ef1ecb821bec8d79876e05518bc735fdfbfe6a5a55de976"
lock-version = "1.0"
python-versions = "^3.6"
content-hash = "a7902be142b7f41dc9711485161bc078771df9b861754ce44dd1ad02ef14aa45"
[metadata.files]
appnope = [
......@@ -407,6 +430,13 @@ decorator = [
{file = "decorator-4.4.2-py2.py3-none-any.whl", hash = "sha256:41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760"},
{file = "decorator-4.4.2.tar.gz", hash = "sha256:e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7"},
]
ffmpeg-python = [
{file = "ffmpeg-python-0.2.0.tar.gz", hash = "sha256:65225db34627c578ef0e11c8b1eb528bb35e024752f6f10b78c011f6f64c4127"},
{file = "ffmpeg_python-0.2.0-py3-none-any.whl", hash = "sha256:ac441a0404e053f8b6a1113a77c0f452f1cfc62f6344a769475ffdc0f56c23c5"},
]
future = [
{file = "future-0.18.2.tar.gz", hash = "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"},
]
idna = [
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
{file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
......
......@@ -12,6 +12,7 @@ tqdm = "^4.49.0"
svglib = "^1.0.1"
bs4 = "^0.0.1"
beautifulsoup4 = "^4.9.1"
ffmpeg-python = "^0.2.0"
[tool.poetry.dev-dependencies]
ipython = "^7.16"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment