@kolbo/kolbo-code-linux-arm64-musl 0.0.0-dev-202604161628
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/kolbo +0 -0
- package/package.json +14 -0
- package/skills/brainstorming/SKILL.md +164 -0
- package/skills/brainstorming/scripts/frame-template.html +214 -0
- package/skills/brainstorming/scripts/helper.js +88 -0
- package/skills/brainstorming/scripts/server.cjs +354 -0
- package/skills/brainstorming/scripts/start-server.sh +148 -0
- package/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +287 -0
- package/skills/color-grading/SKILL.md +152 -0
- package/skills/dispatching-parallel-agents/SKILL.md +182 -0
- package/skills/docx/.skillfish.json +10 -0
- package/skills/docx/SKILL.md +196 -0
- package/skills/docx/docx-js.md +350 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/docx/ooxml/scripts/pack.py +159 -0
- package/skills/docx/ooxml/scripts/unpack.py +29 -0
- package/skills/docx/ooxml/scripts/validate.py +69 -0
- package/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/docx/ooxml/scripts/validation/base.py +951 -0
- package/skills/docx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/docx/ooxml.md +599 -0
- package/skills/docx/scripts/__init__.py +1 -0
- package/skills/docx/scripts/document.py +1272 -0
- package/skills/docx/scripts/templates/comments.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/skills/docx/scripts/templates/people.xml +3 -0
- package/skills/docx/scripts/utilities.py +374 -0
- package/skills/executing-plans/SKILL.md +70 -0
- package/skills/ffmpeg-patterns/SKILL.md +240 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/frontend-design/SKILL.md +42 -0
- package/skills/fullstack-app/SKILL.md +621 -0
- package/skills/image-prompting-guide/SKILL.md +143 -0
- package/skills/kolbo/SKILL.md +610 -0
- package/skills/music-prompting/SKILL.md +146 -0
- package/skills/pdf/.skillfish.json +10 -0
- package/skills/pdf/FORMS.md +205 -0
- package/skills/pdf/REFERENCE.md +612 -0
- package/skills/pdf/SKILL.md +293 -0
- package/skills/pdf/scripts/check_bounding_boxes.py +70 -0
- package/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/skills/pdf/scripts/check_fillable_fields.py +12 -0
- package/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/skills/pdf/scripts/create_validation_image.py +41 -0
- package/skills/pdf/scripts/extract_form_field_info.py +152 -0
- package/skills/pdf/scripts/fill_fillable_fields.py +114 -0
- package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/skills/photo-studio/SKILL.md +130 -0
- package/skills/pptx/.skillfish.json +10 -0
- package/skills/pptx/SKILL.md +483 -0
- package/skills/pptx/html2pptx.md +626 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/pptx/ooxml/scripts/pack.py +159 -0
- package/skills/pptx/ooxml/scripts/unpack.py +29 -0
- package/skills/pptx/ooxml/scripts/validate.py +69 -0
- package/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/pptx/ooxml/scripts/validation/base.py +951 -0
- package/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/pptx/ooxml.md +427 -0
- package/skills/pptx/scripts/html2pptx.js +995 -0
- package/skills/pptx/scripts/inventory.py +1020 -0
- package/skills/pptx/scripts/rearrange.py +231 -0
- package/skills/pptx/scripts/replace.py +385 -0
- package/skills/pptx/scripts/thumbnail.py +450 -0
- package/skills/production-review/SKILL.md +152 -0
- package/skills/receiving-code-review/SKILL.md +213 -0
- package/skills/remotion-best-practices/SKILL.md +62 -0
- package/skills/remotion-best-practices/rules/3d.md +86 -0
- package/skills/remotion-best-practices/rules/animations.md +27 -0
- package/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
- package/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
- package/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +103 -0
- package/skills/remotion-best-practices/rules/assets.md +78 -0
- package/skills/remotion-best-practices/rules/audio-visualization.md +198 -0
- package/skills/remotion-best-practices/rules/audio.md +169 -0
- package/skills/remotion-best-practices/rules/calculate-metadata.md +134 -0
- package/skills/remotion-best-practices/rules/can-decode.md +81 -0
- package/skills/remotion-best-practices/rules/charts.md +120 -0
- package/skills/remotion-best-practices/rules/compositions.md +154 -0
- package/skills/remotion-best-practices/rules/display-captions.md +184 -0
- package/skills/remotion-best-practices/rules/extract-frames.md +229 -0
- package/skills/remotion-best-practices/rules/ffmpeg.md +38 -0
- package/skills/remotion-best-practices/rules/fonts.md +152 -0
- package/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
- package/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
- package/skills/remotion-best-practices/rules/get-video-duration.md +60 -0
- package/skills/remotion-best-practices/rules/gifs.md +141 -0
- package/skills/remotion-best-practices/rules/images.md +134 -0
- package/skills/remotion-best-practices/rules/import-srt-captions.md +69 -0
- package/skills/remotion-best-practices/rules/light-leaks.md +73 -0
- package/skills/remotion-best-practices/rules/lottie.md +70 -0
- package/skills/remotion-best-practices/rules/maps.md +412 -0
- package/skills/remotion-best-practices/rules/measuring-dom-nodes.md +34 -0
- package/skills/remotion-best-practices/rules/measuring-text.md +140 -0
- package/skills/remotion-best-practices/rules/motion-design.md +215 -0
- package/skills/remotion-best-practices/rules/parameters.md +109 -0
- package/skills/remotion-best-practices/rules/sequencing.md +118 -0
- package/skills/remotion-best-practices/rules/sfx.md +30 -0
- package/skills/remotion-best-practices/rules/subtitles.md +36 -0
- package/skills/remotion-best-practices/rules/tailwind.md +11 -0
- package/skills/remotion-best-practices/rules/text-animations.md +20 -0
- package/skills/remotion-best-practices/rules/timing.md +179 -0
- package/skills/remotion-best-practices/rules/transcribe-captions.md +70 -0
- package/skills/remotion-best-practices/rules/transitions.md +197 -0
- package/skills/remotion-best-practices/rules/transparent-videos.md +106 -0
- package/skills/remotion-best-practices/rules/trimming.md +51 -0
- package/skills/remotion-best-practices/rules/videos.md +171 -0
- package/skills/remotion-best-practices/rules/voiceover.md +99 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +146 -0
- package/skills/short-form-video/SKILL.md +168 -0
- package/skills/sound-design/SKILL.md +154 -0
- package/skills/storytelling/SKILL.md +139 -0
- package/skills/subagent-driven-development/SKILL.md +277 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/subagent-driven-development/implementer-prompt.md +113 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/subtitle-production/SKILL.md +244 -0
- package/skills/subtitle-production/reference/burn_to_video.py +222 -0
- package/skills/subtitle-production/reference/export_srts.py +127 -0
- package/skills/subtitle-production/reference/gen_srt.py +42 -0
- package/skills/supabase/.skillfish.json +10 -0
- package/skills/supabase/SKILL.md +106 -0
- package/skills/supabase/assets/feedback-issue-template.md +17 -0
- package/skills/supabase/references/skill-feedback.md +17 -0
- package/skills/supabase-postgres-best-practices/.skillfish.json +10 -0
- package/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
- package/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
- package/skills/supabase-postgres-best-practices/references/_template.md +34 -0
- package/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
- package/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
- package/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
- package/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
- package/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
- package/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
- package/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
- package/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
- package/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
- package/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
- package/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
- package/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
- package/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
- package/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
- package/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
- package/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
- package/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
- package/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
- package/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
- package/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
- package/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
- package/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
- package/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
- package/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
- package/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
- package/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
- package/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
- package/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
- package/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
- package/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
- package/skills/supabase-postgres-best-practices/references/security-rls-performance.md +57 -0
- package/skills/supabase-quickstart/SKILL.md +400 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/typography-video/SKILL.md +182 -0
- package/skills/typography-video/reference/KineticTitleScene.tsx +345 -0
- package/skills/using-git-worktrees/SKILL.md +218 -0
- package/skills/using-superpowers/SKILL.md +115 -0
- package/skills/using-superpowers/references/codex-tools.md +100 -0
- package/skills/using-superpowers/references/gemini-tools.md +33 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/video-editing/SKILL.md +128 -0
- package/skills/video-production/SKILL.md +247 -0
- package/skills/video-prompting-guide/SKILL.md +268 -0
- package/skills/writing-plans/SKILL.md +152 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/writing-skills/SKILL.md +655 -0
- package/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/skills/writing-skills/persuasion-principles.md +187 -0
- package/skills/writing-skills/render-graphs.js +168 -0
- package/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/skills/xlsx/.skillfish.json +10 -0
- package/skills/xlsx/SKILL.md +288 -0
- package/skills/xlsx/recalc.py +178 -0
- package/skills/youtube-clipper/SKILL.md +187 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {loadFont} from '@remotion/google-fonts/Inter';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {AbsoluteFill, spring, useCurrentFrame, useVideoConfig} from 'remotion';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Highlight a word in a sentence with a spring-animated wipe effect.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Ideal composition size: 1280x720
|
|
10
|
+
|
|
11
|
+
const COLOR_BG = '#ffffff';
|
|
12
|
+
const COLOR_TEXT = '#000000';
|
|
13
|
+
const COLOR_HIGHLIGHT = '#A7C7E7';
|
|
14
|
+
const FULL_TEXT = 'This is Remotion.';
|
|
15
|
+
const HIGHLIGHT_WORD = 'Remotion';
|
|
16
|
+
const FONT_SIZE = 72;
|
|
17
|
+
const FONT_WEIGHT = 700;
|
|
18
|
+
const HIGHLIGHT_START_FRAME = 30;
|
|
19
|
+
const HIGHLIGHT_WIPE_DURATION = 18;
|
|
20
|
+
|
|
21
|
+
const {fontFamily} = loadFont();
|
|
22
|
+
|
|
23
|
+
const Highlight: React.FC<{
|
|
24
|
+
word: string;
|
|
25
|
+
color: string;
|
|
26
|
+
delay: number;
|
|
27
|
+
durationInFrames: number;
|
|
28
|
+
}> = ({word, color, delay, durationInFrames}) => {
|
|
29
|
+
const frame = useCurrentFrame();
|
|
30
|
+
const {fps} = useVideoConfig();
|
|
31
|
+
|
|
32
|
+
const highlightProgress = spring({
|
|
33
|
+
fps,
|
|
34
|
+
frame,
|
|
35
|
+
config: {damping: 200},
|
|
36
|
+
delay,
|
|
37
|
+
durationInFrames,
|
|
38
|
+
});
|
|
39
|
+
const scaleX = Math.max(0, Math.min(1, highlightProgress));
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<span style={{position: 'relative', display: 'inline-block'}}>
|
|
43
|
+
<span
|
|
44
|
+
style={{
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
left: 0,
|
|
47
|
+
right: 0,
|
|
48
|
+
top: '50%',
|
|
49
|
+
height: '1.05em',
|
|
50
|
+
transform: `translateY(-50%) scaleX(${scaleX})`,
|
|
51
|
+
transformOrigin: 'left center',
|
|
52
|
+
backgroundColor: color,
|
|
53
|
+
borderRadius: '0.18em',
|
|
54
|
+
zIndex: 0,
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
<span style={{position: 'relative', zIndex: 1}}>{word}</span>
|
|
58
|
+
</span>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const MyAnimation = () => {
|
|
63
|
+
const highlightIndex = FULL_TEXT.indexOf(HIGHLIGHT_WORD);
|
|
64
|
+
const hasHighlight = highlightIndex >= 0;
|
|
65
|
+
const preText = hasHighlight ? FULL_TEXT.slice(0, highlightIndex) : FULL_TEXT;
|
|
66
|
+
const postText = hasHighlight
|
|
67
|
+
? FULL_TEXT.slice(highlightIndex + HIGHLIGHT_WORD.length)
|
|
68
|
+
: '';
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<AbsoluteFill
|
|
72
|
+
style={{
|
|
73
|
+
backgroundColor: COLOR_BG,
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
justifyContent: 'center',
|
|
76
|
+
fontFamily,
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<div
|
|
80
|
+
style={{
|
|
81
|
+
color: COLOR_TEXT,
|
|
82
|
+
fontSize: FONT_SIZE,
|
|
83
|
+
fontWeight: FONT_WEIGHT,
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{hasHighlight ? (
|
|
87
|
+
<>
|
|
88
|
+
<span>{preText}</span>
|
|
89
|
+
<Highlight
|
|
90
|
+
word={HIGHLIGHT_WORD}
|
|
91
|
+
color={COLOR_HIGHLIGHT}
|
|
92
|
+
delay={HIGHLIGHT_START_FRAME}
|
|
93
|
+
durationInFrames={HIGHLIGHT_WIPE_DURATION}
|
|
94
|
+
/>
|
|
95
|
+
<span>{postText}</span>
|
|
96
|
+
</>
|
|
97
|
+
) : (
|
|
98
|
+
<span>{FULL_TEXT}</span>
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
</AbsoluteFill>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: assets
|
|
3
|
+
description: Importing images, videos, audio, and fonts into Remotion
|
|
4
|
+
metadata:
|
|
5
|
+
tags: assets, staticFile, images, fonts, public
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Importing assets in Remotion
|
|
9
|
+
|
|
10
|
+
## The public folder
|
|
11
|
+
|
|
12
|
+
Place assets in the `public/` folder at your project root.
|
|
13
|
+
|
|
14
|
+
## Using staticFile()
|
|
15
|
+
|
|
16
|
+
You MUST use `staticFile()` to reference files from the `public/` folder:
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { Img, staticFile } from "remotion";
|
|
20
|
+
|
|
21
|
+
export const MyComposition = () => {
|
|
22
|
+
return <Img src={staticFile("logo.png")} />;
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The function returns an encoded URL that works correctly when deploying to subdirectories.
|
|
27
|
+
|
|
28
|
+
## Using with components
|
|
29
|
+
|
|
30
|
+
**Images:**
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Img, staticFile } from "remotion";
|
|
34
|
+
|
|
35
|
+
<Img src={staticFile("photo.png")} />;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Videos:**
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { Video } from "@remotion/media";
|
|
42
|
+
import { staticFile } from "remotion";
|
|
43
|
+
|
|
44
|
+
<Video src={staticFile("clip.mp4")} />;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Audio:**
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Audio } from "@remotion/media";
|
|
51
|
+
import { staticFile } from "remotion";
|
|
52
|
+
|
|
53
|
+
<Audio src={staticFile("music.mp3")} />;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Fonts:**
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { staticFile } from "remotion";
|
|
60
|
+
|
|
61
|
+
const fontFamily = new FontFace("MyFont", `url(${staticFile("font.woff2")})`);
|
|
62
|
+
await fontFamily.load();
|
|
63
|
+
document.fonts.add(fontFamily);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Remote URLs
|
|
67
|
+
|
|
68
|
+
Remote URLs can be used directly without `staticFile()`:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<Img src="https://example.com/image.png" />
|
|
72
|
+
<Video src="https://remotion.media/video.mp4" />
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Important notes
|
|
76
|
+
|
|
77
|
+
- Remotion components (`<Img>`, `<Video>`, `<Audio>`) ensure assets are fully loaded before rendering
|
|
78
|
+
- Special characters in filenames (`#`, `?`, `&`) are automatically encoded
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: audio-visualization
|
|
3
|
+
description: Audio visualization patterns - spectrum bars, waveforms, bass-reactive effects
|
|
4
|
+
metadata:
|
|
5
|
+
tags: audio, visualization, spectrum, waveform, bass, music, audiogram, frequency
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Audio Visualization in Remotion
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx remotion add @remotion/media-utils
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Loading Audio Data
|
|
17
|
+
|
|
18
|
+
Use `useWindowedAudioData()` (https://www.remotion.dev/docs/use-windowed-audio-data) to load audio data:
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { useWindowedAudioData } from "@remotion/media-utils";
|
|
22
|
+
import { staticFile, useCurrentFrame, useVideoConfig } from "remotion";
|
|
23
|
+
|
|
24
|
+
const frame = useCurrentFrame();
|
|
25
|
+
const { fps } = useVideoConfig();
|
|
26
|
+
|
|
27
|
+
const { audioData, dataOffsetInSeconds } = useWindowedAudioData({
|
|
28
|
+
src: staticFile("podcast.wav"),
|
|
29
|
+
frame,
|
|
30
|
+
fps,
|
|
31
|
+
windowInSeconds: 30,
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Spectrum Bar Visualization
|
|
36
|
+
|
|
37
|
+
Use `visualizeAudio()` (https://www.remotion.dev/docs/visualize-audio) to get frequency data for bar charts:
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { useWindowedAudioData, visualizeAudio } from "@remotion/media-utils";
|
|
41
|
+
import { staticFile, useCurrentFrame, useVideoConfig } from "remotion";
|
|
42
|
+
|
|
43
|
+
const frame = useCurrentFrame();
|
|
44
|
+
const { fps } = useVideoConfig();
|
|
45
|
+
|
|
46
|
+
const { audioData, dataOffsetInSeconds } = useWindowedAudioData({
|
|
47
|
+
src: staticFile("music.mp3"),
|
|
48
|
+
frame,
|
|
49
|
+
fps,
|
|
50
|
+
windowInSeconds: 30,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (!audioData) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const frequencies = visualizeAudio({
|
|
58
|
+
fps,
|
|
59
|
+
frame,
|
|
60
|
+
audioData,
|
|
61
|
+
numberOfSamples: 256,
|
|
62
|
+
optimizeFor: "speed",
|
|
63
|
+
dataOffsetInSeconds,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div style={{ display: "flex", alignItems: "flex-end", height: 200 }}>
|
|
68
|
+
{frequencies.map((v, i) => (
|
|
69
|
+
<div
|
|
70
|
+
key={i}
|
|
71
|
+
style={{
|
|
72
|
+
flex: 1,
|
|
73
|
+
height: `${v * 100}%`,
|
|
74
|
+
backgroundColor: "#0b84f3",
|
|
75
|
+
margin: "0 1px",
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
))}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
- `numberOfSamples` must be power of 2 (32, 64, 128, 256, 512, 1024)
|
|
84
|
+
- Values range 0-1; left of array = bass, right = highs
|
|
85
|
+
- Use `optimizeFor: "speed"` for Lambda or high sample counts
|
|
86
|
+
|
|
87
|
+
**Important:** When passing `audioData` to child components, also pass the `frame` from the parent. Do not call `useCurrentFrame()` in each child - this causes discontinuous visualization when children are inside `<Sequence>` with offsets.
|
|
88
|
+
|
|
89
|
+
## Waveform Visualization
|
|
90
|
+
|
|
91
|
+
Use `visualizeAudioWaveform()` (https://www.remotion.dev/docs/media-utils/visualize-audio-waveform) with `createSmoothSvgPath()` (https://www.remotion.dev/docs/media-utils/create-smooth-svg-path) for oscilloscope-style displays:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import {
|
|
95
|
+
createSmoothSvgPath,
|
|
96
|
+
useWindowedAudioData,
|
|
97
|
+
visualizeAudioWaveform,
|
|
98
|
+
} from "@remotion/media-utils";
|
|
99
|
+
import { staticFile, useCurrentFrame, useVideoConfig } from "remotion";
|
|
100
|
+
|
|
101
|
+
const frame = useCurrentFrame();
|
|
102
|
+
const { width, fps } = useVideoConfig();
|
|
103
|
+
const HEIGHT = 200;
|
|
104
|
+
|
|
105
|
+
const { audioData, dataOffsetInSeconds } = useWindowedAudioData({
|
|
106
|
+
src: staticFile("voice.wav"),
|
|
107
|
+
frame,
|
|
108
|
+
fps,
|
|
109
|
+
windowInSeconds: 30,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
if (!audioData) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const waveform = visualizeAudioWaveform({
|
|
117
|
+
fps,
|
|
118
|
+
frame,
|
|
119
|
+
audioData,
|
|
120
|
+
numberOfSamples: 256,
|
|
121
|
+
windowInSeconds: 0.5,
|
|
122
|
+
dataOffsetInSeconds,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const path = createSmoothSvgPath({
|
|
126
|
+
points: waveform.map((y, i) => ({
|
|
127
|
+
x: (i / (waveform.length - 1)) * width,
|
|
128
|
+
y: HEIGHT / 2 + (y * HEIGHT) / 2,
|
|
129
|
+
})),
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<svg width={width} height={HEIGHT}>
|
|
134
|
+
<path d={path} fill="none" stroke="#0b84f3" strokeWidth={2} />
|
|
135
|
+
</svg>
|
|
136
|
+
);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Bass-Reactive Effects
|
|
140
|
+
|
|
141
|
+
Extract low frequencies for beat-reactive animations:
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
const frequencies = visualizeAudio({
|
|
145
|
+
fps,
|
|
146
|
+
frame,
|
|
147
|
+
audioData,
|
|
148
|
+
numberOfSamples: 128,
|
|
149
|
+
optimizeFor: "speed",
|
|
150
|
+
dataOffsetInSeconds,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const lowFrequencies = frequencies.slice(0, 32);
|
|
154
|
+
const bassIntensity =
|
|
155
|
+
lowFrequencies.reduce((sum, v) => sum + v, 0) / lowFrequencies.length;
|
|
156
|
+
|
|
157
|
+
const scale = 1 + bassIntensity * 0.5;
|
|
158
|
+
const opacity = Math.min(0.6, bassIntensity * 0.8);
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Volume-Based Waveform
|
|
162
|
+
|
|
163
|
+
Use `getWaveformPortion()` (https://www.remotion.dev/docs/get-waveform-portion) when you need simplified volume data instead of frequency spectrum:
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
import { getWaveformPortion } from "@remotion/media-utils";
|
|
167
|
+
import { useCurrentFrame, useVideoConfig } from "remotion";
|
|
168
|
+
|
|
169
|
+
const frame = useCurrentFrame();
|
|
170
|
+
const { fps } = useVideoConfig();
|
|
171
|
+
const currentTimeInSeconds = frame / fps;
|
|
172
|
+
|
|
173
|
+
const waveform = getWaveformPortion({
|
|
174
|
+
audioData,
|
|
175
|
+
startTimeInSeconds: currentTimeInSeconds,
|
|
176
|
+
durationInSeconds: 5,
|
|
177
|
+
numberOfSamples: 50,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// Returns array of { index, amplitude } objects (amplitude: 0-1)
|
|
181
|
+
waveform.map((bar) => (
|
|
182
|
+
<div key={bar.index} style={{ height: bar.amplitude * 100 }} />
|
|
183
|
+
));
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Postprocessing
|
|
187
|
+
|
|
188
|
+
Low frequencies naturally dominate. Apply logarithmic scaling for visual balance:
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
const minDb = -100;
|
|
192
|
+
const maxDb = -30;
|
|
193
|
+
|
|
194
|
+
const scaled = frequencies.map((value) => {
|
|
195
|
+
const db = 20 * Math.log10(value);
|
|
196
|
+
return (db - minDb) / (maxDb - minDb);
|
|
197
|
+
});
|
|
198
|
+
```
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: audio
|
|
3
|
+
description: Using audio and sound in Remotion - importing, trimming, volume, speed, pitch
|
|
4
|
+
metadata:
|
|
5
|
+
tags: audio, media, trim, volume, speed, loop, pitch, mute, sound, sfx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Using audio in Remotion
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
First, the @remotion/media package needs to be installed.
|
|
13
|
+
If it is not installed, use the following command:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx remotion add @remotion/media
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Importing Audio
|
|
20
|
+
|
|
21
|
+
Use `<Audio>` from `@remotion/media` to add audio to your composition.
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { Audio } from "@remotion/media";
|
|
25
|
+
import { staticFile } from "remotion";
|
|
26
|
+
|
|
27
|
+
export const MyComposition = () => {
|
|
28
|
+
return <Audio src={staticFile("audio.mp3")} />;
|
|
29
|
+
};
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Remote URLs are also supported:
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
<Audio src="https://remotion.media/audio.mp3" />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
By default, audio plays from the start, at full volume and full length.
|
|
39
|
+
Multiple audio tracks can be layered by adding multiple `<Audio>` components.
|
|
40
|
+
|
|
41
|
+
## Trimming
|
|
42
|
+
|
|
43
|
+
Use `trimBefore` and `trimAfter` to remove portions of the audio. Values are in frames.
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
const { fps } = useVideoConfig();
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Audio
|
|
50
|
+
src={staticFile("audio.mp3")}
|
|
51
|
+
trimBefore={2 * fps} // Skip the first 2 seconds
|
|
52
|
+
trimAfter={10 * fps} // End at the 10 second mark
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The audio still starts playing at the beginning of the composition - only the specified portion is played.
|
|
58
|
+
|
|
59
|
+
## Delaying
|
|
60
|
+
|
|
61
|
+
Wrap the audio in a `<Sequence>` to delay when it starts:
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Sequence, staticFile } from "remotion";
|
|
65
|
+
import { Audio } from "@remotion/media";
|
|
66
|
+
|
|
67
|
+
const { fps } = useVideoConfig();
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Sequence from={1 * fps}>
|
|
71
|
+
<Audio src={staticFile("audio.mp3")} />
|
|
72
|
+
</Sequence>
|
|
73
|
+
);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The audio will start playing after 1 second.
|
|
77
|
+
|
|
78
|
+
## Volume
|
|
79
|
+
|
|
80
|
+
Set a static volume (0 to 1):
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
<Audio src={staticFile("audio.mp3")} volume={0.5} />
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or use a callback for dynamic volume based on the current frame:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { interpolate } from "remotion";
|
|
90
|
+
|
|
91
|
+
const { fps } = useVideoConfig();
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Audio
|
|
95
|
+
src={staticFile("audio.mp3")}
|
|
96
|
+
volume={(f) =>
|
|
97
|
+
interpolate(f, [0, 1 * fps], [0, 1], { extrapolateRight: "clamp" })
|
|
98
|
+
}
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The value of `f` starts at 0 when the audio begins to play, not the composition frame.
|
|
104
|
+
|
|
105
|
+
## Muting
|
|
106
|
+
|
|
107
|
+
Use `muted` to silence the audio. It can be set dynamically:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
const frame = useCurrentFrame();
|
|
111
|
+
const { fps } = useVideoConfig();
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Audio
|
|
115
|
+
src={staticFile("audio.mp3")}
|
|
116
|
+
muted={frame >= 2 * fps && frame <= 4 * fps} // Mute between 2s and 4s
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Speed
|
|
122
|
+
|
|
123
|
+
Use `playbackRate` to change the playback speed:
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
<Audio src={staticFile("audio.mp3")} playbackRate={2} /> {/* 2x speed */}
|
|
127
|
+
<Audio src={staticFile("audio.mp3")} playbackRate={0.5} /> {/* Half speed */}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Reverse playback is not supported.
|
|
131
|
+
|
|
132
|
+
## Looping
|
|
133
|
+
|
|
134
|
+
Use `loop` to loop the audio indefinitely:
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
<Audio src={staticFile("audio.mp3")} loop />
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Use `loopVolumeCurveBehavior` to control how the frame count behaves when looping:
|
|
141
|
+
|
|
142
|
+
- `"repeat"`: Frame count resets to 0 each loop (default)
|
|
143
|
+
- `"extend"`: Frame count continues incrementing
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
<Audio
|
|
147
|
+
src={staticFile("audio.mp3")}
|
|
148
|
+
loop
|
|
149
|
+
loopVolumeCurveBehavior="extend"
|
|
150
|
+
volume={(f) => interpolate(f, [0, 300], [1, 0])} // Fade out over multiple loops
|
|
151
|
+
/>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Pitch
|
|
155
|
+
|
|
156
|
+
Use `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
<Audio
|
|
160
|
+
src={staticFile("audio.mp3")}
|
|
161
|
+
toneFrequency={1.5} // Higher pitch
|
|
162
|
+
/>
|
|
163
|
+
<Audio
|
|
164
|
+
src={staticFile("audio.mp3")}
|
|
165
|
+
toneFrequency={0.8} // Lower pitch
|
|
166
|
+
/>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Pitch shifting only works during server-side rendering, not in the Remotion Studio preview or in the `<Player />`.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: calculate-metadata
|
|
3
|
+
description: Dynamically set composition duration, dimensions, and props
|
|
4
|
+
metadata:
|
|
5
|
+
tags: calculateMetadata, duration, dimensions, props, dynamic
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Using calculateMetadata
|
|
9
|
+
|
|
10
|
+
Use `calculateMetadata` on a `<Composition>` to dynamically set duration, dimensions, and transform props before rendering.
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<Composition
|
|
14
|
+
id="MyComp"
|
|
15
|
+
component={MyComponent}
|
|
16
|
+
durationInFrames={300}
|
|
17
|
+
fps={30}
|
|
18
|
+
width={1920}
|
|
19
|
+
height={1080}
|
|
20
|
+
defaultProps={{ videoSrc: "https://remotion.media/video.mp4" }}
|
|
21
|
+
calculateMetadata={calculateMetadata}
|
|
22
|
+
/>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Setting duration based on a video
|
|
26
|
+
|
|
27
|
+
Use the [`getVideoDuration`](./get-video-duration.md) and [`getVideoDimensions`](./get-video-dimensions.md) skills to get the video duration and dimensions:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { CalculateMetadataFunction } from "remotion";
|
|
31
|
+
import { getVideoDuration } from "./get-video-duration";
|
|
32
|
+
|
|
33
|
+
const calculateMetadata: CalculateMetadataFunction<Props> = async ({
|
|
34
|
+
props,
|
|
35
|
+
}) => {
|
|
36
|
+
const durationInSeconds = await getVideoDuration(props.videoSrc);
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
durationInFrames: Math.ceil(durationInSeconds * 30),
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Matching dimensions of a video
|
|
45
|
+
|
|
46
|
+
Use the [`getVideoDimensions`](./get-video-dimensions.md) skill to get the video dimensions:
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { CalculateMetadataFunction } from "remotion";
|
|
50
|
+
import { getVideoDuration } from "./get-video-duration";
|
|
51
|
+
import { getVideoDimensions } from "./get-video-dimensions";
|
|
52
|
+
|
|
53
|
+
const calculateMetadata: CalculateMetadataFunction<Props> = async ({
|
|
54
|
+
props,
|
|
55
|
+
}) => {
|
|
56
|
+
const dimensions = await getVideoDimensions(props.videoSrc);
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
width: dimensions.width,
|
|
60
|
+
height: dimensions.height,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Setting duration based on multiple videos
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
const calculateMetadata: CalculateMetadataFunction<Props> = async ({
|
|
69
|
+
props,
|
|
70
|
+
}) => {
|
|
71
|
+
const metadataPromises = props.videos.map((video) =>
|
|
72
|
+
getVideoDuration(video.src),
|
|
73
|
+
);
|
|
74
|
+
const allMetadata = await Promise.all(metadataPromises);
|
|
75
|
+
|
|
76
|
+
const totalDuration = allMetadata.reduce(
|
|
77
|
+
(sum, durationInSeconds) => sum + durationInSeconds,
|
|
78
|
+
0,
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
durationInFrames: Math.ceil(totalDuration * 30),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Setting a default outName
|
|
88
|
+
|
|
89
|
+
Set the default output filename based on props:
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
const calculateMetadata: CalculateMetadataFunction<Props> = async ({
|
|
93
|
+
props,
|
|
94
|
+
}) => {
|
|
95
|
+
return {
|
|
96
|
+
defaultOutName: `video-${props.id}.mp4`,
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Transforming props
|
|
102
|
+
|
|
103
|
+
Fetch data or transform props before rendering:
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
const calculateMetadata: CalculateMetadataFunction<Props> = async ({
|
|
107
|
+
props,
|
|
108
|
+
abortSignal,
|
|
109
|
+
}) => {
|
|
110
|
+
const response = await fetch(props.dataUrl, { signal: abortSignal });
|
|
111
|
+
const data = await response.json();
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
props: {
|
|
115
|
+
...props,
|
|
116
|
+
fetchedData: data,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The `abortSignal` cancels stale requests when props change in the Studio.
|
|
123
|
+
|
|
124
|
+
## Return value
|
|
125
|
+
|
|
126
|
+
All fields are optional. Returned values override the `<Composition>` props:
|
|
127
|
+
|
|
128
|
+
- `durationInFrames`: Number of frames
|
|
129
|
+
- `width`: Composition width in pixels
|
|
130
|
+
- `height`: Composition height in pixels
|
|
131
|
+
- `fps`: Frames per second
|
|
132
|
+
- `props`: Transformed props passed to the component
|
|
133
|
+
- `defaultOutName`: Default output filename
|
|
134
|
+
- `defaultCodec`: Default codec for rendering
|