Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. streaming() {
  2. INRES="1920x1080" # input resolution
  3. OUTRES="1920x1080" # output resolution
  4. FPS="15" # target FPS
  5. GOP="30" # i-frame interval, should be double of FPS,
  6. GOPMIN="15" # min i-frame interval, should be equal to fps,
  7. THREADS="2" # max 6
  8. CBR="1000k" # constant bitrate (should be between 1000k - 3000k)
  9. QUALITY="ultrafast" # one of the many FFMPEG preset
  10. STREAM_KEY="$1" # use the terminal command Streaming streamkeyhere to stream your video to twitch or justin
  11. _DISPLAY=${DISPLAY:-0}
  12.  
  13. fc="zmq=bind_address=tcp\\\://127.0.0.1\\\:1235 "
  14.  
  15. 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 \
  16. -vcodec libx264 -g $GOP -keyint_min $GOPMIN -b:v $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\
  17. -s $OUTRES -preset $QUALITY -tune film -threads $THREADS -strict normal \
  18. -bufsize $CBR "rtmp://$1"
  19. }
  20.  
  21. streaming $1
  22. ---------------
  23. $ netstat -nlp | grep 1235
  24. tcp 0 0 127.0.0.1:1235 0.0.0.0:* LISTEN 4300/ffmpeg
  25. ---------------
  26. $ ffmpeg --version
  27. ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers
  28. built with gcc 7 (Ubuntu 7.3.0-16ubuntu2)
  29. 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
  30. ----------------
  31. cat zmqsend.sh
  32. #!/bin/sh
  33.  
  34. PORT=1235
  35. zmq_push () {
  36. m=$(</dev/stdin) && \
  37. printf "$(printf '\\\\x01\\\\x00\\\\x%02x\\\\x00%s' ${#m} "$m")" \
  38. >/dev/tcp/$1/$2
  39. }
  40. cat | zmq_push localhost ${PORT}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement