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

RTMP issu with FFMPEG #951

Open mrcrew opened 7 years ago

mrcrew commented 7 years ago

I have a divice for live broadcasting, It works fine with "Facebook" "Youtube" and ,,, I mean when I connect my Camera to this device , this device can broadcast video for me to a RTMP server.

But I want to send this video from my Camera to my own RTMP server, I did it before but recently I have some issue, this is my configuration : http://pastebin.com/gEn8CPBR

recently I have some issue, when I want to use this command : ffmpeg -i rtmp://11.22.33.44/transcode/ -b:a 2500k -s 1920x1080 -vcodec libx264 -hls_list_size 0 -acodec libvo_aacenc -ab 128k -ar 44100 -hls_time 4 /var/www/test_5_Feb/1.mp4

I get this error : RTMP_ReadPacket, failed to read RTMP packet header rtmp://11.22.33.44/transcode/: Invalid data found when processing input

why I get this error? and please kindly help me to solve this issue

coditori commented 7 years ago

@mrcrew Because you have an error "rtmp://11.22.33.44/transcode/" is not correct you sholud give the name of the video to FFMPEG, for a better trace you can run FFMPEG commands from the outside of nginx-rtmp-module then if they were OK carry them to your config. So you can do this to fix ffmpeg -i rtmp://11.22.33.44/transcode/$name -b:a 2500k

And the another thing is I've seen you config line 48 exec /usr/bin/ffmpeg -i rtmp://live.site.com/hls/$app/index.m3u8e you have no hls application on your RTMP block but you referred to it here!

mrcrew commented 7 years ago

@massoudAfrashteh It works, now I'm broadcasting my live events with it ! and there is no problem, but my only problem is that , sometimes I should run this : ffmpeg -i rtmp://11.22.33.44/transcode/ -b:a 2500k -s 1920x1080 -vcodec libx264 -hls_list_size 0 -acodec libvo_aacenc -ab 128k -ar 44100 -hls_time 4 1.mp4

10 time to make it work ! I want to know why it's took 9 times fails and try after that it works fine ?!?

But in total it works. For your information you can tell the FFMPEG to get input from RTMP server.

designgears commented 7 years ago

I've been seeing the same issue recently. I'm not sure what causes that, I'm streaming from OBS to my nginx-rtmp server and it randomly throws this out.

frame=27410 fps= 60 q=-1.0 size= 205143kB time=00:07:36.82 bitrate=3678.7kbits/s speed= 1x RTMPSockBuf_Fill, recv returned -1. GetSockError(): 11 (Resource temporarily unavailable) RTMP_ReadPacket, failed to read RTMP packet header No more output streams to write to, finishing. frame=27411 fps= 56 q=-1.0 Lsize= 205146kB time=00:07:36.83 bitrate=3678.7kbits/s speed=0.939x