Hi,

For a performance I decided to use Liquidsoap for it's fallback
functions and cli environment capabilities. It took me a while to be
able to read the scriptlang but now I can slowly get some things done
with it.

What I want to achieve is to control LS by OSC to make it run Videoclips
on some point during a live performance. If the Clips don't run I want
to fallback on a short Videoclip with mute sound to maintain the stream.
The stream is sent to a local network of audience which can log in on
the network and receive the videostream on their phone.

So far, this part is working. See code below (I admit it was a bit of a
hack and if there is a more elegant way in the realm of LS I would be
very happy to learn it).

The next step I need to accomplish, is to mix sound from an Alsa device,
on top of whatever is playing from the Videoclips, in other words, I
need to mix a source with only audio (2,0,0) together with a source
which has video and audio (2,1,0). I am getting a bit stuck there. There
is audio_mux which seem to get rid of the audio - which I don't want - ,
there is stereo_mux which seem to add channels to a stream (like in
(2+2,1,0) ), which I don't want either. Then there is add, which does
not work because there is a type difference.

In other words, how can I do this in LS?? Or is the closest solution to
make a video stream out of the input.alsa() combining it with a
transparent image, then summing that to the other stream?

The working script until the point of summing the alsa audio is like the
following code (had to misuse the /metadata osc_path a bit for my own
purpose. It seems that naming the osc_path is not really a free
choice??). Any help greatly appreciated!

Cheers, Jeroen


`
set("log.file.path","/usr/local/src/srs/JV_test/liqsoap.log")
set("log.level",10)

set("video.converter.preferred", "ffmpeg")
set("frame.video.width", 680)
set("frame.video.height", 360)
set("frame.video.samplerate", 25)
set("osc.port",8000)
set("gstreamer.add_borders", false)
set("clock.allow_streaming_errors",false)


# function for OSC parsing

def on_command(m) =
  print("Hello World")
  if ( fst(m) == "command" ) then
      if ( snd(m) == "quit" ) then
        print("Quit received - quitting LiquidSoap ")
        execShell = 'echo "" > /VIDEOS/play_now.pls'
        print( run_process(execShell) )
        garbage_collect()
        shutdown()

      elsif( snd(m) == "one" ) then
        print("One received - playing video one")
        execShell = 'cat /VIDEOS/test_once.pls > /VIDEOS/play_now.pls'
        print( run_process(execShell) )

      elsif( snd(m) == "two" ) then
        print("Two received - playing video two")
        execShell = 'cat /VIDEOS/playlist.pls > /VIDEOS/play_now.pls'
        print( run_process(execShell) )

      end
    else
    print("Invalid command - ignored")
  end 
end


source = playlist.once(reload_mode="watch", "/VIDEOS/play_now.pls")

source = fallback(track_sensitive=true, [source,
single("/VIDEOS/break.mp4")] )

osc.on_string_pair("/metadata",on_command)

output.gstreamer.audio_video(
  video_pipeline=
    "videoconvert ! x264enc bitrate=3500 ! video/x-h264,profile=baseline
! queue ! mux.",
  audio_pipeline=
    "audioconvert ! voaacenc bitrate=96000 ! queue ! mux.",
  pipeline=
    "flvmux name=mux ! rtmpsink
location=\"rtmp://sc.cs:1935/live/livestream live=1\" ",
  source)

`



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to