Coder Social home page Coder Social logo

Comments (5)

xqq avatar xqq commented on May 18, 2024

请提供具体的控制台logcat

from flv.js.

meowmiaomiaomiao avatar meowmiaomiaomiao commented on May 18, 2024

作者大人你好!控制台是没有报错的 我这里是是这么使用的
先用reader.readAsArrayBuffer()去读取一个flv
然后用下面两个模块
import FLVDemuxer from './demux/flv-demuxer.js';
import MP4Remuxer from './remux/mp4-remuxer.js';
const demuxer = new FLVDemuxer(arrayBuffer);
const remuxer = new MP4Remuxer();
remuxer.bindDataSource(demuxer);
remuxer.onMediaSegment = (type, mediaSegment) => {
const blob = new Blob(new Uint8Array(mediaSegment.data))
const video = document.querySelector('video');
video.src = URL.createObjectURL(blob,{ type: "video/mp4" });
}
demuxer.parseChunks(arrayBuffer, 0);
这样是否正确?
mediaSegment.data里数据看起来都正常,我怀疑是我用第三方软件去转FLV的问题B站的FLV是怎么处理的呢?

from flv.js.

xqq avatar xqq commented on May 18, 2024

这是什么鬼?
请仔细阅读 flv.js 代码。

from flv.js.

meowmiaomiaomiao avatar meowmiaomiaomiao commented on May 18, 2024

是这样,因为我以前没接触过视频类的工作,所以一开始以为这个开源代码是可以接收任意h264格式的flv的
于是我用HTML5的FileReader去读了本地的一个flv
然后用FLVDemuxer MP4Remuxer 这两个模块去换了封装生成了一个blob丢进了video了
控制台上提示
[FLVDemuxer] > Parsed onMetaData
[FLVDemuxer] > Parsed AVCDecoderConfigurationRecord
这两行,但是并不可以播放

现在我把我的flv用B站官网提供的压制工具又压了一遍,可以正常运行了
控制台提示出了下面的三行
[FLVDemuxer] > Parsed onMetaData
[FLVDemuxer] > Parsed AVCDecoderConfigurationRecord
[FLVDemuxer] > Parsed AudioSpecificConfig

我的flv是没有声音的,所以我怀疑代码处理声音的部分可能有些小BUG吧,这里我也不太懂...
现在换了压制工具就正常了,看你的代码学到很多关于视频的知识 感谢:)

from flv.js.

xqq avatar xqq commented on May 18, 2024

生成的每个 Segment 不是让你丢给 video 标签直接播的。参阅 Media Source Extensions

from flv.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.