summaryrefslogtreecommitdiff
path: root/bin/stream.sh
blob: 3a1aedfbd813fdb97c7262d33147e1f6db32db97 (plain)
  1. #!/bin/sh
  2. target_host=morla
  3. if [ "$target_host" = "$(hostname --short)" ]; then
  4. target_ip=127.0.0.1
  5. else
  6. target_ip=$(host "$target_host" | grep -Po 'address \K\S+')
  7. fi
  8. # based on http://video.stackexchange.com/a/16933
  9. # + codec options from http://www.webmproject.org/docs/encoder-parameters/
  10. # example "Real-time CBR Encoding and Streaming"
  11. # (bufsize = 6000 * 500k / 1000)
  12. # (rc_init_occupancy = 4000 * 500k / 1000)
  13. # + Drop frames, aggressively treat as static, and use fastest cpu
  14. ffmpeg -threads auto -re \
  15. -f lavfi -i "movie=filename=../src/omni/show0/earth.mp4:loop=0, setpts=N/(FRAME_RATE*TB), scale=640x360" \
  16. -i ../../content/icon_small.png -filter_complex 'overlay=main_w-overlay_w-20:main_h-overlay_h-20' \
  17. -codec:v vp8 -quality realtime -deadline realtime -cpu-used 15 \
  18. -b:v 500k -minrate 500k -maxrate 500k \
  19. -undershoot-pct 95 -bufsize 3M -rc_init_occupancy 2M \
  20. -max-intra-rate 0 \
  21. -qmin 4 -qmax 56 \
  22. -static-thresh 500 -skip_threshold 50 \
  23. -an -f rtp "rtp://$target_ip:5004?pkt_size=1200"