arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.22k stars 3.49k forks source link

FFMPEG / Nginx not creating files such as ts and m3 for HLS #1645

Open lyntree opened 2 years ago

lyntree commented 2 years ago

Hello,

We've tried to follow the instructions as close as possible but no matter what we have done, we can't seem to pull through on HLS or Dash despite RTMP works. We've configured the file so many times that we can only guess and narrow it down to the following areas.

I presume its this command that starts to generate the playlist file - ffmpeg -listen 1 -i rtmp://185.181.9.232/hls \ -c:v libx264 -crf 21 -preset veryfast \ -c:a aac -b:a 128k -ac 2 \ -f hls -hls_time 4 -hls_playlist_type event stream.m3u8

but we get on response: [rtmp @ 0x5631e4a20800] Cannot open connection tcp://185.181.9.232:1935?listen&listen_timeout=-1000 rtmp://185.181.9.232/hls: Address already in use

as for the TS files, we have OBS software streaming fine through VLC but nothing is being recorded on the server. Can you please advise if there is any reason why its not creating these files despite its been configured in the nginx file?

Dropye commented 2 years ago

can u please post your full configuration? Some guesses in advance.

1: Your apllication should define "hls on;" and a hls_path 2: also I think your input misses the streamName it should look like rtmp://185.181.9.232/hls/$name 3: I cant examine what your ffmpeg call is for. You may have a look at https://github.com/arut/nginx-rtmp-module/wiki/Directives#exec_push 4: If you just want to get a simple stream working use the sample config and work on from there https://github.com/arut/nginx-rtmp-module#example-nginxconf

lyntree commented 2 years ago

terminal1.txt

We have tried everything to get this to work and nothing no matter what, works any insight would be great, we have gone over this constantly, and it shows an error of:

Pwrite recording Error - bad descriptor

lyntree commented 2 years ago

It literally will create the folders but will not create the playlist or save the ts files onto server for what we need for HLS/DASH support.

z0rti commented 2 years ago

I got a video.mp4 in the correct format, so copy is ok: ffmpeg -re -i video.mp4 -loop -1 -c:v copy -c:a copy -f flv rtmp://127.0.0.1/hls/foo i set 'hls_path /tmp/hls' when the ffmpeg command starts a file is created foo-0.ts after 10s the next file foo-1.ts and THEN a file foo.m3u8 is created

so m3u8 is created only when the first fragment is done after hls_fragment seconds