Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- streaming() {
- INRES="1920x1080" # input resolution
- OUTRES="1920x1080" # output resolution
- FPS="15" # target FPS
- GOP="30" # i-frame interval, should be double of FPS,
- GOPMIN="15" # min i-frame interval, should be equal to fps,
- THREADS="2" # max 6
- CBR="1000k" # constant bitrate (should be between 1000k - 3000k)
- QUALITY="ultrafast" # one of the many FFMPEG preset
- STREAM_KEY="$1" # use the terminal command Streaming streamkeyhere to stream your video to twitch or justin
- _DISPLAY=${DISPLAY:-0}
- fc="zmq=bind_address=tcp\\\://127.0.0.1\\\:1235 "
- ffmpeg -v debug -f x11grab -s "$INRES" -r "$FPS" -i ${_DISPLAY}.0 -filter_complex "$fc" -lavfi "amovie=./rhapsody_in_blue.mp3:loop=4444444,asetpts=N/SR/TB" -strict experimental -f flv \
- -vcodec libx264 -g $GOP -keyint_min $GOPMIN -b:v $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\
- -s $OUTRES -preset $QUALITY -tune film -threads $THREADS -strict normal \
- -bufsize $CBR "rtmp://$1"
- }
- streaming $1
- ---------------
- $ netstat -nlp | grep 1235
- tcp 0 0 127.0.0.1:1235 0.0.0.0:* LISTEN 4300/ffmpeg
- ---------------
- $ ffmpeg --version
- ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers
- built with gcc 7 (Ubuntu 7.3.0-16ubuntu2)
- configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
- ----------------
- cat zmqsend.sh
- #!/bin/sh
- PORT=1235
- zmq_push () {
- m=$(</dev/stdin) && \
- printf "$(printf '\\\\x01\\\\x00\\\\x%02x\\\\x00%s' ${#m} "$m")" \
- >/dev/tcp/$1/$2
- }
- cat | zmq_push localhost ${PORT}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement