Re: [mediacapture-record] Add replaceTrack method to MediaStream (#167)

@jan-ivar Yes, Chromium provides means to record variable resolution VP8, h264, and avc1 codecs. Playback of the variable resolution WebM video at Chromium is a separate issue. See the link to Chromium bug at previous post, see also links to other issues. In brief, Chromium implementation of `MediaRecorder` VP8 codecs and HTML `<video>` element does not display the exact input frame resolution for each frame. `video/x-matroska;codecs=h264` or `video/webm;codecs=avc1` or vice versa do display variable resolution output at HTML `<video>` element https://plnkr.co/edit/Axkb8s?p=info, though do to the codecs used is not currently playable at Mozilla browsers. Mozilla Firefox and Nightly do not have any issue recording an HTML `<video>` element with dynamic resolution changes and outputting exactly if not precisely each frame that was recorded at `<video>` element. Chromium crashes the browser when executing `captureStream()` on a `<video>` element when resolution changes at the first `resize` event. 

In fact, video recorded at Mozilla does resize HTML `<video>` element at Chromium. This version of code using `MediaRecorder` does output variable resolution frames at Mozilla browers https://github.com/guest271314/MediaFragmentRecorder/tree/imagecapture-audiocontext-readablestream-writablestream. video recorded at Chromium However, the two implementations of encoding WebM are distinct enough from each other to not be capable of being merged. That is what the gist of this issue is about: writing code which outputs the same result at Chromium and Firefox. 

If not for the initial and maintained use case of composing the same code for both browsers would have stopped at version 0 at Firefox using `MediaSource`. However, that is not the case https://github.com/guest271314/MediaFragmentRecorder/branches. Yes, it is possible to record "remote" WebRTC tracks via `MediaStream` at Firefox, Nightly see the "master" and "webtrc-replacetrack" (and "canvas") branches at the linked repository.

To an appreciable already solved the issue as to what the expected output is with workarounds. That is, observing and noting and working around various bugs, primarily Chromium browser crashes and Firefox clipping or muting the last approximately 1 second of audio. Each branch contains links the bugs found while experimenting. Not certain how many there were, though more than likely filed the majority. The workarounds are insuffient. The "webtrc-replacetrack" approach at the linked repository 

The implementation of events, constraints, `getSettings()`, etc. relating to `MediaStream` and `MediaStreamTrack` at Firefox and Chromium are not exactly the same, e.g., see https://github.com/w3c/mediacapture-fromelement/issues/78.

The specification is the goal. Meaning, note each point that crashed the browser needs to be properly addressed equally to the overall expected output of replaced tracks and streams. That means not omitting thoroughly defining track order, resolution changes, muting of last secod of audio.


-- 
GitHub Notification of comment by guest271314
Please view or discuss this issue at https://github.com/w3c/mediacapture-record/issues/167#issuecomment-531056881 using your GitHub account

Received on Friday, 13 September 2019 00:35:23 UTC