Basic questions


I have an upcoming project with several pis and wide displays. We need to display videos, overlay other videos, images, and sometimes color boxes (greenbox). I have some questions, if I may.

-can I put -1 in the speed for reverse playback? I tried and now 0 is the minimum…can this be done?

-is there a way to adjust color saturation or hue?

-can we adjust the volume or mute the audio output?

-h264 doesnt have alpha channel. The alpha command in the raw only makes it darker? will h264 support alpha?

-can the images, and color boxes (gl.clear) or texts have layer numbers? e.g. put them over or under video files

I guess you’re referring to the video:speed function. If so: No. You cannot reverse the video speed. The hardware decoder cannot decoder backwards. That’s not a mode of operation that’s supported and won’t be in the future. Doing that completely messes up with how one would read the video stream and of course in general videos are using P/I-frames that are written out and refer to sequentially. Of course in theory that’s possible, by jumping back to each I-frame, decoding all following pictures and then presenting them backwards, but that’s not something that info-beamer will support.

Not if you use the raw=true mode of operation, which is required to directly place videos on the screen. If you use raw=false and thus render into an GL texture, you can technically run every pixel through a fragment shader and apply realtime effects like that. But that’s very costly and you can only expect a smooth playback with something like 640x480 videos or smaller. FullHD definitely won’t work.

That’s not supported at the moment, as the way info-beamer outputs hardware uses a fairly lowlevel interface that doesn’t expose volume control. It should be possible to switch over to something like alsa in the future where this would be possible, but that’s not something that will happen in the near future.

Is doesn’t make it darker but more transparent. If you happen to have a black background, it’ll get darker of course. On top of other content, you gradually see more of that content. What do you expect the :alpha() function to do?

No. It’s not possible for individual GL content (like images, fonts, etc) to each have layer numbers. All content except raw videos are always in the same layer. From the technical side, all images, fonts, GL videos (raw=false), etc are rendered with GL. There is only one GL layer on the screen. You can of course influence to order within the GL layer by (for example) rendering an image first and then writing text on top of that.

Raw videos are an exception and they each have their own layer and can be rendered below or above all GL content. So it’s not possible to have a raw video with (for example) an image above and one below it at the same time. See also for a bit of background on that.

But it is possible to have a video behind all GL content and/or in front of it by using the :layer() function. I also just realized that for some reason that’s undocumented. It’ll be added with the next website update. In general it works like this:

local vid = resource.load_video{
   file = "bla.mp4",
   raw = true

-- later
vid:place(0, 0, WIDTH, HEIGHT):layer(-1) -- draw behind everything
-- or
vid:place(0, 0, WIDTH, HEIGHT):layer(1) -- draw above everything

The value to layer() is relative to the GL layer. You can also place raw videos relative to each other using numbers from -10 to 10, without 0.

What I need is to have a video, which has 100% transparent (white on alpha) and 0% transparent (black on alpha) parts. H264 videos have no alpha channel. you can modify the opacity of the rgb videos and make them more transparent, but since they cannot contain an alpha channel, they will not have seethru parts. Like if I need an animated text over a video, normally I’d create the animated text, and export it in a video file with alpha channel, with the area round the text white on the alpha. Since the function is called alpha, not opacity, I thought there might be a workaround I dont know.

Since H265 can contain an alpha channel, it would be nice if we can use that.

The output the HEVC hardware decoder produces doesn’t have an alpha channel in the implementation I know. So at least for now that’s not possible.

I don’t know how the final official V4L2 will work, but I’d be surprised if an alpha channel will be supported for HEVC in the future as that would put additional load on the hardware video scaler and a 4K frame is already pretty heavy without alpha channel. But I don’t know for sure. We’ll have to wait until that’s released by the Pi foundation.

Thank you very much!

By the way: The video related documentation section has been updated and :layer()is now documented.