Video streaming vlc

Материал из ALT Linux Wiki

(Различия между версиями)
Перейти к: навигация, поиск
м (Новая страница: «Сервер ретрансляции: cvlc http://99.99.99.99:8083/stream.flv --ipv4-timeout=1000 --loop --sout '#duplicate{dst=std{access=http{mime=video/x-flv},m...»)
 
(3 промежуточные версии не показаны)
Строка 1: Строка 1:
Сервер ретрансляции:
Сервер ретрансляции:
-
cvlc http://99.99.99.99:8083/stream.flv --ipv4-timeout=1000  --loop --sout '#duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8092/stream.flv},dst="transcode{vcodec=none,acodec=mp4a,ab=96}:std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8093/stream.flv}"}'
+
cvlc http://99.99.99.99:8083/stream.flv --ipv4-timeout=1000  --loop --sout '#duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8092/stream.flv},dst="transcode{vcodec=none,acodec=mp4a,ab=96}:std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8093/stream.flv}"}'
Скрипт запуска:
Скрипт запуска:
-
#/usr/sbin/bash
+
#/usr/sbin/bash
-
echo "**********************************************************"
+
echo "**********************************************************"
-
echo "Для того, чтобы прекратить трансляцию -- закройте ЭТО окно! "
+
echo "Для того, чтобы прекратить трансляцию -- закройте ЭТО окно! "
-
echo "**********************************************************"
+
echo "**********************************************************"
-
 
+
-
echo "**********************************************************"
+
echo "**********************************************************"
-
echo "Если Вы видите эту надпись, но трансляция не идет"
+
echo "Если Вы видите эту надпись, но трансляция не идет"
-
echo "-- закройте ЭТО окно и запустите трансляцию снова."
+
echo "-- закройте ЭТО окно и запустите трансляцию снова."
-
echo "**********************************************************"
+
echo "**********************************************************"
-
 
+
-
echo "**********************************************************"
+
echo "**********************************************************"
-
echo "Для проверки трансляции запустите в терминале"
+
echo "Для проверки трансляции запустите в терминале"
-
echo "vlc http://127.0.0.1:8081/stream.flv"
+
echo "vlc http://127.0.0.1:8081/stream.flv"
-
echo "**********************************************************"
+
echo "**********************************************************"
-
 
+
-
#echo date() >> use.log
+
#echo date() >> use.log
-
#sleep 30
+
#sleep 30
-
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so cvlc --vlm-conf mosaic.vlm
+
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so cvlc --vlm-conf mosaic.vlm
-
 
+
-
Сам mosaic.vlm для одной камеры:
+
-
# Comment the following line if you don't want to reset your VLM configuration
+
-
del all
+
-
 
+
-
# Background options
+
-
new  bg broadcast enabled
+
-
setup bg input    "fake://" option "fake-file=background.png"
+
-
setup bg output    "#transcode{vcodec=h264,keyint=40,vb=320,width=640,height=480,sfilter=mosaic}:bridge-in{offset=50}:duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/stream.flv},dst=std{access=file,mux=ffmpeg{mux=flv},dst=stream.flv}}"
+
-
 
+
-
# Mosaic options
+
-
setup bg option mosaic-alpha=255
+
-
setup bg option mosaic-height=480
+
-
setup bg option mosaic-width=640
+
-
setup bg option mosaic-align=1
+
-
setup bg option mosaic-xoffset=0
+
-
setup bg option mosaic-yoffset=0
+
-
setup bg option mosaic-vborder=0
+
-
setup bg option mosaic-hborder=0
+
-
setup bg option mosaic-position=1
+
-
setup bg option mosaic-rows=1
+
-
setup bg option mosaic-cols=1
+
-
setup bg option mosaic-order=cam1
+
-
setup bg option mosaic-delay=0
+
-
setup bg option mosaic-keep-picture
+
-
 
+
-
# Input options
+
-
 
+
-
new cam1 broadcast
+
-
setup cam1 input "v4l2:///dev/video0:width=640:height=480"
+
-
setup cam1 option v4l2-brightness=115
+
-
setup cam1 option no-sout-audio
+
-
setup cam1 output "#mosaic-bridge{id=cam1},select=video,dst=bridge-out{id=1}}"
+
-
setup cam1 enabled
+
-
 
+
-
 
+
-
new audio broadcast enabled
+
-
setup audio input alsa://hw:1,0
+
-
setup audio output #transcode{acodec=mp4a,samplerate=44100,ab=112}:bridge-out
+
-
 
+
-
 
+
-
# Launch everything
+
-
 
+
-
control audio play
+
-
control bg play
+
-
control cam1 play
+
-
# end of mosaic batch
+
-
 
+
 +
Сам mosaic.vlm для одной камеры (можно было бы обойтись и без мозаики, но так было проще):
 +
# Comment the following line if you don't want to reset your VLM configuration
 +
del all
 +
 +
# Background options
 +
new  bg broadcast enabled
 +
setup bg input    "fake://" option "fake-file=background.png"
 +
setup bg output    "#transcode{vcodec=h264,keyint=40,vb=320,width=640,height=480,sfilter=mosaic}:bridge-in{offset=50}:duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/stream.flv},dst=std{access=file,mux=ffmpeg{mux=flv},dst=stream.flv}}"
 +
 +
# Mosaic options
 +
setup bg option mosaic-alpha=255
 +
setup bg option mosaic-height=480
 +
setup bg option mosaic-width=640
 +
setup bg option mosaic-align=1
 +
setup bg option mosaic-xoffset=0
 +
setup bg option mosaic-yoffset=0
 +
setup bg option mosaic-vborder=0
 +
setup bg option mosaic-hborder=0
 +
setup bg option mosaic-position=1
 +
setup bg option mosaic-rows=1
 +
setup bg option mosaic-cols=1
 +
setup bg option mosaic-order=cam1
 +
setup bg option mosaic-delay=0
 +
setup bg option mosaic-keep-picture
 +
 +
# Input options
 +
 +
new cam1 broadcast
 +
setup cam1 input "v4l2:///dev/video0:width=640:height=480"
 +
setup cam1 option v4l2-brightness=115
 +
setup cam1 option no-sout-audio
 +
setup cam1 output "#mosaic-bridge{id=cam1},select=video,dst=bridge-out{id=1}}"
 +
setup cam1 enabled
 +
 +
 +
new audio broadcast enabled
 +
setup audio input alsa://hw:1,0
 +
setup audio output #transcode{acodec=mp4a,samplerate=44100,ab=112}:bridge-out
 +
 +
 +
# Launch everything
 +
 +
control audio play
 +
control bg play
 +
control cam1 play
 +
# end of mosaic batch
 +
 +
Для трех камер:
Для трех камер:
-
# Comment the following line if you don't want to reset your VLM configuration
+
# Comment the following line if you don't want to reset your VLM configuration
-
del all
+
del all
-
 
+
-
# Background options
+
# Background options
-
new  bg broadcast enabled
+
new  bg broadcast enabled
-
setup bg input    "fake://" option "fake-file=background.png"
+
setup bg input    "fake://" option "fake-file=background.png"
-
setup bg output    "#transcode{vcodec=h264,keyint=40,vb=256, ab=112,fps=12,5,width=960,height=240,sfilter=mosaic}:bridge-in{offset=50}:duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8082/stream.flv},dst=std{access=file,mux=ffmpeg{mux=flv},dst=stream.flv}}"
+
setup bg output    "#transcode{vcodec=h264,keyint=40,vb=256, ab=112,fps=12,5,width=960,height=240,sfilter=mosaic}:bridge-in{offset=50}:duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8082/stream.flv},dst=std{access=file,mux=ffmpeg{mux=flv},dst=stream.flv}}"
-
 
+
-
# Mosaic options
+
# Mosaic options
-
setup bg option mosaic-alpha=255
+
setup bg option mosaic-alpha=255
-
setup bg option mosaic-height=240
+
setup bg option mosaic-height=240
-
setup bg option mosaic-width=960
+
setup bg option mosaic-width=960
-
setup bg option mosaic-align=1
+
setup bg option mosaic-align=1
-
setup bg option mosaic-xoffset=0
+
setup bg option mosaic-xoffset=0
-
setup bg option mosaic-yoffset=0
+
setup bg option mosaic-yoffset=0
-
setup bg option mosaic-vborder=0
+
setup bg option mosaic-vborder=0
-
setup bg option mosaic-hborder=0
+
setup bg option mosaic-hborder=0
-
setup bg option mosaic-position=1
+
setup bg option mosaic-position=1
-
setup bg option mosaic-rows=1
+
setup bg option mosaic-rows=1
-
setup bg option mosaic-cols=3
+
setup bg option mosaic-cols=3
-
setup bg option mosaic-order=cam3,cam2,cam1
+
setup bg option mosaic-order=cam3,cam2,cam1
-
setup bg option mosaic-delay=0
+
setup bg option mosaic-delay=0
-
setup bg option mosaic-keep-picture
+
setup bg option mosaic-keep-picture
-
 
+
-
# Input options
+
# Input options
-
 
+
-
new cam1 broadcast
+
new cam1 broadcast
-
setup cam1 input "v4l2:///dev/video0:width=320:height=240"
+
setup cam1 input "v4l2:///dev/video0:width=320:height=240"
-
setup cam1 option v4l2-brightness=100
+
setup cam1 option v4l2-brightness=100
-
setup cam1 option no-sout-audio
+
setup cam1 option no-sout-audio
-
setup cam1 output "#mosaic-bridge{id=cam1},select=video,dst=bridge-out{id=1}}"
+
setup cam1 output "#mosaic-bridge{id=cam1},select=video,dst=bridge-out{id=1}}"
-
setup cam1 enabled
+
setup cam1 enabled
-
 
+
-
new cam2 broadcast
+
new cam2 broadcast
-
setup cam2 input "v4l2:///dev/video1:width=320:height=240"
+
setup cam2 input "v4l2:///dev/video1:width=320:height=240"
-
#setup cam2 option v4l2-brightness=100
+
#setup cam2 option v4l2-brightness=100
-
setup cam2 option no-sout-audio
+
setup cam2 option no-sout-audio
-
setup cam2 output "#mosaic-bridge{id=cam2},select=video,dst=bridge-out{id=2}}"
+
setup cam2 output "#mosaic-bridge{id=cam2},select=video,dst=bridge-out{id=2}}"
-
setup cam2 enabled
+
setup cam2 enabled
-
 
+
-
new cam3 broadcast
+
new cam3 broadcast
-
setup cam3 input "v4l2:///dev/video2:width=320:height=240"
+
setup cam3 input "v4l2:///dev/video2:width=320:height=240"
-
#setup cam3 option v4l2-brightness=100
+
#setup cam3 option v4l2-brightness=100
-
setup cam3 option no-sout-audio
+
setup cam3 option no-sout-audio
-
setup cam3 output "#mosaic-bridge{id=cam3},select=video,dst=bridge-out{id=3}}"
+
setup cam3 output "#mosaic-bridge{id=cam3},select=video,dst=bridge-out{id=3}}"
-
setup cam3 enabled
+
setup cam3 enabled
-
 
+
-
#new audio1 broadcast enabled
+
#new audio1 broadcast enabled
-
#setup audio1 input alsa://hw:0,0
+
#setup audio1 input alsa://hw:0,0
-
#setup audio1 output #transcode{acodec=mp4a,samplerate=44100,ab=112}:bridge-out
+
#setup audio1 output #transcode{acodec=mp4a,samplerate=44100,ab=112}:bridge-out
-
 
+
-
new audio2 broadcast enabled
+
new audio2 broadcast enabled
-
setup audio2 input alsa://hw:0,0
+
setup audio2 input alsa://hw:0,0
-
setup audio2 output #transcode{acodec=mp4a,samplerate=44100,ab=96}:bridge-out
+
setup audio2 output #transcode{acodec=mp4a,samplerate=44100,ab=96}:bridge-out
-
 
+
-
 
+
-
# Launch everything
+
# Launch everything
 +
 +
#control audio1 play
 +
control audio2 play
 +
control bg play
 +
control cam1 play
 +
control cam2 play
 +
control cam3 play
 +
# end of mosaic batch
-
#control audio1 play
+
{{Category navigation|title=HOWTO|category=HOWTO|sortkey={{SUBPAGENAME}}}}
-
control audio2 play
+
-
control bg play
+
-
control cam1 play
+
-
control cam2 play
+
-
control cam3 play
+
-
# end of mosaic batch
+
-
[[Категория:HOWTO]]
+

Текущая версия на 12:24, 19 июля 2015

Сервер ретрансляции:

cvlc http://99.99.99.99:8083/stream.flv --ipv4-timeout=1000  --loop --sout '#duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8092/stream.flv},dst="transcode{vcodec=none,acodec=mp4a,ab=96}:std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8093/stream.flv}"}'

Скрипт запуска:

#/usr/sbin/bash
echo "**********************************************************"
echo "Для того, чтобы прекратить трансляцию -- закройте ЭТО окно! "
echo "**********************************************************"

echo "**********************************************************"
echo "Если Вы видите эту надпись, но трансляция не идет"
echo "-- закройте ЭТО окно и запустите трансляцию снова."
echo "**********************************************************"

echo "**********************************************************"
echo "Для проверки трансляции запустите в терминале"
echo "vlc http://127.0.0.1:8081/stream.flv"
echo "**********************************************************"

#echo date() >> use.log
#sleep 30
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so cvlc --vlm-conf mosaic.vlm

Сам mosaic.vlm для одной камеры (можно было бы обойтись и без мозаики, но так было проще):

# Comment the following line if you don't want to reset your VLM configuration
del all

# Background options
new   bg broadcast enabled
setup bg input     "fake://" option "fake-file=background.png"
setup bg output    "#transcode{vcodec=h264,keyint=40,vb=320,width=640,height=480,sfilter=mosaic}:bridge-in{offset=50}:duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/stream.flv},dst=std{access=file,mux=ffmpeg{mux=flv},dst=stream.flv}}"

# Mosaic options
setup bg option mosaic-alpha=255
setup bg option mosaic-height=480
setup bg option mosaic-width=640
setup bg option mosaic-align=1
setup bg option mosaic-xoffset=0
setup bg option mosaic-yoffset=0
setup bg option mosaic-vborder=0
setup bg option mosaic-hborder=0
setup bg option mosaic-position=1
setup bg option mosaic-rows=1
setup bg option mosaic-cols=1
setup bg option mosaic-order=cam1
setup bg option mosaic-delay=0
setup bg option mosaic-keep-picture

# Input options

new cam1 broadcast
setup cam1 input "v4l2:///dev/video0:width=640:height=480"
setup cam1 option v4l2-brightness=115
setup cam1 option no-sout-audio
setup cam1 output "#mosaic-bridge{id=cam1},select=video,dst=bridge-out{id=1}}"
setup cam1 enabled


new audio broadcast enabled
setup audio input alsa://hw:1,0
setup audio output #transcode{acodec=mp4a,samplerate=44100,ab=112}:bridge-out


# Launch everything

control audio play
control bg play
control cam1 play
# end of mosaic batch


Для трех камер:

# Comment the following line if you don't want to reset your VLM configuration
del all

# Background options
new   bg broadcast enabled
setup bg input     "fake://" option "fake-file=background.png"
setup bg output    "#transcode{vcodec=h264,keyint=40,vb=256, ab=112,fps=12,5,width=960,height=240,sfilter=mosaic}:bridge-in{offset=50}:duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8082/stream.flv},dst=std{access=file,mux=ffmpeg{mux=flv},dst=stream.flv}}"

# Mosaic options
setup bg option mosaic-alpha=255
setup bg option mosaic-height=240
setup bg option mosaic-width=960
setup bg option mosaic-align=1
setup bg option mosaic-xoffset=0
setup bg option mosaic-yoffset=0
setup bg option mosaic-vborder=0
setup bg option mosaic-hborder=0
setup bg option mosaic-position=1
setup bg option mosaic-rows=1
setup bg option mosaic-cols=3
setup bg option mosaic-order=cam3,cam2,cam1
setup bg option mosaic-delay=0
setup bg option mosaic-keep-picture

# Input options

new cam1 broadcast
setup cam1 input "v4l2:///dev/video0:width=320:height=240"
setup cam1 option v4l2-brightness=100
setup cam1 option no-sout-audio
setup cam1 output "#mosaic-bridge{id=cam1},select=video,dst=bridge-out{id=1}}"
setup cam1 enabled

new cam2 broadcast
setup cam2 input "v4l2:///dev/video1:width=320:height=240"
#setup cam2 option v4l2-brightness=100
setup cam2 option no-sout-audio
setup cam2 output "#mosaic-bridge{id=cam2},select=video,dst=bridge-out{id=2}}"
setup cam2 enabled

new cam3 broadcast
setup cam3 input "v4l2:///dev/video2:width=320:height=240"
#setup cam3 option v4l2-brightness=100
setup cam3 option no-sout-audio
setup cam3 output "#mosaic-bridge{id=cam3},select=video,dst=bridge-out{id=3}}"
setup cam3 enabled

#new audio1 broadcast enabled
#setup audio1 input alsa://hw:0,0
#setup audio1 output #transcode{acodec=mp4a,samplerate=44100,ab=112}:bridge-out

new audio2 broadcast enabled
setup audio2 input alsa://hw:0,0
setup audio2 output #transcode{acodec=mp4a,samplerate=44100,ab=96}:bridge-out


# Launch everything

#control audio1 play
control audio2 play
control bg play
control cam1 play
control cam2 play
control cam3 play
# end of mosaic batch
 
Личные инструменты