aws-samples / aws-simple-streaming-webapp

Simplifying live streaming contribution with Amazon IVS
MIT No Attribution
28 stars 12 forks source link

simple-streaming-web-app is not working #7

Open caiiiycuk opened 2 years ago

caiiiycuk commented 2 years ago

Hi! I am trying to build a webrtc application that uses ivs to broadcast the video. The main requirement for my app: it must work in all major browsers (chrome, ff, edge, safari, android webview, ios safari). I found this app in aws blogs, and from first look it is exactly what I need. BUT, actually it's not working out of the box. Problems that I found so far:

1. (minor) It's not possible to deploy the app in a custom region, because the region is hard coded (install_ivs_backend.sh:174)

    replace_kms="arn:aws:kms:us-east-1:${replace_accountid}:alias/aws/s3"

I tried to change the region to eu-north-1 but no luck. Never mind, I deployed it to us-east-1.

2. (minor) The pattern in hosting/S3AndCloudFront/parameters.json contains account id which in my case have uppercase letters. And so whenever I tried to do aws push it failed on the S3 bucket creation error. So I changed the pattern to be able to deploy it.

3. (major) stream.js:390 captureStream is not working for Firefox 100, it tells me no such method. Idk why, in Chrome it works.

    let vidStreaming = stream.current.captureStream(30);

4. (major) stream.js:380-404 the app tries to send data into websocket before it opens. So I put the media recorder start(1000) in the "open" listener to make it work

    wsRef.current.addEventListener('open', async function open(data) {
    // ...
    });

    let vidStreaming = stream.current.captureStream(30);
    let outputStream = new MediaStream();
    // ...
    mediaRecorder.current.addEventListener('dataavailable', (e) => {
      // happens BEFORE 'open'
      wsRef.current.send(e.data);
    });

5. (critical) stream.js:397-400 mimeType video/webm is not supported by Safari (both mac/iphone), for Safari you should use video/mp4. So this app will work only on Windows, Linux PC and Android. Not sure if ffmpeg will silently handle change of container.

    mediaRecorder.current = new MediaRecorder(outputStream, {
      mimeType: 'video/webm',
      videoBitsPerSecond: 3000000,
    });

6. (critical) even with all of my fixes I can't test this app, because on fargate side ffmpeg didn't transcode stream, it prints:

12.05.2022, 09:55:04    FFMPEG closed, reason 1 , null  arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:04    Connection Closed: 1006 arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:04    FFMPEG MSG: [aac @ 0x56385e3f5c40] Qavg: -nan   arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:04    FFMPEG MSG: Conversion failed!  arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:04    FFMPEG MSG: [flv @ 0x56385e3ba380] Video codec vp8 not compatible with flv  arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:04    Could not write header for output file #0 (incorrect codec parameters ?): Function not implemented  arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:04    Error initializing output stream 0:1 --     arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:04    FFMPEG MSG: Stream mapping: arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:04    Stream #0:1 -> #0:0 (copy)  arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:04    Stream #0:0 -> #0:1 (opus (native) -> aac (native)) arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:03    FFMPEG MSG: Input #0, matroska,webm, from 'pipe:':  arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:03    Metadata:   arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:03    encoder : Chrome    arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:03    Duration: N/A, start: 0.000000, bitrate: N/A    arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:03    Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)   arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc
12.05.2022, 09:55:03    Stream #0:1(eng): Video: vp8, yuv420p(progressive), 1280x720, SAR 1:1 DAR 16:9, 29.97 tbr, 1k tbn, 1k tbc (default) arn:aws:ecs:us-east-1:373068080393:task/ivs/4c9ec5a2571344d9aa33a7f17b178cb9
ivs-webrtc

FFMPEG MSG: [flv @ 0x56385e3ba380] Video codec vp8 not compatible with flv. - seems that ffmpeg command line arguments is incorrect.

So I am very surprised that this demo app is not working even for the most popular browser - Chrome.

--

Regarding to the app architecture, for me is not clear: is app intended to manage only one webrtc publisher? I know that ffmpeg does not do any intensive cpu operations when transcoding from webrtc to rtmps, but anyway at some count of publisher you can't use the same node.

Q1. Do I need to scale the instance count of fargate nodes somehow, like add node for each of the 10 publisher?

Q2. Same for ivs channel. Do I need to create a new channel for a new publisher (1 channel == 1 publisher)? So, I need to do it programmatically?

P. S. I am not trying to complain that app is not working, overall this app is doing a lot of work, so I hope to run it finally. Thank you for your work.

osmarbento-AWS commented 2 years ago

under investigation.

osmarbento-AWS commented 2 years ago

Question to better understand the scenario for the VP8 ffmpeg: WebRTC protocol supports H264 as per https://developer.mozilla.org/en-US/docs/Web/Media/Formats/WebRTC_codecs

Which is supported by: Chrome (52+), Edge, Firefox, Safari So, to avoid inserting extra latency to IVS, the solution just copy the video, not performing any transcoding. In the logs provided, it's sending in VP8

What is the browser that you had performed the tests, also the version?

caiiiycuk commented 2 years ago

I just used this test app, without changing codes/etc. I used Chrome 101.0.4951.41 Ubuntu. I think VP8 is default codec for chrome.

osmarbento-AWS commented 2 years ago

Hi Alexander @caiiiycuk, We have been rewriting the code, for better reading and maintenance, please not that webrtc has support variations among browsers and Chrome is the recommend browser for this solution.

I've just published a preview version, branch v2preview https://github.com/aws-samples/aws-simple-streaming-webapp/tree/v2preview intend to address the main points reported by you as well as simplification of the deployment steps and option to run locally de UI and container, only depending on deploy the Amplify components, such as Auth and APIs (API Gateway, Lambda and Cognito User Pool).

A few considerations on the issues reported by you:

  1. (major) stream.js:390 captureStream is not working for Firefox 100, it tells me no such method. Idk why, in Chrome it works. let vidStreaming = stream.current.captureStream(30); The video element has been added into a canvas element that seems to have better compatibility with browsers.

Please check check the https://github.com/osmarbento-AWS/simple-streaming-webapp/blob/v2preview/frontend/BROWSER.md for more information

  1. (major) stream.js:380-404 the app tries to send data into websocket before it opens. So I put the media recorder start(1000) in the "open" listener to make it work:

Fixed. Please check the v2preview.

  1. (critical) stream.js:397-400 mimeType video/webm is not supported by Safari (both mac/iphone), for Safari you should use video/mp4. So this app will work only on Windows, Linux PC and Android. Not sure if ffmpeg will silently handle change of container.

Safari and IOS in not currently supported. You can change ffmpeg to transcode the video by replacing the ffmpeg command on thebackend/docker_files/src/transwrap.js if that is a requirement for you and change the MediaRecorder as you suggested. Please see below the ffmpeg command bellow: chenge the vcoded to:

    const ffmpeg = callff.spawn(
      'ffmpeg', 
      ['-i', '-', '-c:v', 'libx264', 'pix_fmt', 'yuv420p', '-profile:v main', '-preset', 'veryfast', '-tune', 'zerolatency', '-acodec', 'aac', '-reconnect', '3', '-reconnect_at_eof', '1', '-reconnect_streamed', '3',        '-f', 'flv', rtmpURL
    ]);

More details in the follow link

  1. (critical) even with all of my fixes I can't test this app, because on fargate side ffmpeg didn't transcode stream, it prints: We change the MediaRecoder to force h264
  mediaRecorder.current = new MediaRecorder(outputStream, {
      mimeType: "video/webm;codecs=h264", // attempt to improve cross browser / platform support with h264
      videoBitsPerSecond: 3000000,
    });

The main reason to not transcode in the proxy server ECS container is to avoid adding additional latency. Which is one of the key features of amazon IVS.

Q1. Do I need to scale the instance count of fargate nodes somehow, like add node for each of the 10 publisher? We are doing tests, we are happy to discuss in a call. We are about to publish a new Dockerfile to improve performance and container size

Q2. Same for ivs channel. Do I need to create a new channel for a new publisher (1 channel == 1 publisher)? So, I need to do it programmatically?

1 Channel per simultaneous publisher, you can also use IVS API's to manage the stream keys, so that you provide 1 stream key per publisher, please check Amazon IVS API documentation for more information. https://docs.aws.amazon.com/ivs/latest/APIReference/Welcome.html

Please note that this is a preview, we are doing sanity checks, code review before merging it to the main branch.

caiiiycuk commented 2 years ago

Thank you. Doesn't IVS support RTMPS/vp9? I mean can I copy of video stream with ffmpeg like in h264 case?

caiiiycuk commented 2 years ago

I did npm install in frontend but, I have following errors on npm start:


Module not found: Error: Can't resolve 'aws-amplify' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/@aws-amplify/ui-react/dist/esm/components/Authenticator/SetupTOTP'
ERROR in ./node_modules/@aws-amplify/ui-react/dist/esm/components/Authenticator/SetupTOTP/SetupTOTP.js 5:0-53
Module not found: Error: Can't resolve 'aws-amplify' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/@aws-amplify/ui-react/dist/esm/components/Authenticator/SetupTOTP'

ERROR in ./node_modules/@aws-amplify/ui-react/dist/esm/components/Geo/MapView/index.js 3:0-54
Module not found: Error: Can't resolve 'aws-amplify' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/@aws-amplify/ui-react/dist/esm/components/Geo/MapView'

ERROR in ./node_modules/@aws-amplify/ui/dist/esm/helpers/authenticator/formFields/defaults.js 6:0-21
Module not found: Error: Can't resolve 'aws-amplify' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/@aws-amplify/ui/dist/esm/helpers/authenticator/formFields'

ERROR in ./node_modules/@aws-amplify/ui/dist/esm/helpers/authenticator/utils.js 1:0-39
Module not found: Error: Can't resolve 'aws-amplify' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/@aws-amplify/ui/dist/esm/helpers/authenticator'

ERROR in ./node_modules/@aws-amplify/ui/dist/esm/i18n/translations.js 2:0-40
Module not found: Error: Can't resolve 'aws-amplify' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/@aws-amplify/ui/dist/esm/i18n'

ERROR in ./node_modules/@aws-amplify/ui/dist/esm/machines/authenticator/actors/signIn.js 2:0-40
Module not found: Error: Can't resolve 'aws-amplify' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/@aws-amplify/ui/dist/esm/machines/authenticator/actors'

ERROR in ./node_modules/@aws-amplify/ui/dist/esm/machines/authenticator/actors/signOut.js 2:0-40
Module not found: Error: Can't resolve 'aws-amplify' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/@aws-amplify/ui/dist/esm/machines/authenticator/actors'

ERROR in ./node_modules/@aws-amplify/ui/dist/esm/machines/authenticator/defaultServices.js 2:0-54
Module not found: Error: Can't resolve 'aws-amplify' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/@aws-amplify/ui/dist/esm/machines/authenticator'

ERROR in ./node_modules/@aws-amplify/ui/dist/esm/machines/authenticator/signUp.js 2:0-40
Module not found: Error: Can't resolve 'aws-amplify' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/@aws-amplify/ui/dist/esm/machines/authenticator'

ERROR in ./node_modules/maplibre-gl-js-amplify/lib/esm/AmplifyMapLibreGeocoder.js 46:0-39
Module not found: Error: Can't resolve '@aws-amplify/geo' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/maplibre-gl-js-amplify/lib/esm'

ERROR in ./node_modules/maplibre-gl-js-amplify/lib/esm/AmplifyMapLibreRequest.js 47:0-39
Module not found: Error: Can't resolve '@aws-amplify/geo' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/maplibre-gl-js-amplify/lib/esm'

ERROR in ./node_modules/maplibre-gl-js-amplify/lib/esm/drawClusterLayer.js 1:0-39
Module not found: Error: Can't resolve '@aws-amplify/geo' in '/home/caiiiycuk/aws-streaming/frontend/node_modules/maplibre-gl-js-amplify/lib/esm'

webpack compiled with 12 errors
``
caiiiycuk commented 2 years ago

guess need to add aws-amplify and @aws-amplify/geo into package.json.

osmarbento-AWS commented 2 years ago

1) For now, IVS only support H264 2) We are using Amplify Modular Import to reduce the bundle size, so adding aws-amplify goes to the full import. which I was trying to avoid https://github.com/aws-amplify/amplify-js/wiki/Amplify-Modularization Could you share, npm, node, amplify versions been used, please?

caiiiycuk commented 2 years ago

npm: 6.14.17 node: 14.19.2 amplify: 8.2.0

caiiiycuk commented 2 years ago

I added this libs, and frontend is working, also I deployed backend. I saw 2 running task in ivs service. Everything seems working, but when I trying to go live I have this issues: изображение

DynamoDB config: изображение

osmarbento-AWS commented 2 years ago

Ok, I saw that you added a CloudFront in front of the ECS servers, and probably cloudfront is not accepting the self-signed certificate, having TLS negation denied. Alternatives: 1) Use HTTP between the 1.1) change the Docker file to use the transwrap_local.js instead: CMD ["pm2-runtime","/opt/ivs-simple-webrtc/transwrap_local.js","-i max"]

1.2) now point the distribution to the HTTP endpoint, so the conversation between browser and CDN, will happen in HTTPS and HTTP between the CDN and Server.

2) Add a valid certificate to the container.

caiiiycuk commented 2 years ago

Okay, I removed cloudfront, and now everything works. But, I have very big delay ~5 min. When I open a stream player I see the stream that was like 5 min ago. I think it's because the fargate container is not powerful enough to process a stream in realtime (I used transcoder for h264):

1653361652165
frame=13384 fps= 14 q=-1.0 size= 102102kB time=00:08:56.86 bitrate=1558.0kbits/s speed=0.578x
1653361653235
frame=13411 fps= 14 q=-1.0 size= 102302kB time=00:08:57.94 bitrate=1557.9kbits/s speed=0.578x
1653361653925
frame=13439 fps= 14 q=-1.0 size= 102488kB time=00:08:59.06 bitrate=1557.5kbits/s speed=0.579x
1653361655093
frame=13465 fps= 14 q=-1.0 size= 102693kB time=00:09:00.10 bitrate=1557.6kbits/s speed=0.579x
1653361656080
frame=13488 fps= 14 q=-1.0 size= 102871kB time=00:09:01.02 bitrate=1557.6kbits/s speed=0.58x
1653361657293
frame=13516 fps= 14 q=-1.0 size= 103078kB time=00:09:02.14 bitrate=1557.6kbits/s speed=0.58x
1653361658229
frame=13545 fps= 14 q=-1.0 size= 103259kB time=00:09:03.30 bitrate=1557.0kbits/s speed=0.581x
1653361659199
frame=13575 fps= 14 q=-1.0 size= 103462kB time=00:09:04.50 bitrate=1556.6kbits/s speed=0.582x
1653361660152
frame=13602 fps= 15 q=-1.0 size= 103661kB time=00:09:05.58 bitrate=1556.5kbits/s speed=0.582x
1653361661296
frame=13632 fps= 15 q=-1.0 size= 103858kB time=00:09:06.78 bitrate=1556.0kbits/s speed=0.583x
1653361662210
frame=13663 fps= 15 q=-1.0 size= 104071kB time=00:09:08.02 bitrate=1555.7kbits/s speed=0.583x
1653361663768
frame=13683 fps= 15 q=-1.0 size= 104228kB time=00:09:08.82 bitrate=1555.8kbits/s speed=0.583x
1653361665342
frame=13737 fps= 15 q=-1.0 size= 104589kB time=00:09:10.98 bitrate=1555.0kbits/s speed=0.585x
1653361666736
frame=13765 fps= 15 q=-1.0 size= 104774kB time=00:09:12.10 bitrate=1554.6kbits/s speed=0.585x
1653361667564
frame=13790 fps= 15 q=-1.0 size= 104962kB time=00:09:13.10 bitrate=1554.6kbits/s speed=0.586x
1653361668585
frame=13818 fps= 15 q=-1.0 size= 105174kB time=00:09:14.22 bitrate=1554.6kbits/s speed=0.586x

You see that fps is 15, and speed is 0.586x, at start it was like 1.2x

caiiiycuk commented 2 years ago

Setting vCPU to 1 didn't help. Delay is here. It works very unstable for me. I have 3 cases: 1. I press "GO Live" wait until ffmpeg start showing frame messages. When I open a player it says that stream have corrupted/incompatible data. In ivs dashboard stream showed as not started (happens rarely). 2. I press "GO Live" wait until ffmpeg start showing frame messages. When I open a player it shows a black screen. In ivs dashboard I see same black screen and "Live" message, in stream detail I can see that data is sending:

изображение (happens often) 3. Stream is normally started, and works but I have delay ~5min or more.

Each time I have this error messages from ffmpeg:

MSG: Connected to server
1653364175068
ffmpeg version 4.3.2-0york0~18.04 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix=/usr --extra-version='0york0~18.04' --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-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-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --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-opencl --enable-opengl --enable-sdl2 --enable-libzimg --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
1653364175068
libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100
1653364177796
[h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced
1653364177801
Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 2 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 3 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced
1653364177986
Last message repeated 2 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 2 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 2 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame!
1653364177986
[h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 2 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame! [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced Last message repeated 1 times [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] non-existing PPS 0 referenced [h264 @ 0x55cfcfaac140] decode_slice_header error [h264 @ 0x55cfcfaac140] no frame!
1653364180571
Input #0, h264, from 'pipe:': Duration: N/A, bitrate: N/A Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(progressive), 458x152, 25 fps, 25 tbr, 1200k tbn, 50 tbc
1653364181123
Output #0, flv, to 'rtmps://8d9be9fbc687.global-contribute.live-video.net:443/app/sk_us-east-1_tD66LgHKwLYO_H3kTaWtHciPF2oZ2KDCCGWWv399EwR': Metadata: encoder : Lavf58.45.100
1653364181123
Stream #0:0: Video: h264 (Constrained Baseline) ([7][0][0][0] / 0x0007), yuv420p(progressive), 458x152, q=2-31, 25 fps, 25 tbr, 1k tbn, 1200k tbc Stream mapping: Stream #0:0 -> #0:0 (copy) [flv @ 0x55cfcfaad5c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
osmarbento-AWS commented 2 years ago

I have been thinking on how to auto detect the supported mimeType of the browser and based on that, choose to transcode or not in the remote container.

In the frontend, we might think in a function like:

  function getmimeType() {
    let options = {
      mimeType: "video/webm;codecs=h264",
      videoBitsPerSecond: 3000000,
    };

    if (!MediaRecorder.isTypeSupported(options.mimeType)) {
      addDebugLine(Date.now(), `${options.mimeType} +  is not Supported`);
      options = {
        mimeType: "video/webm",
        videoBitsPerSecond: 3000000,
      };
      if (!MediaRecorder.isTypeSupported(options.mimeType)) {
        addDebugLine(Date.now(), `${options.mimeType} +  is not Supported`);
        options = {
          mimeType: "video/mp4",
          videoBitsPerSecond: 3000000,
        };
      }
    }
    return options;
  } 

"video/webm", would cover most of the cases for vp9 and vp8, although vp9 has several impact on performance, and instead we might force to vp8 instead.

mimeType: "video/webm;codes=vp8,opus",

In the backend, transwrap.js I'm planning to add a if to detect the codec and so decide on transcoding or not. As has several impact on the container size.

With Chrome Version 102.0.5005.61 (Official Build) (x86_64), and mac, it accepts video/webm;codecs=h264, it runs correctly and reasonable performance, 1.X speed and 6s e2e latency.

Could you provide the following information:

1) what the current video and audio codec selected in the MediaRecorder, if you check the console log is been printing the data blob, there you can get such information: Chrome:

image

Firefox: image

2) Also, could you run the following JS:

function getSupportedMimeTypes(media, types, codecs) {
  const isSupported = MediaRecorder.isTypeSupported;
  const supported = [];
  types.forEach((type) => {
    const mimeType = `${media}/${type}`;
    codecs.forEach((codec) => [
        `${mimeType};codecs=${codec}`,
        `${mimeType};codecs=${codec.toUpperCase()}`,
        // /!\ false positive /!\
        // `${mimeType};codecs:${codec}`,
        // `${mimeType};codecs:${codec.toUpperCase()}` 
      ].forEach(variation => {
        if(isSupported(variation)) 
            supported.push(variation);
    }));
    if (isSupported(mimeType))
      supported.push(mimeType);
  });
  return supported;
};

// Usage ------------------

const videoTypes = ["webm", "ogg", "mp4", "x-matroska"];
const audioTypes = ["webm", "ogg", "mp3", "x-matroska"];
const codecs = ["should-not-be-supported","vp9", "vp9.0", "vp8", "vp8.0", "avc1", "av1", "h265", "h.265", "h264", "h.264", "opus", "pcm", "aac", "mpeg", "mp4a"];

const supportedVideos = getSupportedMimeTypes("video", videoTypes, codecs);
const supportedAudios = getSupportedMimeTypes("audio", audioTypes, codecs);

console.log('-- Top supported Video : ', supportedVideos[0])
console.log('-- Top supported Audio : ', supportedAudios[0])
console.log('-- All supported Videos : ', supportedVideos)
console.log('-- All supported Audios : ', supportedAudios)

Source: https://stackoverflow.com/questions/41739837/all-mime-types-supported-by-mediarecorder-in-firefox-and-chrome

3) what is the current ffmpeg command that you are using?

caiiiycuk commented 2 years ago

I will look into it

caiiiycuk commented 2 years ago

1) type: "video/x-matroska;codecs=avc1,opus" 2) For Chrome:

Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36
-- Top supported Video : video/webm;codecs=vp9
-- Top supported Audio : audio/webm;codecs=opus
-- All supported Videos : video/webm;codecs=vp9,video/webm;codecs=VP9,video/webm;codecs=vp9.0,video/webm;codecs=VP9.0,video/webm;codecs=vp8,video/webm;codecs=VP8,video/webm;codecs=vp8.0,video/webm;codecs=VP8.0,video/webm;codecs=avc1,video/webm;codecs=AVC1,video/webm;codecs=h264,video/webm;codecs=H264,video/webm;codecs=opus,video/webm;codecs=OPUS,video/webm;codecs=pcm,video/webm;codecs=PCM,video/webm,video/x-matroska;codecs=vp9,video/x-matroska;codecs=VP9,video/x-matroska;codecs=vp9.0,video/x-matroska;codecs=VP9.0,video/x-matroska;codecs=vp8,video/x-matroska;codecs=VP8,video/x-matroska;codecs=vp8.0,video/x-matroska;codecs=VP8.0,video/x-matroska;codecs=avc1,video/x-matroska;codecs=AVC1,video/x-matroska;codecs=h264,video/x-matroska;codecs=H264,video/x-matroska;codecs=opus,video/x-matroska;codecs=OPUS,video/x-matroska;codecs=pcm,video/x-matroska;codecs=PCM,video/x-matroska
-- All supported Audios : audio/webm;codecs=opus,audio/webm;codecs=OPUS,audio/webm;codecs=pcm,audio/webm;codecs=PCM,audio/webm

For FF:

Browser: Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0
-- Top supported Video : video/webm;codecs=vp8
-- Top supported Audio : audio/webm;codecs=opus
-- All supported Videos : video/webm;codecs=vp8,video/webm;codecs=vp8.0,video/webm;codecs=opus,video/webm
-- All supported Audios : audio/webm;codecs=opus,audio/webm,audio/ogg;codecs=opus,audio/ogg

For Android:

Browser: Mozilla/5.0 (Linux; Android 7.1.1; MI MAX 2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.104 Mobile Safari/537.36
-- Top supported Video : video/webm;codecs=vp9
-- Top supported Audio : audio/webm;codecs=opus
-- All supported Videos : video/webm;codecs=vp9,video/webm;codecs=VP9,video/webm;codecs=vp9.0,video/webm;codecs=VP9.0,video/webm;codecs=vp8,video/webm;codecs=VP8,video/webm;codecs=vp8.0,video/webm;codecs=VP8.0,video/webm;codecs=opus,video/webm;codecs=OPUS,video/webm;codecs=pcm,video/webm;codecs=PCM,video/webm,video/x-matroska;codecs=vp9,video/x-matroska;codecs=VP9,video/x-matroska;codecs=vp9.0,video/x-matroska;codecs=VP9.0,video/x-matroska;codecs=vp8,video/x-matroska;codecs=VP8,video/x-matroska;codecs=vp8.0,video/x-matroska;codecs=VP8.0,video/x-matroska;codecs=opus,video/x-matroska;codecs=OPUS,video/x-matroska;codecs=pcm,video/x-matroska;codecs=PCM,video/x-matroska
-- All supported Audios : audio/webm;codecs=opus,audio/webm;codecs=OPUS,audio/webm;codecs=pcm,audio/webm;codecs=PCM,audio/webm

For iPhone 8 (15.5):

Browser: Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Mobile/15E148 Safari/604.1
-- Top supported Video : video/mp4;codecs=avc1
-- Top supported Audio : undefined
-- All supported Videos : video/mp4;codecs=avc1,video/mp4;codecs=AVC1,video/mp4;codecs=mp4a,video/mp4;codecs=MP4A,video/mp4
-- All supported Audios :

3)

    const ffmpeg = callff.spawn(
      'ffmpeg', 
      ['-i', '-', '-vcodec', 'copy', '-preset', 'veryfast', '-tune', 'zerolatency', '-acodec', 'aac', '-reconnect', '3', '-reconnect_at_eof', '1', '-reconnect_streamed', '3',        '-f', 'flv', rtmpURL
    ]);

My solution is deployed to https://d2k6w1x5vnqp9h.cloudfront.net/, you should accept certificate to https://ec2-54-162-64-167.compute-1.amazonaws.com and channel is

Will keep it live for couple of days, you will have a chance to test how it works for you. Because for me it completely unusable, I recorded couple of videos:

  1. Problems with connection: https://youtu.be/3bhWt-Pug34
  2. Lags: https://youtu.be/TfaHBz7irVY
caiiiycuk commented 2 years ago

Task config:

Operating system/Architecture
Linux/X86_64
CPU | Memory
1 vCPU | 2 GB
Platform version
1.4.0

Full task logs: ffmpeg.logs.gz

osmarbento-AWS commented 1 year ago

https://aws.amazon.com/blogs/media/broadcast-from-a-browser-with-the-amazon-ivs-web-broadcast-sdk/