mpeg ts で audio/video とりあえずできた

 

これが完璧版 (filter 追加) 
gst-launch-1.0 -e v4l2src norm=PAL ! omxh264enc target-bitrate=8000000 control-rate=variable ! video/x-h264, profile=high ! queue ! mpegtsmux name=muxy alsasrc device=plughw:0,0 ! volume volume=3 ! audioconvert ! audio/x-raw ! audioconvert ! audiochebband mode=band-pass lower-frequency=1000 upper-frequency=4000 type=2 ! audioconvert ! voaacenc bitrate=64000 ! queue ! muxy. muxy. ! hlssink max-files=8 target-duration=5 location=/var/www/html/stream/segment%05d.ts playlist-location=/var/www/html/stream/output.m3u8 playlist-root=http://rpi/stream/

 

gst-launch-1.0 -e v4l2src norm=PAL !  omxh264enc target-bitrate=8000000 control-rate=variable ! video/x-h264, profile=high ! queue ! mpegtsmux name=muxy alsasrc device=plughw:0,0 ! audioconvert ! audio/x-raw ! voaacenc ! queue ! muxy. muxy.  ! hlssink max-files=8 target-duration=5 location=/var/www/html/stream/segment%05d.ts playlist-location=/var/www/html/stream/output.m3u8 playlist-root=http://rpi/stream/

 filter無し版

 

 

 

 

 

 

(とりあえず最初の板)

gst-launch-1.0 -e v4l2src norm=PAL ! videoconvert ! clockoverlay ! omxh264enc target-bitrate=8000000 control-rate=variable ! video/x-h264, profile=baseline ! h264parse ! queue ! mpegtsmux name=muxy alsasrc device=plughw:0,0 ! voaacenc ! queue ! muxy. muxy.  ! hlssink max-files=8 target-duration=5 location=/var/www/html/stream/segment%05d.ts playlist-location=/var/www/html/stream/output.m3u8 playlist-root=http://rpi/stream/

 

muxy. muxy. が聞いているようだ

 

 gst-launch-1.0 -e v4l2src norm=PAL ! videoconvert ! clockoverlay ! omxh264enc target-bitrate=4000000 control-rate=variable ! video/x-h264, profile=high ! h264parse ! queue ! mpegtsmux name=muxy alsasrc device=plughw:0,0 ! audioconvert ! audio/x-raw, channels=1 ! voaacenc bitrate=64000 ! queue ! muxy. muxy.  ! hlssink max-files=8 target-duration=5 location=/var/www/html/stream/segment%05d.ts playlist-location=/var/www/html/stream/output.m3u8 playlist-root=http://rpi/stream/

 

gst-launch-1.0 -e v4l2src norm=PAL ! videoconvert ! clockoverlay ! omxh264enc target-bitrate=2000000 control-rate=variable ! video/x-h264, profile=high ! h264parse !  mpegtsmux name=muxy alsasrc device=plughw:0,0 ! audioconvert ! audio/x-raw, rate=16000, channels=1 ! voaacenc bitrate=64000 ! queue ! muxy. muxy.  ! hlssink max-files=8 target-duration=5 location=/var/www/html/stream/segment%05d.ts playlist-location=/var/www/html/stream/output.m3u8 playlist-root=http://rpi/stream/

 

少しbitrateをおとす

 

 

mpegts ファイルの生成がおかしかったが、parseをおとすとok.

gst-launch-1.0 -e v4l2src norm=PAL !  omxh264enc target-bitrate=2000000 control-rate=variable ! video/x-h264, profile=high ! queue ! mpegtsmux name=muxy alsasrc device=plughw:0,0 ! audioconvert ! audio/x-raw, rate=16000, channels=1 ! voaacenc bitrate=64000 ! queue ! muxy. muxy.  ! hlssink max-files=8 target-duration=5 location=/var/www/html/stream/segment%05d.ts playlist-location=/var/www/html/stream/output.m3u8 playlist-root=http://rpi/stream/

 

serverside で簡単に見られるよう設定

hammmm.hatenablog.com

 

Fileへの出力→OK 

gst-launch-1.0 -e \
mp4mux name=muxy ! filesink location=out.mp4 \
alsasrc device=plughw:0,0 ! audio/x-raw,rate=48000 ! audioconvert ! queue ! lamemp3enc ! muxy.audio_0 \
v4l2src ! videoconvert ! omxh264enc ! video/x-h264, target-bitrate=80000000, control-rate=variable ! h264parse ! queue ! muxy.video_0

 

audio/video の mp4へのmux サンプル

 

 

mattintosh.hatenablog.com

 


gst-launch-1.0 -e v4l2src norm=PAL ! videoconvert ! clockoverlay ! omxh264enc target-bitrate=8000000 control-rate=variable ! video/x-h264, profile=baseline ! h264parse ! queue ! muxy.video_0 alsasrc device=plughw:0,0 ! audio/x-raw,rate=48000,format=S16LE, channels=2 ! audioconvert ! voaacenc ! aacparse ! queue ! muxy.audio_0 matroskamux name=muxy ! hlssink max-files=8 target-duration=5 location=/var/www/html/stream/segment%05d.ts playlist-location=/var/www/html/stream/output.m3u8 playlist-root=http://rpi/stream/

 

VLCが途中で泊まる。

 

動画のみおk版

gst-launch-1.0 v4l2src device=/dev/video0 norm=PAL ! omxh264enc target-bitrate=6000000 control-rate=variable ! video/x-h264,profile=high ! mpegtsmux ! hlssink max-files=8 target-duration=5 location=/var/www/html/stream/segment%05d.ts playlist-location=/var/www/html/stream/output.m3u8 playlist-root=http://rpi/stream/

 

stackoverflow.com

 

audio video の mpegtsmux sanmple

とりあえず動いたバージョン

受信側

gst-launch-1.0 udpsrc port=1234 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! rtph264depay ! avdec_h264 ! autovideosink sync=false & gst-launch udpsrc port=1235 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! audioconvert ! autoaudiosink

-

画像改良版

 gst-launch-1.0 udpsrc port=1234 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! rtph264depay ! avdec_h264 ! autovideosink sync=false & gst-launch-1.0 udpsrc port=1235 caps="application/x-rtp" ! queue ! "application/x-rtp,media=(string)audio, clock-rate=(int)48000, width=16, height=16, encoding-name=(string)L16, encoding-params=(string)1, channels=(int)1, payload=(int)96" ! rtpL16depay ! audioconvert ! volume volume=3 !autoaudiosink

 

 

送信側

gst-launch-1.0 v4l2src norm=PAL ! videoconvert ! omxh264enc ! rtph264pay pt=96 config-interval=1 ! udpsink host=192.168.1.1 port=1234 & gst-launch-1.0 -v alsasrc device=plughw:0,0 ! mulawenc ! rtppcmupay ! udpsink host=192.168.1.1 port=1235

 

-

画像改良版

gst-launch-1.0 v4l2src norm=PAL ! videoconvert ! omxh264enc ! video/x-h264, target-bitrate=80000000, control-rate=variable ! rtph264pay pt=96 config-interval=1 ! udpsink host=192.168.1.1 port=1234 & gst-launch-1.0 -v alsasrc device=plughw:0,0 ! audioconvert ! audio/x-raw,channels=1,depth=16,width=16,rate=48000 ! rtpL16pay ! udpsink host=192.168.1.1 port=1235

Gstream 音声+映像 ストリーミg

signal-flag-z.blogspot.com

 

TKJ Electronics » How to stream video and audio from a Raspberry Pi with no latency

 

The streaming script:

#!/bin/bash -e

serverIp=$(ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}')
clientIp=$(echo $serverIp | cut -d '.' -f 1-3).255 # Send to all

gst-launch-1.0 -v alsasrc device=plughw:Set \
! mulawenc ! rtppcmupay ! udpsink host=$clientIp port=5001 &

raspivid -t 999999 -w 1080 -h 720 -fps 25 -hf -b 2000000 -o - | \
gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 \
! gdppay ! tcpserversink host=$serverIp port=5000

kill $!

And the receiving script:

#!/bin/bash -e

serverIp=rpi.local

gst-launch-1.0 -v udpsrc port=5001 caps="application/x-rtp" \
! queue ! rtppcmudepay ! mulawdec ! audioconvert ! autoaudiosink sync=false &

gst-launch-1.0 -v tcpclientsrc host=$serverIp port=5000 \
! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

kill $!