Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # We assume ffmpeg installed (recommened v 4+)
  4.  
  5. # Acts as RMTP server for application named live (expects stream)
  6. # transcodes the media data into h264-aac, craetes HLS 4s chunks,
  7. # and sends the data to ~/origin
  8.  
  9. # Create 1 rendition1
  10. # 854x480@30fps 1000Kbps (+ Overlay)
  11.  
  12. FONT_PATH='/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf'
  13.  
  14. # Clean up
  15. rm -f ~/origin/*.ts
  16. rm -f ~/origin/*.m3u8
  17. mkdir -p ~/origin
  18.  
  19. echo "Starting RMTP server"
  20. ffmpeg -hide_banner \
  21. -listen 1 -i "rtmp://0.0.0.0:1935/live/stream" \
  22. -vf scale=854x480 \
  23. -vf "drawtext=fontfile=$FONT_PATH: text=\'RENDITION 1 - Local time %{localtime\: %Y\/%m\/%d %H.%M.%S} (%{n})\': x=0: y=0: fontsize=36: fontcolor=pink: box=1: boxcolor=0x00000099" \
  24. -c:v libx264 -b:v 900k -g 60 -profile:v baseline -preset veryfast \
  25. -c:a aac -b:a 48k \
  26. -hls_flags delete_segments -hls_time 4 -hls_segment_filename ~/origin/480p_%05d.ts ~/origin/480p.m3u8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement