Я использую ffmpeg для преобразования потока RTSP в поток RTMP. Затем поток RMTP будет передан в Wowza Streaming Engine. Я понятия не имею, почему он работает очень хорошо на одном сервере, но не работает на другом сервере. Оба сервера находятся в разных сетях, но оба являются Window Server 2012, имеют одинаковую версию ffmpeg, преобразуют один и тот же поток RTSP, но один из них завершается ошибкой с сообщением об ошибке Ошибка при открытии декодера для входного потока # 0: 0: при обработке ввода обнаружены неверные данные
Я использовал команду ffmpeg:
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
Я сравниваю оба сообщения отладки ffmpeg в обоих случаях и замечаю следующие различия / поведение:
В случае успеха ffmpeg сначала открывает поток RTSP с использованием UDP, но с тайм-аутом UDP, затем повторяет попытку с TCP.В случае сбоя кажется, что это успешно с UDP и нет необходимости повторять с TCP.
Когда ffmpeg успешно открывает поток RTSP, следующая информация распечатывается для успешного случая
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.
А для случая сбоя распечатывается следующая информация:
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.
Обратите внимание, что число после «Stream # 0:0» отличается.
- В процессе "Сопоставление потоков" случай сбоя содержит следующие сообщения об ошибках.Затем процесс ffmpeg останавливается:
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
Есть ли у вас какие-либо идеи для случаев отказа и как я могу устранить неполадки?
Ниже отладочное сообщение для обоих случаев для информации
Дело об отказе
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 .@...........ntt 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