Difference between revisions of "VLC HowTo/Make a mosaic"

From VideoLAN Wiki
Jump to navigation Jump to search
Line 76: Line 76:
 
  --mosaic-position 1 --mosaic-order 1,2,3
 
  --mosaic-position 1 --mosaic-order 1,2,3
 
</pre>
 
</pre>
 +
 +
== Other examples ==
 +
 +
=== Dual webcam with alphamask ===
 +
<pre>new isight broadcast
 +
setup isight input v4l2:///dev/video0:width=320:height=240:audio-method=0
 +
setup isight option v4l2-brightness=90
 +
setup isight output #mosaic-bridge{chroma=YUVA,vfilter=alphamask{mask=../mask.png},width=320,height=240}
 +
setup isight enabled
 +
 +
new logitech broadcast
 +
setup logitech input v4l2:///dev/video1:width=640:height=480:audio-method=0
 +
setup logitech output #transcode{vcodec=mp4v,vb=1024,sfilter="mosaic:marq{marquee='VLC dual webcam setup',position=8}"}:bridge-in:display
 +
setup logitech enabled
 +
 +
new audio broadcast enabled
 +
setup audio input v4l:///dev/dsp1
 +
setup audio output #transcode{acodec=mp4a,ab=128}:bridge-out
 +
 +
control isight play
 +
#control audio play
 +
control logitech play</pre>
 +
 +
You can then launch it with:
 +
vlc --vlm-conf ../dual-webcam.conf --no-media-library --plugin-path modules -v --no-video-title --mosaic-keep-picture
 +
 +
The mask.png file is used to set transparency values on the isight camera (uses the png alpha plane). An example file to use is available at http://people.videolan.org/~dionoea/mosaic/.
  
 
==See Also==
 
==See Also==

Revision as of 14:13, 24 August 2008

This page describes how to set up a mosaic of a few videos or stream like a TV portal. Other "how to" pages

VLC mosaic howto

This is a small example about how to use VLC media player to create a mosaic. What we basically want is a video mosaic mixing 3 video channels (channels 1, 2 and 3) on a background image (background.png) and streaming the resulting video on the network. Note that we will also be streaming the 3 sound tracks from channels 1, 2 and 3 in the same mpeg-ts stream.

Starting with VLC 0.8.5-test2, the http interface features a "Mosaic wizard". You might want to use it if you have no knowledge of VLC command line usage.

mosaic1.png

Other neat examples :

12 video mosaic

20 video mosaic

20 video mosaic

Step 0

Read the VLC streaming howto (chapters 3 and 5 concerning command line and vlm usage in VLC) : http://videolan.org/doc/

Step 1

Get VLC 0.8.4-test1 or newer and install it on your computer.

Step 2

You now have to get a background image. Many image formats are supported (JPEG, PNG ...).

You can also test it with VLC to see if it displays locally :

./vlc --fake-file background.png --fake-aspect-ratio "4:3" fake:

Step 3

You now need to configure VLC to get the 3 source streams and blend them on the background image.

The vlm configuration file looks like :

new channel1 broadcast enabled                                                       
setup channel1 input udp://@239.255.2.60:1234                                        
setup channel1 output #duplicate{dst=mosaic-bridge{id=1,height=144,width=180},select=video,dst=bridge-out{id=1},select=audio}                                                         
                                                                                
new channel2 broadcast enabled
setup channel2 input udp://@239.255.10.200:1234
setup channel2 output #duplicate{dst=mosaic-bridge{id=2,height=144,width=180},select=video,dst=bridge-out{id=2},select=audio}                                                         

new channel3 broadcast enabled
setup channel3 input udp://@239.255.6.9:1234
setup channel3 output #duplicate{dst=mosaic-bridge{id=3,height=144,width=180},select=video,dst=bridge-out{id=3},select=audio}                                                         

new background broadcast enabled
setup background input fake:
setup background output #transcode{sfilter=mosaic,vcodec=mp2v,vb=10000,scale=1}:bridge-in{delay=400,id-offset=100}:standard{access=udp,mux=ts,url=239.255.12.42,sap,name="mosaic"}

control background play
control channel1 play
control channel2 play
control channel3 play

Note that the source streams are network streams, which is likely to be the case if you're considering doing a mosaic.

Step 4

And now, the right command to launch vlc :

./vlc --color -I telnet --vlm-conf ../mosaic.vlm.conf --ttl 12 \
 --fake-file background.png --fake-aspect-ratio "4:3" \
 --mosaic-width 360 --mosaic-height 288 --udp-caching 800 \
 --mosaic-keep-picture --mosaic-rows 2 --mosaic-cols 2 \
 --mosaic-position 1 --mosaic-order 1,2,3

Other examples

Dual webcam with alphamask

new isight broadcast
setup isight input v4l2:///dev/video0:width=320:height=240:audio-method=0
setup isight option v4l2-brightness=90
setup isight output #mosaic-bridge{chroma=YUVA,vfilter=alphamask{mask=../mask.png},width=320,height=240}
setup isight enabled

new logitech broadcast
setup logitech input v4l2:///dev/video1:width=640:height=480:audio-method=0
setup logitech output #transcode{vcodec=mp4v,vb=1024,sfilter="mosaic:marq{marquee='VLC dual webcam setup',position=8}"}:bridge-in:display
setup logitech enabled

new audio broadcast enabled
setup audio input v4l:///dev/dsp1
setup audio output #transcode{acodec=mp4a,ab=128}:bridge-out

control isight play
#control audio play
control logitech play

You can then launch it with:

vlc --vlm-conf ../dual-webcam.conf --no-media-library --plugin-path modules -v --no-video-title --mosaic-keep-picture

The mask.png file is used to set transparency values on the isight camera (uses the png alpha plane). An example file to use is available at http://people.videolan.org/~dionoea/mosaic/.

See Also

Appendix