酷徒LOGO

mux.js, 用于检测和操作视频容器格式的轻量实用程序


  • 源代码名称:mux.js
  • 源代码网址:http://www.github.com/videojs/mux.js
  • mux.js源代码文档
  • mux.js源代码下载
  • Git URL:
    git://www.github.com/videojs/mux.js.git
    Git Clone代码到本地:
    git clone http://www.github.com/videojs/mux.js
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/videojs/mux.js
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    mux.js

    用于检查和操作视频容器格式的轻量工具。

    首席维护者:Jon-Carlos Rivera

    MPEG2-TS到fMP4 Transmuxer

    Uint8Array s的MPEG-2传输流中,取出MP4:

    // create a transmuxer:var transmuxer =newmuxjs.mp4.Transmuxer(initOptions);// data events signal a new fMP4 segment is ready:transmuxer.on('data', function (segment) {
     // Tada! Now you have an MP4 that you could use with Media Source ExtensionssourceBuffer.appendBuffer(segment.data.buffer);
    });

    元数据

    transmuxer还可以解析出补充视频数据,如timed ID3元数据和CEA-608标题,

    transmuxer.on('data', function (segment) {
     // create a metadata text track cue for each ID3 frame:segment.metadata.frames.forEach(function(frame) {
     metadataTextTrack.addCue(newVTTCue(time, time, frame.value));
     });
     // create a VTTCue for all the parsed CEA-608 captions:segment.captions.forEach(function(cue) {
     captionTextTrack.addCue(newVTTCue(cue.startTime, cue.endTime, cue.text));
     });
    });

    MP4检查器

    将MP4s解析为javascript对象或用于显示或调试的文本表示形式:

    // drop in a Uint8Array of an MP4:var parsed =muxjs.mp4.tools.inspect(bytes);// dig into the boxes:console.log('The major brand of the first box:', parsed[0].majorBrand);// print out the structure of the MP4:document.body.appendChild(document.createTextNode(muxjs.textifyMp4(parsed)));

    构建

    如果在类似node的环境中使用这个项目,只需require(),如果要打包分发包,请运行npm run build





    Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备17041772号-2  |  如果智培  |  酷兔英语  |  帮酷