notedit / rtclive

(WIP)A WebRTC Edge Low Latency Broadcast Server
MIT License
73 stars 22 forks source link

网页中的视频不能播放。 #5

Closed daozhao closed 5 years ago

daozhao commented 5 years ago

2019-03-04 10 51 50

推流命令: ffmpeg -re -i IMG_2817.mp4 -vcodec copy -acodec copy -f flv rtmp://localhost/live/test_streamID

ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers built with Apple LLVM version 10.0.0 (clang-1000.11.45.5) configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_2817.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Wxmm_900012345 Duration: 00:03:03.95, start: 0.000000, bitrate: 501 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x368, 447 kb/s, 21 fps, 21 tbr, 10752 tbn, 42 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 48 kb/s (default) Metadata: handler_name : SoundHandler HandShake: client signature does not match! Output #0, flv, to 'rtmp://localhost/live/test_streamID': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.20.100 Stream #0:0(und): Video: h264 (High) ([7][0][0][0] / 0x0007), yuv420p, 640x368, q=2-31, 447 kb/s, 21 fps, 21 tbr, 1k tbn, 10752 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 48 kb/s (default) Metadata: handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 970 fps= 21 q=-1.0 size= 2756kB time=00:00:46.08 bitrate= 490.0kbits/s speed= 1x

服务端没有什么异常报错:

[0x7fff9bdc7380][1551666988.891][LOG]-RemoteRateEstimator adding stream [ssrc:0] [0x7fff9bdc7380][1551666988.891][LOG]-Created thread [0xa803420] [0xc0001f9530] [0x7fff9bdc7380][1551666988.920][LOG]-RemoteRateEstimator adding stream [ssrc:0] [0x7fff9bdc7380][1551666988.920][LOG]-Created thread [0x682f420] [0xc0001f9680]

chrome浏览器 2019-03-04 10 17 39

个人估计是视频格式问题。目前我的视频格式: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x368, 447 kb/s, 21 fps, 21 tbr, 10752 tbn, 42 tbc (default) Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 48 kb/s (default)

你方便把你测试的mp4文件上传一少端给我测试下么?或者你对视频格式的要求是怎样?

谢谢。

notedit commented 5 years ago

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.83.100 Duration: 00:40:05.26, start: 0.000000, bitrate: 349 kb/s Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 248 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default) Metadata: handler_name : SoundHandler

notedit commented 5 years ago

看起来是js端的问题 跟视频没关系

notedit commented 5 years ago

可以把这行去掉 https://github.com/notedit/RTCLive-js/blob/master/lib/player.ts#L163

daozhao commented 5 years ago

问题依旧 服务端的输出变了

[GIN] 2019/03/05 - 10:52:01 | 200 | 45.18594065s | 127.0.0.1 | GET /ws message play test_streamID [0x700005f24000][1551754321.702][LOG]-RTPBundleTransport::AddICETransport [6325253fec738dd7:QTql] [0x700005f24000][1551754321.702][LOG]-RemoteRateEstimator adding stream [ssrc:0] [0x700005f24000][1551754321.702][LOG]-DTLSConnection::SetSRTPProtectionProfiles() [profiles:''] [0x700005f24000][1551754321.702][LOG]-DTLSICETransport::SetLocalSTUNCredentials() | [frag:6325253fec738dd7,pwd:a9e28bf921119c160f0702448615bbda08313f6a8eb668d2] [0x700005f24000][1551754321.702][LOG]-DTLSICETransport::SetRemoteSTUNCredentials() | [frag:QTql,pwd:Ho3XEZ6YW+6qHa0kC9tiKRIu] [0x700005f24000][1551754321.702][LOG]-DTLSICETransport::SetRemoteCryptoDTLS | [setup:actpass,hash:sha-256,fingerprint:AA:04:D0:AF:6B:7A:08:A0:B2:49:28:16:53:9D:45:18:8E:4D:19:4E:62:FD:01:A0:3A:C7:69:61:45:64:71:4B] [0x700005f24000][1551754321.702][LOG]-DTLSConnection::SetRemoteSetup() | [remote:2] [0x700005f24000][1551754321.702][LOG]>DTLSConnection::Init() [0x700005f24000][1551754321.702][LOG]<DTLSConnection::Init() [0x700005f24000][1551754321.702][LOG]-Created thread [0x6cf1a80] [0x700006754000][1551754321.702][LOG]>DTLSICETransport::Run() | [0x6cf1800] [0x700005f24000][1551754321.702][LOG]-AddOutgoingSourceGroup [group:0x5abc780,ssrc:1000000009,fec:0,rtx:0] [0x700005f24000][1551754321.703][LOG]-AddOutgoingSourceGroup [group:0x5abcae0,ssrc:1000000010,fec:0,rtx:0] [123 34 100 97 116 97 34 58 123 34 115 100 112 34 58 34 118 61 48 92 114 92 110 111 61 45 32 49 53 53 49 55 53 52 51 50 49 55 48 51 48 56 50 48 48 48 32 49 32 73 78 32 73 80 48 32 49 50 55 46 48 46 48 46 49 92 114 92 110 115 61 109 101 100 105 97 92 ................. [0x7000060ad000][1551754674.157][LOG]-DTLSConnection::onSSLInfo() | DTLS handshake done [0x7000060ad000][1551754674.157][LOG]-DTLSICETransport::onDTLSSetup() [suite:1] [0x7000060ad000][1551754674.157][LOG]-DTLSICETransport::SetLocalCryptoSDES() | suite: AES_CM_128_HMAC_SHA1_80 [0x7000060ad000][1551754674.157][LOG]-DTLSICETransport::SetRemoteCryptoSDES() | suite: AES_CM_128_HMAC_SHA1_80

js没有报错了。不过还是没有视频出现。依然转圈圈。 2019-03-05 10 59 48

这个不知道从何查起。

daozhao commented 5 years ago

使用chrome://webrtc-internals/ 看了一下,发觉没有收到数据包。视频和音频都没有收到。 2019-03-05 11 16 59

notedit commented 5 years ago

检查视频文件 视频baseline gop放小一点 我测试的视频是gop为1秒

daozhao commented 5 years ago

视频已经参照你视频参数修改了,gop也改为1秒了。情况依旧。 还可以检查那里?

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'wjd.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.12.100 Duration: 00:07:48.28, start: 0.000000, bitrate: 351 kb/s Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 27:32 DAR 3:2], 248 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default) Metadata: handler_name : SoundHandler

notedit commented 5 years ago

有可能gstreamer 的相关的插件没装 可以把完备的log贴一下

daozhao commented 5 years ago

果然是gstreamer插件问题。原来我只安装了gst-plugins-base。 把gst-plugins-good,gst-plugins-ugly,gst-plugins-bad全部都安装上。 就可以了。谢谢。