arut / nginx-rtmp-module

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

Problem with recorded flv video - bigger video cant play and only freeze at the beginning (play only about 0.5s) #271

Open vavdav opened 10 years ago

vavdav commented 10 years ago

Hello, I am recording from flash. Sometime recorded video is broken and cant be played fully. Only about 0.5s is played and then video is restarted/ended (depend on player). In bsplayer I can jump over 0.5s by seek bar and then video is played to the end.

Flash side setting: 845x480 @24fps video keyframe interval 24 videoBandwidth 430000 audio codec NELLYMOSER audio encode quality 7 using command: ns.publish("testfile", "record");

Serverside setting rtmp { server { listen 1935; timeout 30s; access_log /var/log/nginx/rtmp.log; application myapp { live on; record all; record_max_size 200M; record_max_frames 1000000;
record_path /MP4; on_publish http://localhost/publish; on_play http://localhost/play; on_record_done http://localhost/record_done; } } } Please can u help me with nginx server setting, what is best for recording video. For best video quality

Iam newbie to nginx rtmp, before I used RED5. Thanks for help

edit: here is example with that issue https://dl.dropboxusercontent.com/u/21299530/test_2013-9-13_20-31-36.flv here it is putted to player: http://invisible.wz.cz/nginx/prehravac.html

arut commented 10 years ago

Looks like 0x341 bytes are lost from the flv. Need debug log to debug the problem.

Flv tag offsets:

0059b3 video
008689
00cb5f
010a82
0162c4
01ad69
01f1e6
023433
0273f9
02b2d7
030177
034cf0
0396cb
03cdbb
04164b

416db (audio)
4176b

417fb (video)

... 0x341 (833) bytes lost

-->45c95 (?) next tag should start here

45954 (audio) real tag start
45a74
45b04

4a286 video
vavdav commented 10 years ago

here is log: https://dl.dropboxusercontent.com/u/21299530/rtmp.log.1

Its not what u need I think... I have to run nginx with debugging, is it true? I will write to my nginx provider

arut commented 10 years ago

It's access log, not error.log. See this link for setting up debug log: https://github.com/arut/nginx-rtmp-module/wiki/Debug-log

vavdav commented 10 years ago

here is problem video: https://dl.dropboxusercontent.com/u/21299530/test_2013-9-14_19-39-56.flv here is log: https://dl.dropboxusercontent.com/u/21299530/error.log actual config: https://dl.dropboxusercontent.com/u/21299530/nginx.conf

vavdav commented 10 years ago

it looks like the problem is caused by setting NELLYMOSER audio codec. When I switch to SPEEX audio codec then it looks it is working. But problem is when I want to play this video in flash video player. Sound is really bad, almost no sound and video is slowed - not fluent. Sound is not synced with video correctly

I created video with SPEEX codec. Here is: https://dl.dropboxusercontent.com/u/21299530/test_2013-9-14_21-13-9.flv but in vlc it freeze after 4s of playing. In BSPlayer it play all. But both without sound.

here is flv video in flash video player http://invisible.wz.cz/nginx/prehravac.html

arut commented 10 years ago

If you record speex in flash then turn off silence detector (set its level to zero) to make speex sound ok.

arut commented 10 years ago

Generally it didn't look like audio codec problem. The first file has broken data, namely video data.

vavdav commented 10 years ago

thank you. I edited some parameters and now it works. Sound is recorded with video. Need to get better quality, if it will be possible. I will do more tests to test it if is it really ok.

biggest problem was NELLYMOSER audio codec and video.setQuality(430000, 0); - some bandwidth and zero video quality

vavdav commented 10 years ago

now I had some problem with video and sound. sound was late. And some error apear:

2013/10/15 09:21:57 [info] 2292#0: 1805 client connected '' 2013/10/15 09:21:57 [info] 2292#0: 1805 send() failed (32: Broken pipe), client: , server: 0.0.0.0:1935 2013/10/15 09:21:57 [info] 2292#0: 1805 disconnect, client: , server: 0.0.0.0:1935 2013/10/15 09:21:57 [info] 2292#0: 1805 deleteStream, client: , server: 0.0.0.0:1935 2013/10/15 09:21:57 [info] 2292#0: 1806 client connected '' 2013/10/15 09:21:57 [info] 2292#0: 1806 connect: app='myapp' args='' flashver='APSH 4,2290' swf_url='' tc_url='rtmp://unix:/' page_url='nginx-auto-push' acodecs=3575 vcodecs=252 object_encoding=0, client: , server: 0.0.0.0:1935 2013/10/15 09:21:57 [info] 2292#0: 1806 createStream, client: , server: 0.0.0.0:1935 2013/10/15 09:21:57 [info] 2292#0: 1806 publish: name='test_2013-9-15_9-21-55' args='' type=live silent=0, client: , server: 0.0.0.0:1935 2013/10/15 09:21:57 [info] 2290#0: 1789 notify: play 'localhost/play', client: unix:/tmp/nginx-rtmp.6, server: ngx-relay 2013/10/15 09:22:10 [info] 2290#0: 1783 closeStream, client: 176.62.234.1, server: 0.0.0.0:1935 2013/10/15 09:22:10 [info] 2290#0: *1783 notify: record_done recorder= path='/MP4/test_2013-9-15_9-21-55.flv' url='localhost/record_done', client: 176.62.234.1, server: 0.0.0.0:1935

arut commented 10 years ago

I only see client reconnect in log

jason9yu commented 10 years ago

When i used RED5 push stream ,then record Some video'frames lost! It is ok with Adobe Flash Media Live Encoder ..

jason9yu commented 10 years ago

Audio: nellymoser and Speex are same problem..

vavdav commented 10 years ago

Hello thank you for info. Everything almost works, but sometime problem with video occurs. Here is video with this issue. http://invisible.wz.cz/test_2014-01-18-11-25-35(1).flv . I have to avoid or detect these problems while recording Thanks for help