]> git.sesse.net Git - nageru-docs/blob - video.rst
Start documenting videos.
[nageru-docs] / video.rst
1 Video inputs
2 ============
3
4 This section deals with video inputs from other sources than regular
5 capture cards (which are typically known as “live inputs”, although
6 they also carry video). The most obvious example would be a video file on disk
7 (say, to play in a loop during pauses), but video inputs are quite
8 flexible and can be used also for other things.
9
10 Before reading trying to use video inputs, you should read and understand how
11 themes work in general (see :doc:`theme`). Video inputs are available from
12 Nageru 1.6.0 onwards. There is currently no support for audio from video inputs;
13 all videos are silent. (This may change in the future.) If a file contains
14 multiple video streams, like different angles or resolutions, only the first
15 will be used.
16
17
18 Basic video inputs
19 ------------------
20
21 Adding video to an existing chain happens in two phases; first, the video
22 must be *loaded*, giving it an identifier, and then that video can be used
23 as inputs in a chain, much like :ref:`images <images>` or regular live inputs.
24 Anything FFmpeg accepts, including network streams, can be used (probably even
25 V4L input cards, although this is untested).
26
27 When loading a video, you need to decide what format to use; Y'CbCr or BGRA.
28 (Whatever you choose, if you get a mismatch with what the video actually is in,
29 FFmpeg will convert it on the CPU with no warning.) Most video is Y'CbCr,
30 so this should be your default unless you know the video is encoded as RGB/BGR,
31 and/or it has an alpha channel you want to use. Getting the format right makes
32 for better efficiency; you not only save a conversion step on the CPU, but
33 sometimes also on the GPU.
34
35 Videos are loaded like this:
36
37   local video = VideoInput.new("filename.mp4", Nageru.VIDEO_FORMAT_YCBCR)
38
39 or, for a network stream, perhaps:
40
41   local video = VideoInput.new("http://localhost/file.nut", Nageru.VIDEO_FORMAT_BGRA)
42
43 It can then be added to any chain like this:
44
45   local input = chain:add_video_input(video, false)
46
47 The second parameter specifies no deinterlacing. Note that interlaced video
48 is currently not supported, not even with deinterlacing, so this parameter
49 must always be false.
50
51 You can use the same video object to create many different video inputs:
52   
53   local input1 = chain1:add_video_input(video, false)
54   local input2 = chain2:add_video_input(video, false)
55
56 Videos run in the correct frame rate and on their own timer (generally the
57 system clock in the computer), and loop when they get to the end or whenever an
58 error occurs. If a video is changed while you're running Nageru, it will be
59 reloaded (just like images) when it's at its end—but be aware, unless you're
60 moving the new file atomically into place, you could end up corrupting the file
61 Nageru is playing from, causing it to automatically rewind before the end of
62 the segment.
63
64
65 Controlling video playback
66 --------------------------
67
68 TODO
69
70 Integration with CasparCG
71 -------------------------
72
73 TODO