[HN Gopher] The skater punk's guide to MediaRecorder
       ___________________________________________________________________
        
       The skater punk's guide to MediaRecorder
        
       Author : davekiss
       Score  : 31 points
       Date   : 2022-04-12 16:52 UTC (6 hours ago)
        
 (HTM) web link (mux.com)
 (TXT) w3m dump (mux.com)
        
       | j1elo wrote:
       | The MiniDV analogy is a really good one for explaining how
       | _MediaRecorder_ works, but also a good one to explain why it is a
       | poorly designed API.
       | 
       | The video needs to be stored for its consumption, like any video,
       | in a container format (like MP4 or Matroska) and these formats
       | more often than not, require to _revise_ what was initially
       | written and rewrite some chunks when the recording has finished
       | up. (I 'm talking here about e.g. metadata that goes at the
       | beginning of the file but the actual values cannot be known until
       | the file is complete)
       | 
       | I wonder how you guys at Mux handle this limitation of the API;
       | do you store the recorded videos at all on file?
       | 
       | You would think an API meant to generate some type of video,
       | would be ready to _properly_ do it, right? Or as someone put in a
       | way that made me laugh (from the Chrome bug report, linked below
       | at [1]),
       | 
       | > _I don 't think any developer out here would ever mark a broken
       | piece of code as "won't fix"_
       | 
       | The reality is that everybody looks away. Chrome produces broken
       | files [1] that are not seekable, and when asked about it they
       | shrug and say that the spec itself is meant to be that way, and
       | that you should use an external tool to fix the files (which is
       | also broken for that use case! so not really a solution at all
       | [2]). Firefox has the same problem but doesn't look like they
       | progressed much either [3].
       | 
       | Meanwhile, yeah the spec is as it is and the issue as of today
       | seems to be open [4].
       | 
       | So be aware of this flaw if you'll be intending to use
       | _MediaRecorder_ to actually store your videos into file (which
       | seems quite reasonable that anyone would do)
       | 
       | [1] https://bugs.chromium.org/p/chromium/issues/detail?id=642012
       | 
       | [2] https://trac.ffmpeg.org/ticket/6386
       | 
       | [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1283464
       | 
       | [4] https://github.com/w3c/mediacapture-record/issues/119
        
         | Daemon404 wrote:
         | Pretty much everyone (including my $dayjob) seems to do some
         | webm parsing, rewiting, and/or remuxing in JS, or on the
         | backend post-record. There are half a dozen ad hoc webm parsers
         | floating around GitHub for this reason, and a few more minimal
         | WebM or ISOBMFF muxers.
         | 
         | And half the tools don't work on Safari, which makes ISOBMFF in
         | their MediaRecorder implementation.
         | 
         | It really seems to me, as a user (not invloved in the
         | standards) like it was some intenal Chrome functionality that
         | got an API slapped on top and made into a spec. Nothing seems
         | well designed, or... designed at all, tbh.
         | 
         | (Can you tell I've had to work with MediaRecorder? When I read
         | 'The skater punk's guide to MediaRecorder' I thought it would
         | be one sentence: 'Put it in the trash.')
         | 
         | Apologies for the salt.
        
           | Mulpze15 wrote:
           | So funny to read this for me. I made a pretty good living for
           | myself leveraging MediaRecorder. And "pretty good" is an
           | understatement.
           | 
           | Someone's garbage is someone'else gold....
        
       ___________________________________________________________________
       (page generated 2022-04-12 23:01 UTC)