Estou usando o ffmpeg para converter um fluxo RTSP em um fluxo RTMP. O fluxo de RMTP será então alimentado no Wowza Streaming Engine. Eu não tenho idéias porque funciona muito bem em um servidor, mas falha em outro servidor. Ambos os servidores estão em redes diferentes, mas ambos são Windows Server 2012, têm a mesma versão ffmpeg, convertem um mesmo fluxo RTSP, mas um falha com a mensagem de erro Erro ao abrir o decodificador para fluxo de entrada # 0: 0: Dados inválidos encontrados ao processar entrada
O comando ffmpeg que eu usei é:
ffmpeg -v debug -r 7 -i "rtsp://rtsp-stream-source-server/someRtspStream" -frame rate 7 -video_size 800x592 -vcodec libx264 -preset veryfast -maxrate 750k -bufsize 1500k -tune zerolatency -g 14 -an -r 7 -f flv rtmp://wowza-server:1935/app/stream1
Eu comparo as duas mensagens de debug do ffmpeg em ambos os casos e observo as diferenças / comportamentos a seguir:
-
Para o caso de sucesso, o ffmpeg primeiro abre o fluxo RTSP usando UDP, mas o UDP timeout, então ele tenta novamente com o TCP. Para o caso de falha, parece que ele é bem sucedido com o UDP e não é necessário repetir com o TCP. / p>
-
Quando o ffmpeg abre com êxito um fluxo RTSP, as seguintes informações são impressas para o caso de sucesso
Input #0, rtsp, from 'rtsp://rtsp-stream-source-server/someRtspStream':
Metadata:
title : Unnamed
comment : N/A
Duration: N/A, start: 0.151889, bitrate: N/A
Stream #0:0, 53, 1/90000: Video: h264 (Main), 1 reference frame, yuvj420p(pc, bt709, progressive, center), 800x600 (800x608) [SAR 1:1 DA
R 4:3], 0/1, 6.58 tbr, 90k tbn, 180k tbc
Successfully opened the file.
E para o caso de falha, as seguintes informações são impressas:
Input #0, rtsp, from 'rtsp://rtsp-stream-source-server/someRtspStream':
Metadata:
title : Unnamed
comment : N/A
Duration: N/A, start: 0.151944, bitrate: N/A
Stream #0:0, 28, 1/90000: Video: h264 (Main), 1 reference frame, yuvj420p(pc, bt709, progressive, center), 800x600 (800x608) [SAR 1:1 DA
R 4:3], 0/1, 6.67 tbr, 90k tbn, 180k tbc
Successfully opened the file.
Por favor, note que o número após "Stream # 0: 0" é diferente.
- No processo "Fluxo de mapeamento", o caso de falha apresenta as seguintes mensagens de erro. Em seguida, o processo ffmpeg para:
detected 4 logical cores
[h264 @ 0000000001c2a9a0] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0000000001c2a9a0] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0000000001c2a9a0] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0000000001c2a9a0] sps_id 0 out of range
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Error while opening decoder for input stream #0:0 : Invalid data found when processing input
Você tem alguma ideia para os casos de falha e como posso solucionar o problema?
Abaixo está a mensagem de depuração para ambos os casos para a informação
Caso de falha
Opening an input file: rtsp://rtsp-stream-source-server/someRtspStream.
[tcp @ 00000000004b8740] No default whitelist set
[rtsp @ 0000000001c2ba00] SDP:
v=0
o=- 1509095634684735 1 IN IP4 192.168.63.139
s=Unnamed
i=N/A
t=0 0
a=tool:LIVE555 Streaming Media v2011.08.20
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:Unnamed
a=x-qt-text-inf:N/A
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:15000
a=rtpmap:96 H264/90000
a=control:track1
Failed to parse interval end specification ''
[rtsp @ 0000000001c2ba00] video codec set to: h264
[rtp @ 00000000004b8b40] No default whitelist set
[udp @ 00000000004ba420] No default whitelist set
[udp @ 00000000004ba420] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 00000000004ba420] end receive buffer size reported is 65536
[udp @ 0000000001c3d160] No default whitelist set
[udp @ 0000000001c3d160] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 0000000001c3d160] end receive buffer size reported is 65536
[rtsp @ 0000000001c2ba00] setting jitter buffer size to 500
[rtsp @ 0000000001c2ba00] hello state=0
Failed to parse interval end specification ''
[h264 @ 00000000004b8d40] sps_id 0 out of range
[AVBSFContext @ 00000000004bd160] nal_unit_type: 0, nal_ref_idc: 0
[AVBSFContext @ 00000000004bd160] nal_unit_type: 8, nal_ref_idc: 3
[AVBSFContext @ 00000000004bd160] nal_unit_type: 0, nal_ref_idc: 0
[AVBSFContext @ 00000000004bd160] nal_unit_type: 7, nal_ref_idc: 3
[AVBSFContext @ 00000000004bd160] nal_unit_type: 0, nal_ref_idc: 0
[AVBSFContext @ 00000000004bd160] nal_unit_type: 8, nal_ref_idc: 3
[AVBSFContext @ 00000000004bd160] nal_unit_type: 0, nal_ref_idc: 0
[AVBSFContext @ 00000000004bd160] nal_unit_type: 5, nal_ref_idc: 3
[AVBSFContext @ 00000000004bd160] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] Unknown NAL code: 0 (0 bits)
[h264 @ 00000000004b8d40] sps_id 0 out of range
[h264 @ 00000000004b8d40] Unknown NAL code: 0 (0 bits)
Last message repeated 2 times
[h264 @ 00000000004b8d40] Reinit context to 800x608, pix_fmt: yuvj420p
[h264 @ 00000000004b8d40] Unknown NAL code: 0 (0 bits)
[h264 @ 00000000004b8d40] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] Unknown NAL code: 0 (0 bits)
[h264 @ 00000000004b8d40] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] Unknown NAL code: 0 (0 bits)
[h264 @ 00000000004b8d40] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] Unknown NAL code: 0 (0 bits)
[h264 @ 00000000004b8d40] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] Unknown NAL code: 0 (0 bits)
[h264 @ 00000000004b8d40] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] Unknown NAL code: 0 (0 bits)
[h264 @ 00000000004b8d40] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 00000000004b8d40] nal_unit_type: 0, nal_ref_idc: 0
[h264 @ 00000000004b8d40] Unknown NAL code: 0 (0 bits)
[rtsp @ 0000000001c2ba00] All info found
[rtsp @ 0000000001c2ba00] rfps: 6.500000 0.018292
[rtsp @ 0000000001c2ba00] rfps: 6.583333 0.006178
Last message repeated 1 times
[rtsp @ 0000000001c2ba00] rfps: 6.666667 0.004542
[rtsp @ 0000000001c2ba00] rfps: 6.750000 0.013386
[rtsp @ 0000000001c2ba00] rfps: 13.250000 0.016201
[rtsp @ 0000000001c2ba00] rfps: 13.333333 0.018170
Input #0, rtsp, from 'rtsp://rtsp-stream-source-server/someRtspStream':
Metadata:
title : Unnamed
comment : N/A
Duration: N/A, start: 0.151944, bitrate: N/A
Stream #0:0, 28, 1/90000: Video: h264 (Main), 1 reference frame, yuvj420p(pc, bt709, progressive, center), 800x600 (800x608) [SAR 1:1 DA
R 4:3], 0/1, 6.67 tbr, 90k tbn, 180k tbc
Successfully opened the file.
Parsing a group of options: output url rtmp://wowza-server:1935/app/stream1.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument libx264.
Applying option an (disable audio) with argument 1.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 7.
Applying option f (force format) with argument flv.
Successfully parsed a group of options.
Opening an output file: rtmp://wowza-server:1935/app/stream1.
[rtmp @ 00000000023c0ec0] No default whitelist set
Parsing...
Parsed protocol: 0
Parsed host : 127.0.0.1
Parsed app : vdc
RTMP_Connect1, ... connected, handshaking
HandShake: Type Answer : 03
HandShake: Server Uptime : 96850052
HandShake: FMS Version : 3.0.1.1
HandShake: Handshaking finished....
RTMP_Connect1, handshaked
RTMP_SendPacket: fd=516, size=88
0000: 03 00 00 00 00 00 58 14 00 00 00 00 ......X.....
0000: 02 00 07 63 6f 6e 6e 65 63 74 00 3f f0 00 00 00 ...connect.?....
0010: 00 00 00 03 00 03 61 70 70 02 00 03 76 64 63 00 ......app...vdc.
0020: 04 74 79 70 65 02 00 0a 6e 6f 6e 70 72 69 76 61 .type...nonpriva
0030: 74 65 00 05 74 63 55 72 6c 02 00 19 72 74 6d 70 te..tcUrl...rtmp
0040: 3a 2f 2f 31 32 37 2e 30 2e 30 2e 31 3a 31 39 33 ://127.0.0.1:193
0050: 35 2f 76 64 63 00 00 09 5/vdc...
Invoking connect
RTMP_ReadPacket: fd=516
0000: 02 00 00 00 00 00 04 05 00 00 00 00 ............
0000: 00 26 25 a0 .&%.
HandleServerBW: server BW = 2500000
RTMP_ReadPacket: fd=516
0000: 02 00 00 00 00 00 05 06 00 00 00 00 ............
0000: 00 26 25 a0 02 .&%..
HandleClientBW: client BW = 2500000 2
RTMP_ReadPacket: fd=516
0000: 02 00 00 00 00 00 06 04 00 00 00 00 ............
0000: 00 00 00 00 00 00 ......
HandleCtrl, received ctrl. type: 0, len: 6
HandleCtrl, Stream Begin 0
RTMP_ReadPacket: fd=516
0000: 02 00 00 00 00 00 04 01 00 00 00 00 ............
0000: 00 00 02 00 ....
HandleChangeChunkSize, received: chunk size change to 512
RTMP_ReadPacket: fd=516
0000: 03 00 00 00 00 01 05 14 00 00 00 00 ............
0000: 02 00 07 5f 72 65 73 75 6c 74 00 3f f0 00 00 00 ..._result.?....
0010: 00 00 00 03 00 06 66 6d 73 56 65 72 02 00 0e 46 ......fmsVer...F
0020: 4d 53 2f 33 2c 35 2c 37 2c 37 30 30 39 00 0c 63 MS/3,5,7,7009..c
0030: 61 70 61 62 69 6c 69 74 69 65 73 00 40 3f 00 00 apabilities.@?..
0040: 00 00 00 00 00 04 6d 6f 64 65 00 3f f0 00 00 00 ......mode.?....
0050: 00 00 00 00 00 09 03 00 05 6c 65 76 65 6c 02 00 .........level..
0060: 06 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 1d .status..code...
0070: 4e 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 2e 43 6f NetConnection.Co
0080: 6e 6e 65 63 74 2e 53 75 63 63 65 73 73 00 0b 64 nnect.Success..d
0090: 65 73 63 72 69 70 74 69 6f 6e 02 00 15 43 6f 6e escription...Con
00a0: 6e 65 63 74 69 6f 6e 20 73 75 63 63 65 65 64 65 nection succeede
00b0: 64 2e 00 04 64 61 74 61 08 00 00 00 00 00 07 76 d...data.......v
00c0: 65 72 73 69 6f 6e 02 00 0a 33 2c 35 2c 37 2c 37 ersion...3,5,7,7
00d0: 30 30 39 00 00 09 00 08 63 6c 69 65 6e 74 69 64 009.....clientid
00e0: 00 41 d6 2d 2b 68 80 00 00 00 0e 6f 62 6a 65 63 .A.-+h.....objec
00f0: 74 45 6e 63 6f 64 69 6e 67 00 00 00 00 00 00 00 tEncoding.......
0100: 00 00 00 00 09 .....
RTMP_ClientPacket, received: invoke 261 bytes
(object begin)
Property:
Property:
Property:
(object begin)
Property:
Property:
Property:
(object end)
Property:
(object begin)
Property:
Property:
Property:
Property:
(object begin)
Property:
(object end)
Property:
Property:
(object end)
(object end)
HandleInvoke, server invoking
HandleInvoke, received result for method call
RTMP_SendPacket: fd=516, size=33
0000: 43 00 00 00 00 00 21 14 C.....!.
0000: 02 00 0d 72 65 6c 65 61 73 65 53 74 72 65 61 6d ...releaseStream
0010: 00 40 00 00 00 00 00 00 00 05 02 00 04 6e 74 74 [email protected]
0020: 31 1
Invoking releaseStream
RTMP_SendPacket: fd=516, size=29
0000: 43 00 00 00 00 00 1d 14 C.......
0000: 02 00 09 46 43 50 75 62 6c 69 73 68 00 40 08 00 ...FCPublish.@..
0010: 00 00 00 00 00 05 02 00 04 6e 74 74 31 .........ntt1
Invoking FCPublish
RTMP_SendPacket: fd=516, size=25
0000: 43 00 00 00 00 00 19 14 C.......
0000: 02 00 0c 63 72 65 61 74 65 53 74 72 65 61 6d 00 ...createStream.
0010: 40 10 00 00 00 00 00 00 05 @........
Invoking createStream
RTMP_ReadPacket: fd=516
0000: 03 00 00 00 00 00 88 14 00 00 00 00 ............
0000: 02 00 0b 6f 6e 46 43 50 75 62 6c 69 73 68 00 00 ...onFCPublish..
0010: 00 00 00 00 00 00 00 05 03 00 05 6c 65 76 65 6c ...........level
0020: 02 00 06 73 74 61 74 75 73 00 04 63 6f 64 65 02 ...status..code.
0030: 00 17 4e 65 74 53 74 72 65 61 6d 2e 50 75 62 6c ..NetStream.Publ
0040: 69 73 68 2e 53 74 61 72 74 00 0b 64 65 73 63 72 ish.Start..descr
0050: 69 70 74 69 6f 6e 02 00 19 46 43 50 75 62 6c 69 iption...FCPubli
0060: 73 68 20 74 6f 20 73 74 72 65 61 6d 20 6e 74 74 sh to stream ntt
0070: 31 2e 00 08 63 6c 69 65 6e 74 69 64 00 41 d6 2d 1...clientid.A.-
0080: 2b 68 80 00 00 00 00 09 +h......
RTMP_ClientPacket, received: invoke 136 bytes
(object begin)
Property:
Property:
Property: NULL
Property:
(object begin)
Property:
Property:
Property:
Property:
(object end)
(object end)
HandleInvoke, server invoking
RTMP_ReadPacket: fd=516
0000: 03 00 00 00 00 00 1d 14 00 00 00 00 ............
0000: 02 00 07 5f 72 65 73 75 6c 74 00 40 10 00 00 00 ..._result.@....
0010: 00 00 00 05 00 3f f0 00 00 00 00 00 00 .....?.......
RTMP_ClientPacket, received: invoke 29 bytes
(object begin)
Property:
Property:
Property: NULL
Property:
(object end)
HandleInvoke, server invoking
HandleInvoke, received result for method call
RTMP_SendPacket: fd=516, size=34
0000: 04 00 00 00 00 00 22 14 01 00 00 00 ......".....
0000: 02 00 07 70 75 62 6c 69 73 68 00 40 14 00 00 00 ...publish.@....
0010: 00 00 00 05 02 00 04 6e 74 74 31 02 00 04 6c 69 .......ntt1...li
0020: 76 65 ve
Invoking publish
RTMP_ReadPacket: fd=516
0000: 02 00 00 00 00 00 06 04 00 00 00 00 ............
0000: 00 00 00 00 00 01 ......
HandleCtrl, received ctrl. type: 0, len: 6
HandleCtrl, Stream Begin 1
RTMP_ReadPacket: fd=516
0000: 03 00 00 00 00 00 7c 14 01 00 00 00 ......|.....
0000: 02 00 08 6f 6e 53 74 61 74 75 73 00 00 00 00 00 ...onStatus.....
0010: 00 00 00 00 05 03 00 05 6c 65 76 65 6c 02 00 06 ........level...
0020: 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 17 4e status..code...N
0030: 65 74 53 74 72 65 61 6d 2e 50 75 62 6c 69 73 68 etStream.Publish
0040: 2e 53 74 61 72 74 00 0b 64 65 73 63 72 69 70 74 .Start..descript
0050: 69 6f 6e 02 00 10 50 75 62 6c 69 73 68 69 6e 67 ion...Publishing
0060: 20 6e 74 74 31 2e 00 08 63 6c 69 65 6e 74 69 64 ntt1...clientid
0070: 00 41 d6 2d 2b 68 80 00 00 00 00 09 .A.-+h......
RTMP_ClientPacket, received: invoke 124 bytes
(object begin)
Property:
Property:
Property: NULL
Property:
(object begin)
Property:
Property:
Property:
Property:
(object end)
(object end)
HandleInvoke, server invoking
HandleInvoke, onStatus: NetStream.Publish.Start
Successfully opened the file.
detected 4 logical cores
[h264 @ 0000000001c2a9a0] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0000000001c2a9a0] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0000000001c2a9a0] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0000000001c2a9a0] sps_id 0 out of range
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Error while opening decoder for input stream #0:0 : Invalid data found when processing input
[AVIOContext @ 000000000239a360] Statistics: 0 seeks, 0 writeouts
RTMP_SendPacket: fd=516, size=31
0000: 43 00 00 00 00 00 1f 14 C.......
0000: 02 00 0b 46 43 55 6e 70 75 62 6c 69 73 68 00 40 ...FCUnpublish.@
0010: 18 00 00 00 00 00 00 05 02 00 04 6e 74 74 31 ...........ntt1
Invoking FCUnpublish
RTMP_SendPacket: fd=516, size=34
0000: 43 00 00 00 00 00 22 14 C.....".
0000: 02 00 0c 64 65 6c 65 74 65 53 74 72 65 61 6d 00 ...deleteStream.
0010: 40 1c 00 00 00 00 00 00 05 00 3f f0 00 00 00 00 @.........?.....
0020: 00 00 ..
Invoking deleteStream