Skip to content

Instantly share code, notes, and snippets.

@stuxcrystal
Last active December 22, 2018 11:54
Show Gist options
  • Save stuxcrystal/7283658d57a1563eeef2260e99c298c2 to your computer and use it in GitHub Desktop.
Save stuxcrystal/7283658d57a1563eeef2260e99c298c2 to your computer and use it in GitHub Desktop.
Here some info!
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%load_ext yuuno"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"c = core.lsmas.LWLibavSource(r\"C:\\Users\\stuxc\\Videos\\[HorribleSubs] A Place Further Than The Universe - 09 [1080p].mkv\")"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
"def frame_info(fr, pl=0):\n",
" ra = fr.get_read_array(pl)\n",
" st = fr.get_stride(pl)\n",
" pl = tuple(fr.planes())[pl]\n",
" return pl.width, st, ra.shape[1]"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<strong>Plane 0</strong>\n",
"<table>\n",
"<tr><th>Resolution</th><th>Pl. Wid.</th><th>Stride</th><th>Shape[1]</th></tr>\n",
"<tr><td>1080x1920</td><td>1920</td><td>1920</td><td>1920</td></tr>\n",
"<tr><td>1516x854</td><td>1516</td><td>1536</td><td>1516</td></tr>\n",
"</table>\n",
"<strong>Plane 1</strong>\n",
"<table>\n",
"<tr><th>Resolution</th><th>Pl. Wid.</th><th>Stride</th><th>Shape[1]</th></tr>\n",
"<tr><td>1080x1920</td><td>960</td><td>960</td><td>960</td></tr>\n",
"<tr><td>1516x854</td><td>758</td><td>768</td><td>758</td></tr>\n",
"</table>\n",
"<strong>Plane 2</strong>\n",
"<table>\n",
"<tr><th>Resolution</th><th>Pl. Wid.</th><th>Stride</th><th>Shape[1]</th></tr>\n",
"<tr><td>1080x1920</td><td>960</td><td>960</td><td>960</td></tr>\n",
"<tr><td>1516x854</td><td>758</td><td>768</td><td>758</td></tr>\n",
"</table>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import io\n",
"from IPython.display import HTML\n",
"s = io.StringIO()\n",
"for n in range(fr.format.num_planes):\n",
" print(f\"<strong>Plane {n}</strong>\", file=s)\n",
" print(\"<table>\", file=s)\n",
" print(\"<tr><th>Resolution\", \"Pl. Wid.\", \"Stride\", \"Shape[1]\", sep=\"</th><th>\", end=\"</th></tr>\\n\", file=s)\n",
" print(\"<tr><td>1080x1920\", *frame_info(c.get_frame(0), n), sep=\"</td><td>\", end=\"</td></tr>\\n\", file=s)\n",
" print(\"<tr><td>1516x854\", *frame_info(c.resize.Spline36(width=1516, height=854).get_frame(0), n), sep=\"</td><td>\", end=\"</td></tr>\\n\", file=s)\n",
" print(\"</table>\", file=s)\n",
"display(HTML(s.getvalue()))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment