]> git.sesse.net Git - nageru-docs/blobdiff - video.rst
Document the return value of choose() and how it is useful.
[nageru-docs] / video.rst
index d42fce3dfc13404d5e4a237712a4cffd3a616b01..ee2c1b59a85f73e7d66153fe7cde8443a984ce30 100644 (file)
--- a/video.rst
+++ b/video.rst
@@ -9,10 +9,14 @@ flexible and can be used also for other things.
 
 Before reading trying to use video inputs, you should read and understand how
 themes work in general (see :doc:`theme`). Video inputs are available from
-Nageru 1.6.0 onwards. There is currently no support for audio from video inputs;
-all videos are silent. (This may change in the future.) If a file contains
-multiple video streams, like different angles or resolutions, only the first
-will be used.
+Nageru 1.6.0 onwards, and from Nageru 1.7.2, you can get audio from video inputs
+like any other input. (Be advised, though, that making a general video player
+that can maintain A/V sync on all kinds of video files is a hard problem,
+so there may still be bugs in this support.)
+
+If a file contains multiple video streams, like different
+angles or resolutions, only the first will be used. Similarly, only the first
+audio stream is used, and it's always converted to 48 kHz stereo.
 
 
 Basic video inputs
@@ -40,18 +44,13 @@ or, for a network stream, perhaps::
 
   local video = VideoInput.new("http://localhost/file.nut", Nageru.VIDEO_FORMAT_BGRA)
 
-It can then be added to any chain like this::
-
-  local input = chain:add_video_input(video, false)
+It can then be display on an input like usual::
 
-The second parameter specifies no deinterlacing. Note that interlaced video
-is currently not supported, not even with deinterlacing, so this parameter
-must always be false.
+  input:display(video)
 
-You can use the same video object to create many different video inputs::
-  
-  local input1 = chain1:add_video_input(video, false)
-  local input2 = chain2:add_video_input(video, false)
+Note that interlaced video is currently not supported, not even with deinterlacing.
+(Before Nageru 1.9.0, video inputs were distinct from live inputs, and had to
+be created differently, but this is no longer the case.)
 
 Videos run in the correct frame rate and on their own timer (generally the
 system clock in the computer), and loop when they get to the end or whenever an
@@ -88,14 +87,41 @@ You can also change its rate, e.g. by::
   video:change_rate(2.0)
 
 This will make it play at twice its usual speed. Your rate should not be
-negative nor exactly zero. Be aware that once you've set a rate, the player
-will wait for the next frame before considering any other commands,
-so if you set your rate to e.g. 0.001 to nearly stop it, you will indeed
-need to wait 16.67 seconds (assuming 60 fps video) before you can speed it
-up again. This restriction may be lifted in the future.
+negative nor exactly zero. You can set a rate to e.g. 1e-6 if you want to
+in practice stop the video; once you change it back to normal speed,
+the next frame will resume playing. Be aware that changing the rate may
+make the audio behave unpredictably; there are no attempts to do time
+stretching or change the pitch accordingly.
+
+Finally, if you want to forcibly abort the playing of a video,
+even one that is blocking on I/O, you can use (since Nageru 1.7.2)::
+
+  video:disconnect()
+
+This is particularly useful when dealing with network streams, as FFmpeg does not
+always properly detect if the connection has been lost. See :ref:`menus`
+for a way to expose such functionality to the operator.
+
+.. _subtitle-ingest:
+
+Ingesting subtitles
+-------------------
+
+Video streams can contain separate subtitle tracks. Since Nageru 1.8.1,
+you can read these streams. This is particularly useful when using Nageru
+and Futatabi together (see :ref:`talkback`).
+
+To get the last subtitle given before the current video frame, call
+“signals:get_last_subtitle(n)” from get_chain, where n is the signal number
+of your video signal. It will either contain nil, if there hasn't been
+a subtitle, or else the raw subtitle. Note that if the video frame and
+the subtitle occur on the exact same timestamp, and the video frame
+is muxed before the subtitle packet, the subtitle will not make it in time.
+(Futatabi puts the subtitle slightly ahead of the video frame to avoid this.)
 
 
 Integration with CasparCG
 -------------------------
 
-TODO
+This section has been removed, as since 1.7.0, Nageru has :doc:`native support for HTML5 inputs <html>`,
+obsoleting CasparCG integration.