Skip to content

Commit 5520784

Browse files
committed
Add corrections and links to FFmpeg issues.
1 parent 00d0153 commit 5520784

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

tutorials/animation/playing_videos.rst

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Supported playback formats
1010

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

1615
H.264 and H.265 cannot be supported in core Godot, as they are both encumbered
1716
by software patents. AV1 is royalty-free, but it remains slow to decode on the
@@ -156,6 +155,8 @@ There are several limitations with the current implementation of video playback
156155
- Changing playback speed is not supported. VideoStreamPlayer also won't follow
157156
:ref:`Engine.time_scale<class_Engine_property_time_scale>`.
158157
- Streaming a video from a URL is not supported.
158+
- Audio output is always mono or stereo. Files with 4, 5.1 and 7.1 audio
159+
channels are supported but down-mixed to stereo.
159160

160161
.. _doc_playing_videos_recommended_theora_encoding_settings:
161162

@@ -197,9 +198,10 @@ below with almost any input video format (AVI, MOV, WebM, …).
197198

198199
.. warning::
199200

200-
FFmpeg will erroneuosly drop identical frames when performing a copy of a
201+
FFmpeg will erroneously drop identical frames when performing a copy of a
201202
Theora stream producing an incorrect video file. Avoid it by always
202-
transcoding video.
203+
transcoding video. See `FFmpeg issue #11451
204+
<https://trac.ffmpeg.org/ticket/11451>`__.
203205

204206
Balancing quality and file size
205207
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -223,18 +225,25 @@ dropouts in case of high system load. See
223225
for a table listing Ogg Vorbis audio quality presets and their respective
224226
variable bitrates.
225227

226-
The **GOP size** (``-g:v``) can provide further compression by increasing the
227-
interval between keyframes. The default value is pretty low (12). Higher values
228-
can provide better compression at the expense of some quality and slightly
229-
slower seeks. Increasing GOP size usually produces better results than reducing
230-
video quality and it's thus recommended.
228+
The **GOP (Group of Pictures) size** (``-g:v``) can provide better compression
229+
by increasing the max interval between keyframes. The default value (``12``) is
230+
pretty low. Higher values can provide better compression with almost no impact
231+
on quality and only slightly slower seeks. Increasing it produces better
232+
results than reducing video quality and it's thus recommended. As the value
233+
increases, compression benefits decrease until there's no practical improvement
234+
anymore.
231235

232236
.. note::
233237

234-
GOP sizes above 64 will cause seeks to be slower, more noticeably beyond
235-
every power of two. Also, due to some supposed bug in FFmpeg, using a GOP
236-
size greater than 64 can slow down seeking even more and might create bigger
237-
files.
238+
GOP size values going past powers of two counting from ``64`` will increase
239+
seek times slightly more. Thus, recommended values to try if you want best
240+
compression/seek times ratios are ``64``, ``128``, ``256``…
241+
242+
.. warning::
243+
244+
When encoding with FFmpeg, using a GOP size greater than ``64`` can slow
245+
down seeking even more and might not always improve compression. See `FFmpeg
246+
issue #11454 <https://trac.ffmpeg.org/ticket/11454>`__.
238247

239248
FFmpeg: Convert while preserving original video resolution
240249
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -246,7 +255,7 @@ static scenes).
246255

247256
::
248257

249-
ffmpeg -i input.mp4 -q:v 6 -g:v 30 -q:a 6 output.ogv
258+
ffmpeg -i input.mp4 -q:v 6 -g:v 64 -q:a 6 output.ogv
250259

251260
FFmpeg: Resize the video then convert it
252261
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -257,7 +266,7 @@ significantly if the source is recorded at a higher resolution than 720p:
257266

258267
::
259268

260-
ffmpeg -i input.mp4 -vf "scale=-1:720" -q:v 6 -g:v 30 -q:a 6 output.ogv
269+
ffmpeg -i input.mp4 -vf "scale=-1:720" -q:v 6 -g:v 64 -q:a 6 output.ogv
261270

262271

263272
.. Chroma Key Functionality Documentation

0 commit comments

Comments
 (0)