[FFmpeg-user] streamselect in a realtime application

Michael Koch astroelectronic at t-online.de
Mon Jun 13 23:20:48 EEST 2022


Hello,

I'm using FFmpeg for a realtime wormhole simulation in a planetarium. 
There are two inputs:
a) An equirectangular video for the environment.
b) A realtime stream from a 360° camera, this is mapped inside the wormhole.

Both inputs are stitched together with xstack, and then a suitable remap 
function is applied. The output is in fisheye format and streamed to the 
planetarium projector. So far, that's working fine.

But I also want to switch the wormhole on and off at certain times (t1 
and t2). To do this, I did try two approaches:

Approach 1:
Two streams are generated, one without and the other with wormhole. Then 
one of them is selected by a streamselect filter. The drawback of this 
approach is that double CPU power is required. Both streams must be 
generated by remap filters, although only one of them is used.

Approach 2:
I use two sets of xmap and ymap files for the remap filter. One set 
without and the other set with wormhole:
[xmap1][xmap2]streamselect at 1=map=0[xmap];[ymap1][ymap2]streamselect at 2=map=0[ymap];[a][xmap][ymap]remap...
The drawback of this approach is that I must use -loop 1 before each of 
the four mapping file inputs. Which means the files are reloaded for 
each frame. This is a huge waste of time. If I don't use -loop 1, then 
it seems the streamselect filters don't work.

Any ideas how this could be made faster?

Michael



More information about the ffmpeg-user mailing list