Skip to content

Commit 992b11c

Browse files
committed
Update playing videos
Add information about GOP size and caveats using FFmpeg.
1 parent f2d2133 commit 992b11c

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

tutorials/animation/playing_videos.rst

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Godot supports video playback with the :ref:`class_VideoStreamPlayer` node.
88
Supported playback formats
99
--------------------------
1010

11-
The only supported format in core is **Ogg Theora** (not to be confused with Ogg
12-
Vorbis audio). It's possible for extensions to bring support for additional
13-
formats, but no such extensions exist yet as of July 2022.
11+
The only supported format in core is **Ogg Theora** (not to be confused with
12+
Ogg Vorbis audio) with optional Ogg Vorbis audio tracks. It's possible for
13+
extensions to bring support for additional formats.
1414

1515
H.264 and H.265 cannot be supported in core Godot, as they are both encumbered
1616
by software patents. AV1 is royalty-free, but it remains slow to decode on the
@@ -156,6 +156,7 @@ There are several limitations with the current implementation of video playback
156156
- Changing playback speed is not supported. VideoStreamPlayer also won't follow
157157
:ref:`Engine.time_scale<class_Engine_property_time_scale>`.
158158
- Streaming a video from a URL is not supported.
159+
- Only mono and stereo audio output is supported.
159160

160161
.. _doc_playing_videos_recommended_theora_encoding_settings:
161162

@@ -195,6 +196,15 @@ below with almost any input video format (AVI, MOV, WebM, …).
195196
You can check this by running ``ffmpeg`` without any arguments, then looking
196197
at the ``configuration:`` line in the command output.
197198

199+
.. warning::
200+
201+
All FFmpeg releases before Feb 20th, 2025 could produce bad video streams
202+
due to a couple of bugs. It's highly recommended to use one of the latest
203+
static daily builds, or build FFmpeg from their master branch where they're
204+
already fixed. More details in `FFmpeg issue #11451
205+
<https://trac.ffmpeg.org/ticket/11451>`__ and `FFmpeg issue #11454
206+
<https://trac.ffmpeg.org/ticket/11454>`__.
207+
198208
Balancing quality and file size
199209
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200210

@@ -217,6 +227,14 @@ dropouts in case of high system load. See
217227
for a table listing Ogg Vorbis audio quality presets and their respective
218228
variable bitrates.
219229

230+
The **GOP (Group of Pictures) size** (``-g:v``) is the max interval between
231+
keyframes. Increasing this value can improve compression with almost no impact
232+
on quality. The valid range goes from ``0`` to ``2,147,483,648``, although
233+
compression benefits will fade away and even be reversed as the GOP size
234+
increases. The default size (``12``) is too low for most types of content, it's
235+
therefore recommended to test higher GOP sizes before reducing video quality.
236+
Values between ``64`` and ``512`` usually give the best compression.
237+
220238
FFmpeg: Convert while preserving original video resolution
221239
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
222240

@@ -227,7 +245,7 @@ static scenes).
227245

228246
::
229247

230-
ffmpeg -i input.mp4 -q:v 6 -q:a 6 output.ogv
248+
ffmpeg -i input.mp4 -q:v 6 -q:a 6 -g:v 64 output.ogv
231249

232250
FFmpeg: Resize the video then convert it
233251
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -238,7 +256,7 @@ significantly if the source is recorded at a higher resolution than 720p:
238256

239257
::
240258

241-
ffmpeg -i input.mp4 -vf "scale=-1:720" -q:v 6 -q:a 6 output.ogv
259+
ffmpeg -i input.mp4 -vf "scale=-1:720" -q:v 6 -q:a 6 -g:v 64 output.ogv
242260

243261

244262
.. Chroma Key Functionality Documentation

0 commit comments

Comments
 (0)