winshining / nginx-http-flv-module

A media streaming server based on nginx-rtmp-module. In addtion to the features nginx-rtmp-module provides, HTTP-FLV, GOP cache, VHosts (one IP for multi domain names) and JSON style statistics are supported now.
BSD 2-Clause "Simplified" License
2.72k stars 567 forks source link

[bug]当推送短视频时,push不触发 #211

Closed silent-dark closed 2 years ago

silent-dark commented 2 years ago

当作为rtmp中继服务器时,若发布的视频小于一定时长或大小(所用测试文件为2M左右,15s),不会触发push(如果再次推送同一文件则会触发),但使用exec_push+ffmpeg做转发无此问题。从现象分析,似乎push的实现有缓存。

Expected behavior / 期望行为

每次发布视频都正常执行push

Actual behavior / 实际行为

如问题描述

OS and Nginx version / 操作系统和 Nginx 版本号

nginx 1.20.1 on centos-7 / ubuntu-18.04

Configuration file / 配置文件

rtmp {
    server {
        listen 1935;
        access_log /var/log/nginx/rtmp.log;

        application dvr_proxy {
            live on;
            push rtmp://192.168.16.45/$app/$name;
        }
    }
}

使用exec_push+ffmpeg时的配置:

rtmp {
    server {
        listen 1935;
        access_log /var/log/nginx/rtmp.log;

        application dvr_proxy {
            live on;
            exec_push ffmpeg -i rtmp://localhost/$app/$name -c copy -f flv -y rtmp://192.168.16.45/$app/$name;
        }
    }
}

Steps to reproduce the behavior / 复现问题步骤

1)准备一个短视频,时长不超过15s,大小2M左右; 2)推送短视频到中继服务器,推流命令: ffmpeg -re -i demo.mp4 -c copy -f flv -y rtmp://192.168.16.41/dvr_proxy/20210001

winshining commented 2 years ago

感谢提交 bug 报告,问题已经定位,等待修复

winshining commented 2 years ago

另外,跟视频时长和大小没有关系,跟以下配置项有关:

push rtmp://192.168.16.45/$app/$name;
winshining commented 2 years ago

Fixed.