Closed
Description
I am having a few problems with HLS streaming (live stream, not VOD style).
- I can only watch the HLS stream from the beginning. If a stream has been running for a few minutes, I get nothing. My phone (testing) does not receive any data.
- There is a 30 second delay on the HLS stream. I am watching the same stream on RTMP, which only has 1-2 second delay.
Config:
worker_processes 1;
error_log logs/error.log debug;
rtmp_auto_push on;
rtmp_auto_push_reconnect 1000ms;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
# This URL provides RTMP statistics in XML
location /stat {
rtmp_stat all;
# Use this stylesheet to view XML as web page
# in browser
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
# XML stylesheet to view RTMP stats.
# Copy stat.xsl wherever you want
# and put the full directory path here
root /opt/nginx-rtmp-module/stat.xsl/;
}
location /hls {
# Serve HLS fragments
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
}
location /dash {
# Serve DASH fragments
root /tmp;
add_header Cache-Control no-cache;
}
}
}
rtmp {
server {
listen 1935;
chunk_size 4086;
application watch {
live on;
hls on;
hls_path /tmp/hls;
hls_fragment 2s;
hls_playlist_length 10s;
}
}
}
FFmpeg command:
/opt/FFmpeg/ffmpeg -f video4linux2 -i /dev/video0 -an -vcodec libx264 -crf 1 -maxrate 8000k -bufsize 10000k -preset ultrafast -tune zerolatency -s 768x576 -g 50 -vf "drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf: text='%{{localtime\:%F %T}}': fontcolor=white@0.5: x=0: y=0 :box=1:boxcolor=0x00000000@1" -f flv rtmp://localhost/watch/VIDEO
Metadata
Metadata
Assignees
Labels
No labels