Skip to content

Add support for embedding videos in documentation pages#9092

Merged
mhilbrunner merged 1 commit intogodotengine:masterfrom
Calinou:add-video-support
Apr 8, 2024
Merged

Add support for embedding videos in documentation pages#9092
mhilbrunner merged 1 commit intogodotengine:masterfrom
Calinou:add-video-support

Conversation

@Calinou
Copy link
Copy Markdown
Member

@Calinou Calinou commented Mar 13, 2024

This is more efficient1 than GIFs, animated PNGs or WebPs, while also providing controls and audio playback if needed.

Ideally, we'd ship AV1 versions of the videos for more optimized file sizes, but macOS/iOS Safari only support these on very recent devices (there's no CPU decoding fallback). Therefore, we'll settle on VP9 for now, which is supported on all platforms (including iOS) since iOS 17.4 was recently released.

A video has been committed to replace the introductory GIF in the Prototyping levels with CSG page.

Footnotes

  1. Not necessarily smaller in file size, but there's a potential to achieve much higher quality and smoother framerates. There's also more control over framerates compared to GIF – proper 30 FPS and 60 FPS are feasible with videos, not GIFs as they can only specify frame duration by 10 ms intervals.

@Calinou Calinou added enhancement content:website Issues related to adding website features and fixing bugs, whether on the front or back-end labels Mar 13, 2024
@Calinou Calinou force-pushed the add-video-support branch 2 times, most recently from 58fbfcb to 06c89b0 Compare March 13, 2024 15:46
@skyace65
Copy link
Copy Markdown
Contributor

Are there any codec issues with this on Linux? I know some patented ones got turned off by default last year in several distros.

EDIT: also how consistent is compression size for MP4? Because I know there is variation with images like webp (squoosh will get you a smaller lossless webp than krita).

@Calinou
Copy link
Copy Markdown
Member Author

Calinou commented Mar 16, 2024

Are there any codec issues with this on Linux? I know some patented ones got turned off by default last year in several distros.

This is still an issue on Fedora out of the box (at least until late 2029), but pretty much everyone enables RPMFusion anyway as other places on the web will often use H.264 without any fallback. Other distributions don't have this issue and have H.264 support out of the box.

EDIT: also how consistent is compression size for MP4? Because I know there is variation with images like webp (squoosh will get you a smaller lossless webp than krita).

x264 is the most popular CPU-based encoder these days; it's what FFmpeg uses. If you record a MP4 directly from screen recording software, you'll want to re-encode it to get more efficient file sizes (real-time encoding always makes efficiency tradeoffs in favor of speed).

@Calinou
Copy link
Copy Markdown
Member Author

Calinou commented Mar 20, 2024

It turns out VP9 is supported in iOS 17.4 and later, so we could actually use VP9 everywhere without a fallback: https://caniuse.com/webm

This is a very recent development (VP8 is also supported, and so is Vorbis/Opus audio - not within the Ogg container though). This means iOS 17.4 isn't widely deployed yet, but by the time Godot 4.3 is released (if this PR isn't cherry-picked), I expect it to catch up somewhat.

This means we can also support Linux distributions without RPMFusion enabled out of the box. VP9 is also more efficient than H.264, so it'll result in smaller file sizes or better quality at the same file size.

@skyace65
Copy link
Copy Markdown
Contributor

I'd say go for VP9 then.

@Calinou Calinou force-pushed the add-video-support branch from 06c89b0 to ce4663e Compare March 27, 2024 18:56
@Calinou
Copy link
Copy Markdown
Member Author

Calinou commented Mar 27, 2024

I'd say go for VP9 then.

Done. I've also updated the documentation image guidelines to add recommendations for creating videos for the documentation.

This is more efficient than GIFs, animated PNGs or WebPs, while also
providing controls and audio playback if needed.
@Calinou Calinou force-pushed the add-video-support branch from ce4663e to 3e3bbde Compare March 27, 2024 18:58
@mhilbrunner
Copy link
Copy Markdown
Member

The only thing I'm wary of here is adding another dependency, but it seems small and simple enough, hopefully. Let's merge and see if we run into any issues in practice on master/4.3.

@mhilbrunner mhilbrunner merged commit 82d44db into godotengine:master Apr 8, 2024
@Calinou Calinou deleted the add-video-support branch April 15, 2024 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

content:website Issues related to adding website features and fixing bugs, whether on the front or back-end enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for embedding videos

3 participants