From b1ca173e9253a9b3a2cb6b5b4f4dba7b23961aaa Mon Sep 17 00:00:00 2001 From: Sam Lavigne Date: Thu, 31 Aug 2023 12:46:24 -0400 Subject: [PATCH] add examples --- public/examples/crop_trim.json | 305 ++++++++++++++ public/examples/grid.json | 331 +++++++++++++++ public/examples/scale_overlay.json | 649 +++++++++++++++++++++++++++++ public/examples/smooth_slow.json | 422 +++++++++++++++++++ public/examples/speedup.json | 156 +++++++ public/examples/text.json | 526 +++++++++++++++++++++++ public/examples/xfade.json | 373 +++++++++++++++++ src/App.svelte | 68 ++- src/FitComp.svelte | 13 +- src/stores.js | 1 + 10 files changed, 2825 insertions(+), 19 deletions(-) create mode 100644 public/examples/crop_trim.json create mode 100644 public/examples/grid.json create mode 100644 public/examples/scale_overlay.json create mode 100644 public/examples/smooth_slow.json create mode 100644 public/examples/speedup.json create mode 100644 public/examples/text.json create mode 100644 public/examples/xfade.json diff --git a/public/examples/crop_trim.json b/public/examples/crop_trim.json new file mode 100644 index 0000000..23a8b7b --- /dev/null +++ b/public/examples/crop_trim.json @@ -0,0 +1,305 @@ +{ + "nodes": [ + { + "id": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "type": "ffmpeg", + "data": { + "name": "punch.mp4", + "url": "/punch.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 0, + "y": 0 + }, + "positionAbsolute": { + "x": 0, + "y": 0 + }, + "width": 109, + "height": 54 + }, + { + "id": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "type": "ffmpeg", + "data": { + "name": "out.gif", + "ext": "gif", + "inputs": [ + "v" + ], + "outputs": [], + "nodeType": "output" + }, + "nodeType": "output", + "position": { + "x": 438, + "y": 0 + }, + "positionAbsolute": { + "x": 438, + "y": 0 + }, + "width": 90, + "height": 54, + "selected": false + }, + { + "id": "e8c40a7d-ed53-49db-90d6-ffc953761550", + "type": "ffmpeg", + "data": { + "id": 178, + "meta": "..C", + "name": "crop", + "type": "V->V", + "description": "Crop the input video.", + "params": [ + { + "name": "out_w", + "type": "string", + "desc": "set the width crop area expression (default \"iw\")", + "min": null, + "max": null, + "default": "iw", + "value": "iw/2" + }, + { + "name": "w", + "type": "string", + "desc": "set the width crop area expression (default \"iw\")", + "min": null, + "max": null, + "default": "iw", + "value": "iw" + }, + { + "name": "out_h", + "type": "string", + "desc": "set the height crop area expression (default \"ih\")", + "min": null, + "max": null, + "default": "ih", + "value": "ih" + }, + { + "name": "h", + "type": "string", + "desc": "set the height crop area expression (default \"ih\")", + "min": null, + "max": null, + "default": "ih", + "value": "ih" + }, + { + "name": "x", + "type": "string", + "desc": "set the x crop area expression (default \"(in_w-out_w)/2\")", + "min": null, + "max": null, + "default": "(in_w-out_w", + "value": "(in_w-out_w" + }, + { + "name": "y", + "type": "string", + "desc": "set the y crop area expression (default \"(in_h-out_h)/2\")", + "min": null, + "max": null, + "default": "(in_h-out_h", + "value": "(in_h-out_h" + }, + { + "name": "keep_aspect", + "type": "boolean", + "desc": "keep aspect ratio (default false)", + "min": null, + "max": null, + "default": "false", + "value": "false" + }, + { + "name": "exact", + "type": "boolean", + "desc": "do exact cropping (default false)", + "min": null, + "max": null, + "default": "false", + "value": "false" + } + ], + "nodeType": "filter", + "inputs": [ + "v" + ], + "outputs": [ + "v" + ] + }, + "nodeType": "filter", + "position": { + "x": 159, + "y": -50 + }, + "positionAbsolute": { + "x": 159, + "y": -50 + }, + "width": 59, + "height": 50 + }, + { + "id": "50168839-ce90-4f5b-825f-2043bea00b1b", + "type": "ffmpeg", + "data": { + "id": 391, + "meta": "...", + "name": "trim", + "type": "V->V", + "description": "Pick one continuous section from the input, drop the rest.", + "params": [ + { + "name": "start", + "type": "duration", + "desc": "Timestamp of the first frame that should be passed (default INT64_MAX)", + "min": null, + "max": null, + "default": "INT64_MAX", + "value": "1.7" + }, + { + "name": "starti", + "type": "duration", + "desc": "Timestamp of the first frame that should be passed (default INT64_MAX)", + "min": null, + "max": null, + "default": "INT64_MAX", + "value": "INT64_MAX" + }, + { + "name": "end", + "type": "duration", + "desc": "Timestamp of the first frame that should be dropped again (default INT64_MAX)", + "min": null, + "max": null, + "default": "INT64_MAX", + "value": "INT64_MAX" + }, + { + "name": "endi", + "type": "duration", + "desc": "Timestamp of the first frame that should be dropped again (default INT64_MAX)", + "min": null, + "max": null, + "default": "INT64_MAX", + "value": "INT64_MAX" + }, + { + "name": "start_pts", + "type": "int64", + "desc": "Timestamp of the first frame that should be passed (from I64_MIN to I64_MAX) (default I64_MIN)", + "min": -2000, + "max": 2000, + "default": -2000, + "value": -2000 + }, + { + "name": "end_pts", + "type": "int64", + "desc": "Timestamp of the first frame that should be dropped again (from I64_MIN to I64_MAX) (default I64_MIN)", + "min": -2000, + "max": 2000, + "default": -2000, + "value": -2000 + }, + { + "name": "duration", + "type": "duration", + "desc": "Maximum duration of the output (default 0)", + "min": null, + "max": null, + "default": "0", + "value": "0.5" + }, + { + "name": "durationi", + "type": "duration", + "desc": "Maximum duration of the output (default 0)", + "min": null, + "max": null, + "default": "0", + "value": "0" + }, + { + "name": "start_frame", + "type": "int64", + "desc": "Number of the first frame that should be passed to the output (from -1 to I64_MAX) (default -1)", + "min": -1, + "max": 2000, + "default": -1, + "value": -1 + }, + { + "name": "end_frame", + "type": "int64", + "desc": "Number of the first frame that should be dropped again (from 0 to I64_MAX) (default I64_MAX)", + "min": 0, + "max": 2000, + "default": 2000, + "value": 2000 + } + ], + "nodeType": "filter", + "inputs": [ + "v" + ], + "outputs": [ + "v" + ] + }, + "nodeType": "filter", + "position": { + "x": 268, + "y": -50 + }, + "positionAbsolute": { + "x": 268, + "y": -50 + }, + "width": 59, + "height": 50 + } + ], + "edges": [ + { + "id": "551f3ce9-cc4c-4deb-a2d0-5354ce107967", + "type": "default", + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "target": "e8c40a7d-ed53-49db-90d6-ffc953761550", + "sourceHandle": "v_0", + "targetHandle": "v_0" + }, + { + "id": "fb179506-e951-4284-816d-8a738c84551c", + "type": "default", + "source": "e8c40a7d-ed53-49db-90d6-ffc953761550", + "target": "50168839-ce90-4f5b-825f-2043bea00b1b", + "sourceHandle": "v_0", + "targetHandle": "v_0" + }, + { + "id": "465f9cbe-3352-40d0-9af5-a545e228a26b", + "type": "default", + "source": "50168839-ce90-4f5b-825f-2043bea00b1b", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "sourceHandle": "v_0", + "targetHandle": "v_0" + } + ] +} \ No newline at end of file diff --git a/public/examples/grid.json b/public/examples/grid.json new file mode 100644 index 0000000..3ba920d --- /dev/null +++ b/public/examples/grid.json @@ -0,0 +1,331 @@ +{ + "nodes": [ + { + "id": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "type": "ffmpeg", + "data": { + "name": "punch.mp4", + "url": "/punch.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 20, + "y": 0 + }, + "positionAbsolute": { + "x": 20, + "y": 0 + }, + "width": 109, + "height": 54, + "dragging": false + }, + { + "id": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "type": "ffmpeg", + "data": { + "name": "out.mp4", + "ext": "mp4", + "inputs": [ + "v", + "a" + ], + "outputs": [], + "nodeType": "output" + }, + "nodeType": "output", + "position": { + "x": 439, + "y": 0 + }, + "positionAbsolute": { + "x": 439, + "y": 0 + }, + "width": 90, + "height": 54, + "selected": false, + "dragging": false + }, + { + "id": "ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15", + "type": "ffmpeg", + "data": { + "id": 413, + "meta": ".S.", + "name": "xstack", + "type": "N->V", + "description": "Stack video inputs into custom layout.", + "params": [ + { + "name": "inputs", + "type": "int", + "desc": "set number of inputs (from 2 to INT_MAX) (default 2)", + "min": 2, + "max": 2000, + "default": 2, + "value": "4" + }, + { + "name": "layout", + "type": "string", + "desc": "set custom layout", + "min": null, + "max": null, + "default": null, + "value": null + }, + { + "name": "grid", + "type": "image_size", + "desc": "set fixed size grid layout", + "min": null, + "max": null, + "default": null, + "value": "2x2" + }, + { + "name": "shortest", + "type": "boolean", + "desc": "force termination when the shortest input terminates (default false)", + "min": null, + "max": null, + "default": "false", + "value": "true" + }, + { + "name": "fill", + "type": "string", + "desc": "set the color for unused pixels (default \"none\")", + "min": null, + "max": null, + "default": "none", + "value": "none" + } + ], + "nodeType": "filter", + "inputs": [ + "n" + ], + "outputs": [ + "v" + ] + }, + "nodeType": "filter", + "position": { + "x": 290, + "y": 20 + }, + "positionAbsolute": { + "x": 290, + "y": 20 + }, + "width": 59, + "height": 50, + "dragging": false + }, + { + "id": "19255824-255f-49cb-8dff-a28499ad3c35", + "type": "ffmpeg", + "data": { + "name": "shoe.mp4", + "url": "/shoe.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 70, + "y": -90 + }, + "positionAbsolute": { + "x": 70, + "y": -90 + }, + "width": 109, + "height": 54, + "dragging": false + }, + { + "id": "83ec354d-b262-48e3-83d3-98324e29adf7", + "type": "ffmpeg", + "data": { + "name": "shoe.mp4", + "url": "/shoe.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 160, + "y": 130 + }, + "positionAbsolute": { + "x": 160, + "y": 130 + }, + "width": 109, + "height": 54, + "dragging": false + }, + { + "id": "adbe6433-76fe-47fd-bd70-924495465942", + "type": "ffmpeg", + "data": { + "name": "punch.mp4", + "url": "/shoe.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 20, + "y": 100 + }, + "positionAbsolute": { + "x": 20, + "y": 100 + }, + "width": 109, + "height": 54, + "dragging": false, + "selected": false + } + ], + "edges": [ + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-a6796a9d-7fb6-494c-9545-bde5d4628eeav_0" + }, + { + "source": "a0798490-6c5b-4a14-82a3-a5e7da6d223b", + "sourceHandle": "v_0", + "target": "1623b321-0d2b-42a1-99af-bad37a146b07", + "targetHandle": "v_1", + "id": "xyflow__edge-a0798490-6c5b-4a14-82a3-a5e7da6d223bv_0-1623b321-0d2b-42a1-99af-bad37a146b07v_1" + }, + { + "source": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "sourceHandle": "v_0", + "target": "1623b321-0d2b-42a1-99af-bad37a146b07", + "targetHandle": "v_0", + "id": "xyflow__edge-a6796a9d-7fb6-494c-9545-bde5d4628eeav_0-1623b321-0d2b-42a1-99af-bad37a146b07v_0" + }, + { + "source": "1623b321-0d2b-42a1-99af-bad37a146b07", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-1623b321-0d2b-42a1-99af-bad37a146b07v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "66adb05a-5bf8-48f8-ac0c-0c8434191665", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-66adb05a-5bf8-48f8-ac0c-0c8434191665v_0" + }, + { + "source": "66adb05a-5bf8-48f8-ac0c-0c8434191665", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-66adb05a-5bf8-48f8-ac0c-0c8434191665v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "8dfda4cc-5985-4258-b1a0-d66bec0328d8", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-8dfda4cc-5985-4258-b1a0-d66bec0328d8v_0" + }, + { + "source": "8dfda4cc-5985-4258-b1a0-d66bec0328d8", + "sourceHandle": "v_0", + "target": "b2bd1fb9-b7ad-4c3b-9800-29748a8d8c73", + "targetHandle": "v_0", + "id": "xyflow__edge-8dfda4cc-5985-4258-b1a0-d66bec0328d8v_0-b2bd1fb9-b7ad-4c3b-9800-29748a8d8c73v_0" + }, + { + "source": "b2bd1fb9-b7ad-4c3b-9800-29748a8d8c73", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-b2bd1fb9-b7ad-4c3b-9800-29748a8d8c73v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "a_1", + "target": "78efe031-cddd-477f-b975-708746d870e8", + "targetHandle": "a_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31a_1-78efe031-cddd-477f-b975-708746d870e8a_0" + }, + { + "source": "78efe031-cddd-477f-b975-708746d870e8", + "sourceHandle": "a_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "a_1", + "id": "xyflow__edge-78efe031-cddd-477f-b975-708746d870e8a_0-eb32733d-28ad-4a38-9db7-50a98db5f309a_1" + }, + { + "source": "19255824-255f-49cb-8dff-a28499ad3c35", + "sourceHandle": "v_0", + "target": "ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15", + "targetHandle": "n_0", + "id": "xyflow__edge-19255824-255f-49cb-8dff-a28499ad3c35v_0-ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15n_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15", + "targetHandle": "n_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15n_0" + }, + { + "source": "adbe6433-76fe-47fd-bd70-924495465942", + "sourceHandle": "v_0", + "target": "ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15", + "targetHandle": "n_0", + "id": "xyflow__edge-adbe6433-76fe-47fd-bd70-924495465942v_0-ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15n_0" + }, + { + "source": "83ec354d-b262-48e3-83d3-98324e29adf7", + "sourceHandle": "v_0", + "target": "ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15", + "targetHandle": "n_0", + "id": "xyflow__edge-83ec354d-b262-48e3-83d3-98324e29adf7v_0-ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15n_0" + }, + { + "source": "ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-ddc5cb8d-ec7f-4b84-b78d-5aedef73cc15v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + } + ] +} \ No newline at end of file diff --git a/public/examples/scale_overlay.json b/public/examples/scale_overlay.json new file mode 100644 index 0000000..f2459b3 --- /dev/null +++ b/public/examples/scale_overlay.json @@ -0,0 +1,649 @@ +{ + "nodes": [ + { + "id": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "type": "ffmpeg", + "data": { + "name": "punch.mp4", + "url": "/punch.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 0, + "y": 0 + }, + "positionAbsolute": { + "x": 0, + "y": 0 + }, + "width": 109, + "height": 54 + }, + { + "id": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "type": "ffmpeg", + "data": { + "name": "out.mp4", + "ext": "mp4", + "inputs": [ + "v", + "a" + ], + "outputs": [], + "nodeType": "output" + }, + "nodeType": "output", + "position": { + "x": 439, + "y": 0 + }, + "positionAbsolute": { + "x": 439, + "y": 0 + }, + "width": 90, + "height": 54, + "selected": false, + "dragging": false + }, + { + "id": "1623b321-0d2b-42a1-99af-bad37a146b07", + "type": "ffmpeg", + "data": { + "id": 305, + "meta": "TSC", + "name": "overlay", + "type": "VV->V", + "description": "Overlay a video source on top of the input.", + "params": [ + { + "name": "x", + "type": "string", + "desc": "set the x expression (default \"0\")", + "min": null, + "max": null, + "default": "0", + "value": "290" + }, + { + "name": "y", + "type": "string", + "desc": "set the y expression (default \"0\")", + "min": null, + "max": null, + "default": "0", + "value": "50" + }, + { + "name": "eof_action", + "type": "int", + "desc": "Action to take when encountering EOF from secondary input (from 0 to 2) (default repeat)", + "min": 0, + "max": 2, + "default": "repeat", + "options": [ + { + "value": "repeat", + "desc": "Repeat the previous frame." + }, + { + "value": "endall", + "desc": "End both streams." + }, + { + "value": "pass", + "desc": "Pass through the main input." + } + ], + "value": "repeat" + }, + { + "name": "eval", + "type": "int", + "desc": "specify when to evaluate expressions (from 0 to 1) (default frame)", + "min": 0, + "max": 1, + "default": "frame", + "options": [ + { + "value": "init", + "desc": "eval expressions once during initialization" + }, + { + "value": "frame", + "desc": "eval expressions per-frame" + } + ], + "value": "frame" + }, + { + "name": "shortest", + "type": "boolean", + "desc": "force termination when the shortest input terminates (default false)", + "min": null, + "max": null, + "default": "false", + "value": "false" + }, + { + "name": "format", + "type": "int", + "desc": "set output format (from 0 to 7) (default yuv420)", + "min": 0, + "max": 7, + "default": "yuv420", + "options": [ + { + "value": "yuv420", + "desc": "" + }, + { + "value": "yuv420p10", + "desc": "" + }, + { + "value": "yuv422", + "desc": "" + }, + { + "value": "yuv422p10", + "desc": "" + }, + { + "value": "yuv444", + "desc": "" + }, + { + "value": "rgb", + "desc": "" + }, + { + "value": "gbrp", + "desc": "" + }, + { + "value": "auto", + "desc": "" + } + ], + "value": "yuv420" + }, + { + "name": "repeatlast", + "type": "boolean", + "desc": "repeat overlay of the last overlay frame (default true)", + "min": null, + "max": null, + "default": "true", + "value": "true" + }, + { + "name": "alpha", + "type": "int", + "desc": "alpha format (from 0 to 1) (default straight)", + "min": 0, + "max": 1, + "default": "straight", + "options": [ + { + "value": "straight", + "desc": "" + }, + { + "value": "premultiplied", + "desc": "" + } + ], + "value": "straight" + } + ], + "nodeType": "filter", + "inputs": [ + "v", + "v" + ], + "outputs": [ + "v" + ] + }, + "nodeType": "filter", + "position": { + "x": 290, + "y": 70 + }, + "positionAbsolute": { + "x": 290, + "y": 70 + }, + "width": 60, + "height": 50, + "dragging": false + }, + { + "id": "a0798490-6c5b-4a14-82a3-a5e7da6d223b", + "type": "ffmpeg", + "data": { + "name": "shoe.mp4", + "url": "/shoe.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 0, + "y": 100 + }, + "positionAbsolute": { + "x": 0, + "y": 100 + }, + "width": 109, + "height": 54 + }, + { + "id": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "type": "ffmpeg", + "data": { + "id": 338, + "meta": "..C", + "name": "scale", + "type": "V->V", + "description": "Scale the input video size and/or convert the image format.", + "params": [ + { + "name": "w", + "type": "string", + "desc": "Output video width", + "min": null, + "max": null, + "default": null, + "value": "120" + }, + { + "name": "width", + "type": "string", + "desc": "Output video width", + "min": null, + "max": null, + "default": null, + "value": null + }, + { + "name": "h", + "type": "string", + "desc": "Output video height", + "min": null, + "max": null, + "default": null, + "value": "120" + }, + { + "name": "height", + "type": "string", + "desc": "Output video height", + "min": null, + "max": null, + "default": null, + "value": null + }, + { + "name": "flags", + "type": "string", + "desc": "Flags to pass to libswscale (default \"\")", + "min": null, + "max": null, + "default": "", + "value": "" + }, + { + "name": "interl", + "type": "boolean", + "desc": "set interlacing (default false)", + "min": null, + "max": null, + "default": "false", + "value": "false" + }, + { + "name": "in_color_matrix", + "type": "string", + "desc": "set input YCbCr type (default \"auto\")", + "min": null, + "max": null, + "default": "auto", + "options": [ + { + "value": "auto", + "desc": "" + }, + { + "value": "bt601", + "desc": "" + }, + { + "value": "bt470", + "desc": "" + }, + { + "value": "smpte170m", + "desc": "" + }, + { + "value": "bt709", + "desc": "" + }, + { + "value": "fcc", + "desc": "" + }, + { + "value": "smpte240m", + "desc": "" + }, + { + "value": "bt2020", + "desc": "" + } + ], + "value": "auto" + }, + { + "name": "out_color_matrix", + "type": "string", + "desc": "set output YCbCr type", + "min": null, + "max": null, + "default": null, + "options": [ + { + "value": "auto", + "desc": "" + }, + { + "value": "bt601", + "desc": "" + }, + { + "value": "bt470", + "desc": "" + }, + { + "value": "smpte170m", + "desc": "" + }, + { + "value": "bt709", + "desc": "" + }, + { + "value": "fcc", + "desc": "" + }, + { + "value": "smpte240m", + "desc": "" + }, + { + "value": "bt2020", + "desc": "" + } + ], + "value": null + }, + { + "name": "in_range", + "type": "int", + "desc": "set input color range (from 0 to 2) (default auto)", + "min": 0, + "max": 2, + "default": "auto", + "options": [ + { + "value": "auto", + "desc": "" + }, + { + "value": "unknown", + "desc": "" + }, + { + "value": "full", + "desc": "" + }, + { + "value": "limited", + "desc": "" + }, + { + "value": "jpeg", + "desc": "" + }, + { + "value": "mpeg", + "desc": "" + }, + { + "value": "tv", + "desc": "" + }, + { + "value": "pc", + "desc": "" + } + ], + "value": "auto" + }, + { + "name": "out_range", + "type": "int", + "desc": "set output color range (from 0 to 2) (default auto)", + "min": 0, + "max": 2, + "default": "auto", + "options": [ + { + "value": "auto", + "desc": "" + }, + { + "value": "unknown", + "desc": "" + }, + { + "value": "full", + "desc": "" + }, + { + "value": "limited", + "desc": "" + }, + { + "value": "jpeg", + "desc": "" + }, + { + "value": "mpeg", + "desc": "" + }, + { + "value": "tv", + "desc": "" + }, + { + "value": "pc", + "desc": "" + } + ], + "value": "auto" + }, + { + "name": "in_v_chr_pos", + "type": "int", + "desc": "input vertical chroma position in luma grid/256 (from -513 to 512) (default -513)", + "min": -513, + "max": 512, + "default": -513, + "value": -513 + }, + { + "name": "in_h_chr_pos", + "type": "int", + "desc": "input horizontal chroma position in luma grid/256 (from -513 to 512) (default -513)", + "min": -513, + "max": 512, + "default": -513, + "value": -513 + }, + { + "name": "out_v_chr_pos", + "type": "int", + "desc": "output vertical chroma position in luma grid/256 (from -513 to 512) (default -513)", + "min": -513, + "max": 512, + "default": -513, + "value": -513 + }, + { + "name": "out_h_chr_pos", + "type": "int", + "desc": "output horizontal chroma position in luma grid/256 (from -513 to 512) (default -513)", + "min": -513, + "max": 512, + "default": -513, + "value": -513 + }, + { + "name": "force_original_aspect_ratio", + "type": "int", + "desc": "decrease or increase w/h if necessary to keep the original AR (from 0 to 2) (default disable)", + "min": 0, + "max": 2, + "default": "disable", + "options": [ + { + "value": "disable", + "desc": "" + }, + { + "value": "decrease", + "desc": "" + }, + { + "value": "increase", + "desc": "" + } + ], + "value": "increase" + }, + { + "name": "force_divisible_by", + "type": "int", + "desc": "enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used (from 1 to 256) (default 1)", + "min": 1, + "max": 256, + "default": 1, + "value": 1 + }, + { + "name": "param0", + "type": "double", + "desc": "Scaler param 0 (from -DBL_MAX to DBL_MAX) (default DBL_MAX)", + "min": -2000, + "max": 2000, + "default": 2000, + "value": 2000 + }, + { + "name": "param1", + "type": "double", + "desc": "Scaler param 1 (from -DBL_MAX to DBL_MAX) (default DBL_MAX)", + "min": -2000, + "max": 2000, + "default": 2000, + "value": 2000 + }, + { + "name": "eval", + "type": "int", + "desc": "specify when to evaluate expressions (from 0 to 1) (default init)", + "min": 0, + "max": 1, + "default": "init", + "options": [ + { + "value": "init", + "desc": "eval expressions once during initialization" + }, + { + "value": "frame", + "desc": "eval expressions during initialization and per-frame" + } + ], + "value": "init" + } + ], + "nodeType": "filter", + "inputs": [ + "v" + ], + "outputs": [ + "v" + ] + }, + "nodeType": "filter", + "position": { + "x": 180, + "y": -10 + }, + "positionAbsolute": { + "x": 180, + "y": -10 + }, + "width": 59, + "height": 50, + "dragging": false + } + ], + "edges": [ + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-a6796a9d-7fb6-494c-9545-bde5d4628eeav_0" + }, + { + "source": "a0798490-6c5b-4a14-82a3-a5e7da6d223b", + "sourceHandle": "v_0", + "target": "1623b321-0d2b-42a1-99af-bad37a146b07", + "targetHandle": "v_1", + "id": "xyflow__edge-a0798490-6c5b-4a14-82a3-a5e7da6d223bv_0-1623b321-0d2b-42a1-99af-bad37a146b07v_1" + }, + { + "source": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "sourceHandle": "v_0", + "target": "1623b321-0d2b-42a1-99af-bad37a146b07", + "targetHandle": "v_0", + "id": "xyflow__edge-a6796a9d-7fb6-494c-9545-bde5d4628eeav_0-1623b321-0d2b-42a1-99af-bad37a146b07v_0" + }, + { + "source": "1623b321-0d2b-42a1-99af-bad37a146b07", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-1623b321-0d2b-42a1-99af-bad37a146b07v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + } + ] +} \ No newline at end of file diff --git a/public/examples/smooth_slow.json b/public/examples/smooth_slow.json new file mode 100644 index 0000000..261ec45 --- /dev/null +++ b/public/examples/smooth_slow.json @@ -0,0 +1,422 @@ +{ + "nodes": [ + { + "id": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "type": "ffmpeg", + "data": { + "name": "punch.mp4", + "url": "/punch.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 0, + "y": 0 + }, + "positionAbsolute": { + "x": 0, + "y": 0 + }, + "width": 109, + "height": 54 + }, + { + "id": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "type": "ffmpeg", + "data": { + "name": "out.mp4", + "ext": "mp4", + "inputs": [ + "v", + "a" + ], + "outputs": [], + "nodeType": "output" + }, + "nodeType": "output", + "position": { + "x": 439, + "y": 0 + }, + "positionAbsolute": { + "x": 439, + "y": 0 + }, + "width": 90, + "height": 54, + "selected": false, + "dragging": false + }, + { + "id": "8dfda4cc-5985-4258-b1a0-d66bec0328d8", + "type": "ffmpeg", + "data": { + "id": 351, + "meta": "...", + "name": "setpts", + "type": "V->V", + "description": "Set PTS for the output video frame.", + "params": [ + { + "name": "expr", + "type": "string", + "desc": "Expression determining the frame timestamp (default \"PTS\")", + "min": null, + "max": null, + "default": "PTS", + "value": "2*PTS" + } + ], + "nodeType": "filter", + "inputs": [ + "v" + ], + "outputs": [ + "v" + ] + }, + "nodeType": "filter", + "position": { + "x": 160, + "y": -50 + }, + "positionAbsolute": { + "x": 160, + "y": -50 + }, + "width": 59, + "height": 50, + "dragging": false + }, + { + "id": "b2bd1fb9-b7ad-4c3b-9800-29748a8d8c73", + "type": "ffmpeg", + "data": { + "id": 290, + "meta": "...", + "name": "minterpolate", + "type": "V->V", + "description": "Frame rate conversion using Motion Interpolation.", + "params": [ + { + "name": "fps", + "type": "video_rate", + "desc": "output's frame rate (default \"60\")", + "min": null, + "max": null, + "default": "60", + "value": "66" + }, + { + "name": "mi_mode", + "type": "int", + "desc": "motion interpolation mode (from 0 to 2) (default mci)", + "min": 0, + "max": 2, + "default": "mci", + "options": [ + { + "value": "dup", + "desc": "duplicate frames" + }, + { + "value": "blend", + "desc": "blend frames" + }, + { + "value": "mci", + "desc": "motion compensated interpolation" + } + ], + "value": "mci" + }, + { + "name": "mc_mode", + "type": "int", + "desc": "motion compensation mode (from 0 to 1) (default obmc)", + "min": 0, + "max": 1, + "default": "obmc", + "options": [ + { + "value": "obmc", + "desc": "overlapped block motion compensation" + }, + { + "value": "aobmc", + "desc": "adaptive overlapped block motion compensation" + } + ], + "value": "obmc" + }, + { + "name": "me_mode", + "type": "int", + "desc": "motion estimation mode (from 0 to 1) (default bilat)", + "min": 0, + "max": 1, + "default": "bilat", + "options": [ + { + "value": "bidir", + "desc": "bidirectional motion estimation" + }, + { + "value": "bilat", + "desc": "bilateral motion estimation" + } + ], + "value": "bilat" + }, + { + "name": "me", + "type": "int", + "desc": "motion estimation method (from 1 to 9) (default epzs)", + "min": 1, + "max": 9, + "default": "epzs", + "options": [ + { + "value": "esa", + "desc": "exhaustive search" + }, + { + "value": "tss", + "desc": "three step search" + }, + { + "value": "tdls", + "desc": "two dimensional logarithmic search" + }, + { + "value": "ntss", + "desc": "new three step search" + }, + { + "value": "fss", + "desc": "four step search" + }, + { + "value": "ds", + "desc": "diamond search" + }, + { + "value": "hexbs", + "desc": "hexagon-based search" + }, + { + "value": "epzs", + "desc": "enhanced predictive zonal search" + }, + { + "value": "umh", + "desc": "uneven multi-hexagon search" + } + ], + "value": "epzs" + }, + { + "name": "mb_size", + "type": "int", + "desc": "macroblock size (from 4 to 16) (default 16)", + "min": 4, + "max": 16, + "default": 16, + "value": 16 + }, + { + "name": "search_param", + "type": "int", + "desc": "search parameter (from 4 to INT_MAX) (default 32)", + "min": 4, + "max": 2000, + "default": 32, + "value": 32 + }, + { + "name": "vsbmc", + "type": "int", + "desc": "variable-size block motion compensation (from 0 to 1) (default 0)", + "min": 0, + "max": 1, + "default": 0, + "value": 0 + }, + { + "name": "scd", + "type": "int", + "desc": "scene change detection method (from 0 to 1) (default fdiff)", + "min": 0, + "max": 1, + "default": "fdiff", + "options": [ + { + "value": "none", + "desc": "disable detection" + }, + { + "value": "fdiff", + "desc": "frame difference" + } + ], + "value": "fdiff" + }, + { + "name": "scd_threshold", + "type": "double", + "desc": "scene change threshold (from 0 to 100) (default 10)", + "min": 0, + "max": 100, + "default": 10, + "value": 10 + } + ], + "nodeType": "filter", + "inputs": [ + "v" + ], + "outputs": [ + "v" + ] + }, + "nodeType": "filter", + "position": { + "x": 280, + "y": -50 + }, + "positionAbsolute": { + "x": 280, + "y": -50 + }, + "width": 93, + "height": 50, + "dragging": false + }, + { + "id": "78efe031-cddd-477f-b975-708746d870e8", + "type": "ffmpeg", + "data": { + "id": 59, + "meta": "...", + "name": "asetpts", + "type": "A->A", + "description": "Set PTS for the output audio frame.", + "params": [ + { + "name": "expr", + "type": "string", + "desc": "Expression determining the frame timestamp (default \"PTS\")", + "min": null, + "max": null, + "default": "PTS", + "value": "2*PTS" + } + ], + "nodeType": "filter", + "inputs": [ + "a" + ], + "outputs": [ + "a" + ] + }, + "nodeType": "filter", + "position": { + "x": 260, + "y": 60 + }, + "positionAbsolute": { + "x": 260, + "y": 60 + }, + "width": 59, + "height": 50, + "dragging": false + } + ], + "edges": [ + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-a6796a9d-7fb6-494c-9545-bde5d4628eeav_0" + }, + { + "source": "a0798490-6c5b-4a14-82a3-a5e7da6d223b", + "sourceHandle": "v_0", + "target": "1623b321-0d2b-42a1-99af-bad37a146b07", + "targetHandle": "v_1", + "id": "xyflow__edge-a0798490-6c5b-4a14-82a3-a5e7da6d223bv_0-1623b321-0d2b-42a1-99af-bad37a146b07v_1" + }, + { + "source": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "sourceHandle": "v_0", + "target": "1623b321-0d2b-42a1-99af-bad37a146b07", + "targetHandle": "v_0", + "id": "xyflow__edge-a6796a9d-7fb6-494c-9545-bde5d4628eeav_0-1623b321-0d2b-42a1-99af-bad37a146b07v_0" + }, + { + "source": "1623b321-0d2b-42a1-99af-bad37a146b07", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-1623b321-0d2b-42a1-99af-bad37a146b07v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "66adb05a-5bf8-48f8-ac0c-0c8434191665", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-66adb05a-5bf8-48f8-ac0c-0c8434191665v_0" + }, + { + "source": "66adb05a-5bf8-48f8-ac0c-0c8434191665", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-66adb05a-5bf8-48f8-ac0c-0c8434191665v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "8dfda4cc-5985-4258-b1a0-d66bec0328d8", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-8dfda4cc-5985-4258-b1a0-d66bec0328d8v_0" + }, + { + "source": "8dfda4cc-5985-4258-b1a0-d66bec0328d8", + "sourceHandle": "v_0", + "target": "b2bd1fb9-b7ad-4c3b-9800-29748a8d8c73", + "targetHandle": "v_0", + "id": "xyflow__edge-8dfda4cc-5985-4258-b1a0-d66bec0328d8v_0-b2bd1fb9-b7ad-4c3b-9800-29748a8d8c73v_0" + }, + { + "source": "b2bd1fb9-b7ad-4c3b-9800-29748a8d8c73", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-b2bd1fb9-b7ad-4c3b-9800-29748a8d8c73v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "a_1", + "target": "78efe031-cddd-477f-b975-708746d870e8", + "targetHandle": "a_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31a_1-78efe031-cddd-477f-b975-708746d870e8a_0" + }, + { + "source": "78efe031-cddd-477f-b975-708746d870e8", + "sourceHandle": "a_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "a_1", + "id": "xyflow__edge-78efe031-cddd-477f-b975-708746d870e8a_0-eb32733d-28ad-4a38-9db7-50a98db5f309a_1" + } + ] +} \ No newline at end of file diff --git a/public/examples/speedup.json b/public/examples/speedup.json new file mode 100644 index 0000000..8ae472f --- /dev/null +++ b/public/examples/speedup.json @@ -0,0 +1,156 @@ +{ + "nodes": [ + { + "id": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "type": "ffmpeg", + "data": { + "name": "punch.mp4", + "url": "/punch.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 0, + "y": 0 + }, + "positionAbsolute": { + "x": 0, + "y": 0 + }, + "width": 109, + "height": 54 + }, + { + "id": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "type": "ffmpeg", + "data": { + "name": "out.mp4", + "ext": "mp4", + "inputs": [ + "v", + "a" + ], + "outputs": [], + "nodeType": "output" + }, + "nodeType": "output", + "position": { + "x": 439, + "y": 0 + }, + "positionAbsolute": { + "x": 439, + "y": 0 + }, + "width": 90, + "height": 54, + "selected": false, + "dragging": false + }, + { + "id": "8dfda4cc-5985-4258-b1a0-d66bec0328d8", + "type": "ffmpeg", + "data": { + "id": 351, + "meta": "...", + "name": "setpts", + "type": "V->V", + "description": "Set PTS for the output video frame.", + "params": [ + { + "name": "expr", + "type": "string", + "desc": "Expression determining the frame timestamp (default \"PTS\")", + "min": null, + "max": null, + "default": "PTS", + "value": "0.5*PTS" + } + ], + "nodeType": "filter", + "inputs": [ + "v" + ], + "outputs": [ + "v" + ] + }, + "nodeType": "filter", + "position": { + "x": 260, + "y": -60 + }, + "positionAbsolute": { + "x": 260, + "y": -60 + }, + "width": 59, + "height": 50, + "dragging": false + } + ], + "edges": [ + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-a6796a9d-7fb6-494c-9545-bde5d4628eeav_0" + }, + { + "source": "a0798490-6c5b-4a14-82a3-a5e7da6d223b", + "sourceHandle": "v_0", + "target": "1623b321-0d2b-42a1-99af-bad37a146b07", + "targetHandle": "v_1", + "id": "xyflow__edge-a0798490-6c5b-4a14-82a3-a5e7da6d223bv_0-1623b321-0d2b-42a1-99af-bad37a146b07v_1" + }, + { + "source": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "sourceHandle": "v_0", + "target": "1623b321-0d2b-42a1-99af-bad37a146b07", + "targetHandle": "v_0", + "id": "xyflow__edge-a6796a9d-7fb6-494c-9545-bde5d4628eeav_0-1623b321-0d2b-42a1-99af-bad37a146b07v_0" + }, + { + "source": "1623b321-0d2b-42a1-99af-bad37a146b07", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-1623b321-0d2b-42a1-99af-bad37a146b07v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "66adb05a-5bf8-48f8-ac0c-0c8434191665", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-66adb05a-5bf8-48f8-ac0c-0c8434191665v_0" + }, + { + "source": "66adb05a-5bf8-48f8-ac0c-0c8434191665", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-66adb05a-5bf8-48f8-ac0c-0c8434191665v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "8dfda4cc-5985-4258-b1a0-d66bec0328d8", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-8dfda4cc-5985-4258-b1a0-d66bec0328d8v_0" + }, + { + "source": "8dfda4cc-5985-4258-b1a0-d66bec0328d8", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-8dfda4cc-5985-4258-b1a0-d66bec0328d8v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + } + ] +} \ No newline at end of file diff --git a/public/examples/text.json b/public/examples/text.json new file mode 100644 index 0000000..fa3b81e --- /dev/null +++ b/public/examples/text.json @@ -0,0 +1,526 @@ +{ + "nodes": [ + { + "id": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "type": "ffmpeg", + "data": { + "name": "punch.mp4", + "url": "/punch.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 0, + "y": 0 + }, + "positionAbsolute": { + "x": 0, + "y": 0 + }, + "width": 109, + "height": 54 + }, + { + "id": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "type": "ffmpeg", + "data": { + "name": "out.mp4", + "ext": "mp4", + "inputs": [ + "v", + "a" + ], + "outputs": [], + "nodeType": "output" + }, + "nodeType": "output", + "position": { + "x": 439, + "y": 0 + }, + "positionAbsolute": { + "x": 439, + "y": 0 + }, + "width": 90, + "height": 54, + "selected": false, + "dragging": false + }, + { + "id": "66adb05a-5bf8-48f8-ac0c-0c8434191665", + "type": "ffmpeg", + "data": { + "id": 207, + "meta": "T.C", + "name": "drawtext", + "type": "V->V", + "description": "Draw text on top of video frames using libfreetype library.", + "params": [ + { + "name": "fontfile", + "type": "string", + "desc": "set font file", + "min": null, + "max": null, + "default": "", + "options": [ + { + "value": "", + "desc": "" + }, + { + "value": "times.ttf", + "desc": "Times" + }, + { + "value": "arial.ttf", + "desc": "Arial" + }, + { + "value": "courier.ttf", + "desc": "Courier" + }, + { + "value": "comic.ttf", + "desc": "Comic Sans" + } + ], + "value": "comic.ttf" + }, + { + "name": "text", + "type": "string", + "desc": "set text", + "min": null, + "max": null, + "default": null, + "value": "LOL" + }, + { + "name": "textfile", + "type": "string", + "desc": "set text file", + "min": null, + "max": null, + "default": null, + "value": null + }, + { + "name": "fontcolor", + "type": "color", + "desc": "set foreground color (default \"black\")", + "min": null, + "max": null, + "default": "black", + "value": "red" + }, + { + "name": "fontcolor_expr", + "type": "string", + "desc": "set foreground color expression (default \"\")", + "min": null, + "max": null, + "default": "", + "value": "" + }, + { + "name": "boxcolor", + "type": "color", + "desc": "set box color (default \"white\")", + "min": null, + "max": null, + "default": "white", + "value": "white" + }, + { + "name": "bordercolor", + "type": "color", + "desc": "set border color (default \"black\")", + "min": null, + "max": null, + "default": "black", + "value": "white" + }, + { + "name": "shadowcolor", + "type": "color", + "desc": "set shadow color (default \"black\")", + "min": null, + "max": null, + "default": "black", + "value": "black" + }, + { + "name": "box", + "type": "boolean", + "desc": "set box (default false)", + "min": null, + "max": null, + "default": "false", + "value": "false" + }, + { + "name": "boxborderw", + "type": "int", + "desc": "set box border width (from INT_MIN to INT_MAX) (default 0)", + "min": -2000, + "max": 2000, + "default": 0, + "value": "3" + }, + { + "name": "line_spacing", + "type": "int", + "desc": "set line spacing in pixels (from INT_MIN to INT_MAX) (default 0)", + "min": -2000, + "max": 2000, + "default": 0, + "value": 0 + }, + { + "name": "fontsize", + "type": "string", + "desc": "set font size", + "min": null, + "max": null, + "default": null, + "value": "100" + }, + { + "name": "x", + "type": "string", + "desc": "set x expression (default \"0\")", + "min": null, + "max": null, + "default": "0", + "value": "300" + }, + { + "name": "y", + "type": "string", + "desc": "set y expression (default \"0\")", + "min": null, + "max": null, + "default": "0", + "value": "150" + }, + { + "name": "shadowx", + "type": "int", + "desc": "set shadow x offset (from INT_MIN to INT_MAX) (default 0)", + "min": -2000, + "max": 2000, + "default": 0, + "value": 0 + }, + { + "name": "shadowy", + "type": "int", + "desc": "set shadow y offset (from INT_MIN to INT_MAX) (default 0)", + "min": -2000, + "max": 2000, + "default": 0, + "value": 0 + }, + { + "name": "borderw", + "type": "int", + "desc": "set border width (from INT_MIN to INT_MAX) (default 0)", + "min": -2000, + "max": 2000, + "default": 0, + "value": "5" + }, + { + "name": "tabsize", + "type": "int", + "desc": "set tab size (from 0 to INT_MAX) (default 4)", + "min": 0, + "max": 2000, + "default": 4, + "value": 4 + }, + { + "name": "basetime", + "type": "int64", + "desc": "set base time (from I64_MIN to I64_MAX) (default I64_MIN)", + "min": -2000, + "max": 2000, + "default": -2000, + "value": -2000 + }, + { + "name": "font", + "type": "string", + "desc": "Font name (default \"Sans\")", + "min": null, + "max": null, + "default": "Sans", + "value": "Sans" + }, + { + "name": "expansion", + "type": "int", + "desc": "set the expansion mode (from 0 to 2) (default normal)", + "min": 0, + "max": 2, + "default": "normal", + "options": [ + { + "value": "none", + "desc": "set no expansion" + }, + { + "value": "normal", + "desc": "set normal expansion" + }, + { + "value": "strftime", + "desc": "set strftime expansion (deprecated)" + } + ], + "value": "normal" + }, + { + "name": "timecode", + "type": "string", + "desc": "set initial timecode", + "min": null, + "max": null, + "default": null, + "value": null + }, + { + "name": "tc24hmax", + "type": "boolean", + "desc": "set 24 hours max (timecode only) (default false)", + "min": null, + "max": null, + "default": "false", + "value": "false" + }, + { + "name": "timecode_rate", + "type": "rational", + "desc": "set rate (timecode only) (from 0 to INT_MAX) (default 0/1)", + "min": "0", + "max": 2000, + "default": "0/1", + "value": "0/1" + }, + { + "name": "r", + "type": "rational", + "desc": "set rate (timecode only) (from 0 to INT_MAX) (default 0/1)", + "min": "0", + "max": 2000, + "default": "0/1", + "value": "0/1" + }, + { + "name": "rate", + "type": "rational", + "desc": "set rate (timecode only) (from 0 to INT_MAX) (default 0/1)", + "min": "0", + "max": 2000, + "default": "0/1", + "value": "0/1" + }, + { + "name": "reload", + "type": "int", + "desc": "reload text file at specified frame interval (from 0 to INT_MAX) (default 0)", + "min": 0, + "max": 2000, + "default": 0, + "value": 0 + }, + { + "name": "alpha", + "type": "string", + "desc": "apply alpha while rendering (default \"1\")", + "min": null, + "max": null, + "default": "1", + "value": "1" + }, + { + "name": "fix_bounds", + "type": "boolean", + "desc": "check and fix text coords to avoid clipping (default false)", + "min": null, + "max": null, + "default": "false", + "value": "false" + }, + { + "name": "start_number", + "type": "int", + "desc": "start frame number for n/frame_num variable (from 0 to INT_MAX) (default 0)", + "min": 0, + "max": 2000, + "default": 0, + "value": 0 + }, + { + "name": "text_source", + "type": "string", + "desc": "the source of text", + "min": null, + "max": null, + "default": null, + "value": null + }, + { + "name": "ft_load_flags", + "type": "flags", + "desc": "set font loading flags for libfreetype (default 0)", + "min": null, + "max": null, + "default": "0", + "options": [ + { + "value": "default", + "desc": "" + }, + { + "value": "no_scale", + "desc": "" + }, + { + "value": "no_hinting", + "desc": "" + }, + { + "value": "render", + "desc": "" + }, + { + "value": "no_bitmap", + "desc": "" + }, + { + "value": "vertical_layout", + "desc": "" + }, + { + "value": "force_autohint", + "desc": "" + }, + { + "value": "crop_bitmap", + "desc": "" + }, + { + "value": "pedantic", + "desc": "" + }, + { + "value": "ignore_global_advance_width", + "desc": "" + }, + { + "value": "no_recurse", + "desc": "" + }, + { + "value": "ignore_transform", + "desc": "" + }, + { + "value": "monochrome", + "desc": "" + }, + { + "value": "linear_design", + "desc": "" + }, + { + "value": "no_autohint", + "desc": "" + } + ], + "value": "0" + } + ], + "nodeType": "filter", + "inputs": [ + "v" + ], + "outputs": [ + "v" + ] + }, + "nodeType": "filter", + "position": { + "x": 190, + "y": -30 + }, + "positionAbsolute": { + "x": 190, + "y": -30 + }, + "width": 68, + "height": 50, + "dragging": false + } + ], + "edges": [ + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-a6796a9d-7fb6-494c-9545-bde5d4628eeav_0" + }, + { + "source": "a0798490-6c5b-4a14-82a3-a5e7da6d223b", + "sourceHandle": "v_0", + "target": "1623b321-0d2b-42a1-99af-bad37a146b07", + "targetHandle": "v_1", + "id": "xyflow__edge-a0798490-6c5b-4a14-82a3-a5e7da6d223bv_0-1623b321-0d2b-42a1-99af-bad37a146b07v_1" + }, + { + "source": "a6796a9d-7fb6-494c-9545-bde5d4628eea", + "sourceHandle": "v_0", + "target": "1623b321-0d2b-42a1-99af-bad37a146b07", + "targetHandle": "v_0", + "id": "xyflow__edge-a6796a9d-7fb6-494c-9545-bde5d4628eeav_0-1623b321-0d2b-42a1-99af-bad37a146b07v_0" + }, + { + "source": "1623b321-0d2b-42a1-99af-bad37a146b07", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-1623b321-0d2b-42a1-99af-bad37a146b07v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "v_0", + "target": "66adb05a-5bf8-48f8-ac0c-0c8434191665", + "targetHandle": "v_0", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31v_0-66adb05a-5bf8-48f8-ac0c-0c8434191665v_0" + }, + { + "source": "66adb05a-5bf8-48f8-ac0c-0c8434191665", + "sourceHandle": "v_0", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "v_0", + "id": "xyflow__edge-66adb05a-5bf8-48f8-ac0c-0c8434191665v_0-eb32733d-28ad-4a38-9db7-50a98db5f309v_0" + }, + { + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "sourceHandle": "a_1", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "targetHandle": "a_1", + "id": "xyflow__edge-9406a455-7e77-49bb-9cd8-381b54d47d31a_1-eb32733d-28ad-4a38-9db7-50a98db5f309a_1" + } + ] +} \ No newline at end of file diff --git a/public/examples/xfade.json b/public/examples/xfade.json new file mode 100644 index 0000000..309d6a7 --- /dev/null +++ b/public/examples/xfade.json @@ -0,0 +1,373 @@ +{ + "nodes": [ + { + "id": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "type": "ffmpeg", + "data": { + "name": "punch.mp4", + "url": "/punch.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 0, + "y": 0 + }, + "positionAbsolute": { + "x": 0, + "y": 0 + }, + "width": 109, + "height": 54 + }, + { + "id": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "type": "ffmpeg", + "data": { + "name": "out.mp4", + "ext": "mp4", + "inputs": [ + "v", + "a" + ], + "outputs": [], + "nodeType": "output" + }, + "nodeType": "output", + "position": { + "x": 279, + "y": 0 + }, + "positionAbsolute": { + "x": 279, + "y": 0 + }, + "width": 90, + "height": 54 + }, + { + "id": "845a461c-6eb0-463f-864c-5209fdf87e9a", + "type": "ffmpeg", + "data": { + "id": 411, + "meta": ".S.", + "name": "xfade", + "type": "VV->V", + "description": "Cross fade one video with another video.", + "params": [ + { + "name": "transition", + "type": "int", + "desc": "set cross fade transition (from -1 to 45) (default fade)", + "min": -1, + "max": 45, + "default": "fade", + "options": [ + { + "value": "custom", + "desc": "custom transition" + }, + { + "value": "fade", + "desc": "fade transition" + }, + { + "value": "wipeleft", + "desc": "wipe left transition" + }, + { + "value": "wiperight", + "desc": "wipe right transition" + }, + { + "value": "wipeup", + "desc": "wipe up transition" + }, + { + "value": "wipedown", + "desc": "wipe down transition" + }, + { + "value": "slideleft", + "desc": "slide left transition" + }, + { + "value": "slideright", + "desc": "slide right transition" + }, + { + "value": "slideup", + "desc": "slide up transition" + }, + { + "value": "slidedown", + "desc": "slide down transition" + }, + { + "value": "circlecrop", + "desc": "circle crop transition" + }, + { + "value": "rectcrop", + "desc": "rect crop transition" + }, + { + "value": "distance", + "desc": "distance transition" + }, + { + "value": "fadeblack", + "desc": "fadeblack transition" + }, + { + "value": "fadewhite", + "desc": "fadewhite transition" + }, + { + "value": "radial", + "desc": "radial transition" + }, + { + "value": "smoothleft", + "desc": "smoothleft transition" + }, + { + "value": "smoothright", + "desc": "smoothright transition" + }, + { + "value": "smoothup", + "desc": "smoothup transition" + }, + { + "value": "smoothdown", + "desc": "smoothdown transition" + }, + { + "value": "circleopen", + "desc": "circleopen transition" + }, + { + "value": "circleclose", + "desc": "circleclose transition" + }, + { + "value": "vertopen", + "desc": "vert open transition" + }, + { + "value": "vertclose", + "desc": "vert close transition" + }, + { + "value": "horzopen", + "desc": "horz open transition" + }, + { + "value": "horzclose", + "desc": "horz close transition" + }, + { + "value": "dissolve", + "desc": "dissolve transition" + }, + { + "value": "pixelize", + "desc": "pixelize transition" + }, + { + "value": "diagtl", + "desc": "diag tl transition" + }, + { + "value": "diagtr", + "desc": "diag tr transition" + }, + { + "value": "diagbl", + "desc": "diag bl transition" + }, + { + "value": "diagbr", + "desc": "diag br transition" + }, + { + "value": "hlslice", + "desc": "hl slice transition" + }, + { + "value": "hrslice", + "desc": "hr slice transition" + }, + { + "value": "vuslice", + "desc": "vu slice transition" + }, + { + "value": "vdslice", + "desc": "vd slice transition" + }, + { + "value": "hblur", + "desc": "hblur transition" + }, + { + "value": "fadegrays", + "desc": "fadegrays transition" + }, + { + "value": "wipetl", + "desc": "wipe tl transition" + }, + { + "value": "wipetr", + "desc": "wipe tr transition" + }, + { + "value": "wipebl", + "desc": "wipe bl transition" + }, + { + "value": "wipebr", + "desc": "wipe br transition" + }, + { + "value": "squeezeh", + "desc": "squeeze h transition" + }, + { + "value": "squeezev", + "desc": "squeeze v transition" + }, + { + "value": "zoomin", + "desc": "zoom in transition" + }, + { + "value": "fadefast", + "desc": "fast fade transition" + }, + { + "value": "fadeslow", + "desc": "slow fade transition" + } + ], + "value": "radial" + }, + { + "name": "duration", + "type": "duration", + "desc": "set cross fade duration (default 1)", + "min": null, + "max": null, + "default": "1", + "value": "3" + }, + { + "name": "offset", + "type": "duration", + "desc": "set cross fade start relative to first input stream (default 0)", + "min": null, + "max": null, + "default": "0", + "value": "0" + }, + { + "name": "expr", + "type": "string", + "desc": "set expression for custom transition", + "min": null, + "max": null, + "default": null, + "value": null + } + ], + "nodeType": "filter", + "inputs": [ + "v", + "v" + ], + "outputs": [ + "v" + ] + }, + "nodeType": "filter", + "position": { + "x": 170, + "y": -50 + }, + "positionAbsolute": { + "x": 170, + "y": -50 + }, + "width": 59, + "height": 50 + }, + { + "id": "abd87b6a-102f-4357-9380-986a162a6448", + "type": "ffmpeg", + "data": { + "name": "shoe.mp4", + "url": "/shoe.mp4", + "ext": "mp4", + "outputs": [ + "v", + "a" + ], + "inputs": [], + "nodeType": "input" + }, + "nodeType": "input", + "position": { + "x": 0, + "y": 100 + }, + "positionAbsolute": { + "x": 0, + "y": 100 + }, + "width": 109, + "height": 54 + } + ], + "edges": [ + { + "id": "29d53c5f-1428-40a3-8be3-69b08d5e119d", + "type": "default", + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "target": "845a461c-6eb0-463f-864c-5209fdf87e9a", + "sourceHandle": "v_0", + "targetHandle": "v_0" + }, + { + "id": "281b82e1-f994-4f66-b968-1cf648ac02f0", + "type": "default", + "source": "9406a455-7e77-49bb-9cd8-381b54d47d31", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "sourceHandle": "a_1", + "targetHandle": "a_1" + }, + { + "id": "b73848eb-3fa1-4828-8e2c-e66b5ce61b23", + "type": "default", + "source": "845a461c-6eb0-463f-864c-5209fdf87e9a", + "target": "eb32733d-28ad-4a38-9db7-50a98db5f309", + "sourceHandle": "v_0", + "targetHandle": "v_0" + }, + { + "id": "4e833412-0ac8-4d01-878f-b3fbe0e3d257", + "type": "default", + "source": "abd87b6a-102f-4357-9380-986a162a6448", + "target": "845a461c-6eb0-463f-864c-5209fdf87e9a", + "sourceHandle": "v_0", + "targetHandle": "v_1" + } + ] +} \ No newline at end of file diff --git a/src/App.svelte b/src/App.svelte index e50da90..302226b 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -3,12 +3,14 @@ import { selectedFilter, nodes, + edges, inputs, outputs, auto, addNode, inputNames, previewCommand, + doFit, } from "./stores.js"; import Filter from "./Filter.svelte"; import FilterPicker from "./FilterPicker.svelte"; @@ -20,6 +22,15 @@ const baseURL = `https://unpkg.com/@ffmpeg/core${!isChrome ? "-mt" : ""}@0.12.2/dist/esm`; const TIMEOUT = 40000; const ffmpeg = new FFmpeg(); + const examples = [ + { name: "Cross Fade", url: "/examples/xfade.json" }, + { name: "Crop & Trim", url: "/examples/crop_trim.json" }, + { name: "Scale & Overlay", url: "/examples/scale_overlay.json" }, + { name: "Text", url: "/examples/text.json" }, + { name: "Speed Up", url: "/examples/speedup.json" }, + { name: "Slow Down Smoothly", url: "/examples/smooth_slow.json" }, + { name: "Video Grid", url: "/examples/grid.json" }, + ]; let videoValue = "/" + $inputs[0].name; let ffmpegLoaded = false; @@ -30,11 +41,22 @@ let vidPlayerRef; let renderProgress = 0; let fileinput; + let fit; function addInput() { addNode({ ...$inputNames[$inputNames.length - 1] }, "input"); } + async function loadExample(url) { + if (!url) return; + $auto = false; + const response = await fetch(url); + const example = await response.json(); + $nodes = example.nodes; + $edges = example.edges; + $doFit++; + } + async function onFileSelected(e) { let vid = e.target.files[0]; await ffmpeg.writeFile(vid.name, await fetchFile(vid)); @@ -216,20 +238,33 @@
-
@@ -421,6 +456,11 @@ flex: 1; } + .graph-nav { + display: flex; + justify-content: space-between; + } + @media only screen and (max-width: 1100px) { main { grid-template-columns: 250px 1fr 1fr 1fr 1fr 300px; @@ -460,7 +500,7 @@ } .header { overflow: scroll; - height: auto; + height: auto; } .graph { height: 60vh; diff --git a/src/FitComp.svelte b/src/FitComp.svelte index 12ead8c..399d37e 100644 --- a/src/FitComp.svelte +++ b/src/FitComp.svelte @@ -1,12 +1,15 @@ + nodes.subscribe((n) => { + if ($auto) fitView(); + }); + doFit.subscribe(() => { + fitView(); + }); + diff --git a/src/stores.js b/src/stores.js index c024990..ece27d2 100644 --- a/src/stores.js +++ b/src/stores.js @@ -4,6 +4,7 @@ import { writable, derived, get } from "svelte/store"; export const nodes = writable([]); export const edges = writable([]); export const auto = writable(true); +export const doFit = writable(0); export const selectedFilter = writable(); export const INPUTNAMES = [