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