2016-07-16 211 views
0

我打過url rtsp:// admin:admin @ camera -ip:4455成功從相機鏈接。 但是當我通過ffmpeg得到它。ffmpeg輸入rtsp錯誤

ffmpeg -i rtsp://admin:[email protected]:4455 -codec copy -f rtmp:/streaming-ip:1935/RTMP/test 

我得到錯誤:

[rtsp @ 0x241f0e0] UDP timeout, retrying with TCP 
[rtsp @ 0x241f0e0] method PAUSE failed: 455 Method Not Valid in This State 
[rtsp @ 0x241f0e0] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size 
Consider increasing the value for the 'analyzeduration' and 'probesize' options 
Guessed Channel Layout for Input Stream #0.1 : mono 
Input #0, rtsp, from 'rtsp://admin:[email protected]:4446': 
    Metadata: 
    title   : RTSP Session/2.0 
    Duration: N/A, bitrate: 64 kb/s 
    Stream #0:0: Video: h264, none, 90k tbr, 90k tbn, 180k tbc 
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s 
Output #0, flv, to 'rtmp://streaming-ip:1935/RTMP/test': 
    Metadata: 
    title   : RTSP Session/2.0 
    encoder   : Lavf56.15.102 
    Stream #0:0: Audio: pcm_alaw ([7][0][0][0]/0x0007), 8000 Hz, mono, 64 kb/s 
Stream mapping: 
    Stream #0:1 -> #0:0 (copy) 
Press [q] to stop, [?] for help 
[rtsp @ 0x241f0e0] UDP timeout, retrying with TCP 
rtsp://admin:[email protected]:4446: Operation not permitted 
[flv @ 0x250ca00] Failed to update header with correct duration. 
[flv @ 0x250ca00] Failed to update header with correct filesize. 
size=  0kB time=00:00:00.00 bitrate=N/A 
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown 
Output file is empty, nothing was encoded (check -ss/-t/-frames parameters if used) 

的原因是什麼?我能做些什麼來解決這個問題。

感謝您的幫助。

+0

在'-i'之前加'-analyzeduration 20M -probesize 20M'並查看。 – Mulvya

+0

感謝您的幫助,但它不起作用。我認爲原因是rtsp:// admin:admin @ camera-ip:4446:操作不允許,但我不知道爲什麼。再次感謝。 –

回答

0

看起來您正試圖將RTSP流轉換爲RTMP。爲了將你的問題分成小塊,我建議確認你能夠成功接收RTSP流,一旦你確認你可以嘗試將它轉換成RTMP。

使用ffplay,您可以驗證ffmpeg是否可以正確接收RTSP流。您也可以使用Wireshark捕獲RTSP通信。

RTMP使用1935端口,請確保您有權在該端口上打開TCP套接字。使用sudo以防萬一。希望這可以幫助。