chenxiaoqino / getusermedia-to-rtmp

186 stars 60 forks source link

Why is only working on chrome ? #10

Open panpansh opened 5 years ago

panpansh commented 5 years ago

FFMPEG:ffmpeg version 4.1.1-1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8 (Debian 8.2.0-20) configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared

FFMPEG: 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, matroska,webm, from 'pipe:': Metadata: encoder : Chrome Duration: N/A, start: 1558246182.104000, bitrate: N/A Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default) Stream #0:1(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 640x480, SAR 1:1 DAR 4:3, 30.30 fps, 30 tbr, 1k tbn, 60 tbc (default)

chenxiaoqino commented 5 years ago

Hi, this looks like the normal logging information, can you find the actual log that mention some error? Or, is there no more log? (Normally there will be some progress log.)

My first guess is this is caused by a codec issue, i.e., Firefox is uploading a certain format of stream that FFMpeg is not expecting. However, it's always possible to manually specify input codec. (By default, FFMpeg guess the codec, and should already support the one Firefox emits.)

panpansh commented 5 years ago

FFMPEG: 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 Splitting the commandline. Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'. Reading option '-use_wallclock_as_timestamps' ... matched as AVOption 'use_wallclock_as_timestamps' with argument '1'. Reading option '-i' ... matched as input url with argument '-'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264'. Reading option '-preset' ... matched as AVOption 'preset' with argument 'slow'. Reading option '-tune' ... matched as AVOption 'tune' with argument 'zerolatency'. Reading option '-crf' ... matched as AVOption 'crf' with argument '22'. Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'. Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '11025'. Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '32k'. Reading option '-async' ... matched as option 'async' (audio sync method) with argument '1'. Reading option '-fflags' ... matched as AVOption 'fflags' with argument '+genpts'. Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'. Reading option 'rtmp://domain:1935/live/test0' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option y (overwrite output files) with argument 1. Applying option loglevel (set logging level) with argument trace. Applying option async (audio sync method) with argument 1. Successfully parsed a group of options. Parsing a group of options: input url -. Successfully parsed a group of options. Opening an input file: -. [NULL @ 0x555ac6f02f00] Opening 'pipe:' for reading [pipe @ 0x555ac6f03940] Setting default whitelist 'crypto'

panpansh commented 5 years ago

... Successfully parsed a group of options. Opening an input file: -. [NULL @ 0x55cd41a44f00] Opening 'pipe:' for reading [pipe @ 0x55cd41a45940] Setting default whitelist 'crypto'

STUCK HERE ON FIREFOX

FFMPEG:Probing h264 score:51 size:2048 Probing matroska,webm score:100 size:2048 Probing mp3 score:1 size:2048 [matroska,webm @ 0x55cd41a44f00] Format matroska,webm probed with size=2048 and score=100 st:0 removing common factor 1000000 from timebase st:1 removing common factor 1000000 from timebase [matroska,webm @ 0x55cd41a44f00] Before avformat_find_stream_info() pos: 199 bytes read:16421 seeks:0 nb_streams:2

FFMPEG:[AVBSFContext @ 0x55cd41ab08c0] nal_unit_type: 9(AUD), nal_ref_idc: 0 [AVBSFContext @ 0x55cd41ab08c0] nal_unit_type: 7(SPS), nal_ref_idc: 3

FFMPEG:[AVBSFContext @ 0x55cd41ab08c0] nal_unit_type: 8(PPS), nal_ref_idc: 3 [AVBSFContext @ 0x55cd41ab08c0] nal_unit_type: 6(SEI), nal_ref_idc: 0 Last message repeated 1 times [AVBSFContext @ 0x55cd41ab08c0] nal_unit_type: 5(IDR), nal_ref_idc: 3

FFMPEG: Last message repeated 3 times [h264 @ 0x55cd41a48ec0] nal_unit_type: 9(AUD), nal_ref_idc: 0 ...

chenxiaoqino commented 5 years ago

I guess the issue is with socket.io, as the log essentially tells that FFMpeg is not receiving any data. Can you try to add some console.log to

socket.on('binarystream',function(m){
    ....
    feedStream(m);
}

part on the server, and possibly also near the

mediaRecorder.ondataavailable = function(e) {
    socket.emit("binarystream",e.data);
    ...
}

on the client, to debug and verify there is indeed data going through?

If there is data from client side, but not received on the server side, we're in deep trouble as socket.io is not working as intended. If there's no data being sent by the client at all, we may debug why Firefox's getUserMedia is not sending video traffic...

panpansh commented 5 years ago

yes exactly my friend, mediaRecorder.ondataavailable never called on firefox (66.0.5 (64 bits) updated just now but same).

the problem is mediaRecorder.start(0); it doesn't accept 0 value when I try with 10 or 100 or 1000 (ms) it's lagging. It's maybe not a good approach.

Best Regards

panpansh commented 5 years ago

Is it possible to send the stream directly via socketio stream ?

chenxiaoqino commented 5 years ago

Yes it is possible, however if you are trying P2P stream you should search for webRTC.

Yours sincerely, Xiaoqi Chen cxqn.info

On Tue, May 21, 2019 at 6:35 AM panpansh notifications@github.com wrote:

Is it possible to send the stream directly via socketio stream ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chenxiaoqino/getusermedia-to-rtmp/issues/10?email_source=notifications&email_token=AAN6SXXW452D6SPNCMWGY4TPWP3DDA5CNFSM4HN3YBWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV35UNA#issuecomment-494393908, or mute the thread https://github.com/notifications/unsubscribe-auth/AAN6SXSFP2DKVHSWNZNFKE3PWP3DDANCNFSM4HN3YBWA .