• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java AbstractMP4DemuxerTrack类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.jcodec.containers.mp4.demuxer.AbstractMP4DemuxerTrack的典型用法代码示例。如果您正苦于以下问题:Java AbstractMP4DemuxerTrack类的具体用法?Java AbstractMP4DemuxerTrack怎么用?Java AbstractMP4DemuxerTrack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

AbstractMP4DemuxerTrack类属于org.jcodec.containers.mp4.demuxer包,在下文中一共展示了AbstractMP4DemuxerTrack类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: detectDecoder

点赞 2

import org.jcodec.containers.mp4.demuxer.AbstractMP4DemuxerTrack; //导入依赖的package包/类
private ContainerAdaptor detectDecoder(SeekableDemuxerTrack videoTrack, Packet frame) throws JCodecException {
     if (videoTrack instanceof AbstractMP4DemuxerTrack) {
         SampleEntry se = ((AbstractMP4DemuxerTrack) videoTrack).getSampleEntries()[((MP4Packet) frame).getEntryNo()];
         VideoDecoder byFourcc = byFourcc(se.getHeader().getFourcc());
         if (byFourcc instanceof H264Decoder) {
	return new AVCMP4Adaptor(((AbstractMP4DemuxerTrack) videoTrack).getSampleEntries());
}
     }

     throw new UnsupportedFormatException("Codec is not supported");
 }
 

开发者ID:vitrivr,
项目名称:cineast,
代码行数:12,
代码来源:JcodecFrameGrab.java

示例2: detectDecoder

点赞 2

import org.jcodec.containers.mp4.demuxer.AbstractMP4DemuxerTrack; //导入依赖的package包/类
private ContainerAdaptor detectDecoder(SeekableDemuxerTrack videoTrack, Packet frame) throws JCodecException {
	if (videoTrack instanceof AbstractMP4DemuxerTrack) {
		SampleEntry se = ((AbstractMP4DemuxerTrack) videoTrack).getSampleEntries()[((MP4Packet) frame).getEntryNo()];
		VideoDecoder byFourcc = videoDecoder(se.getHeader().getFourcc());
		if (byFourcc instanceof H264Decoder)
			return new AVCMP4Adaptor(((AbstractMP4DemuxerTrack) videoTrack).getSampleEntries());
	}
	throw new UnsupportedFormatException("Codec is not supported");
}
 

开发者ID:arisona,
项目名称:ether,
代码行数:10,
代码来源:FrameGrab.java

示例3: detectDecoder

点赞 2

import org.jcodec.containers.mp4.demuxer.AbstractMP4DemuxerTrack; //导入依赖的package包/类
private ContainerAdaptor detectDecoder(SeekableDemuxerTrack videoTrack, Packet frame) throws JCodecException {
    if (videoTrack instanceof AbstractMP4DemuxerTrack) {
        SampleEntry se = ((AbstractMP4DemuxerTrack) videoTrack).getSampleEntries()[((MP4Packet) frame).getEntryNo()];
        VideoDecoder byFourcc = byFourcc(se.getHeader().getFourcc());
        if (byFourcc instanceof H264Decoder)
            return new AVCMP4Adaptor(((AbstractMP4DemuxerTrack) videoTrack).getSampleEntries());
    }

    throw new UnsupportedFormatException("Codec is not supported");
}
 

开发者ID:PenoaksDev,
项目名称:OpenSpaceDVR,
代码行数:11,
代码来源:FrameGrab.java

示例4: copyEdits

点赞 2

import org.jcodec.containers.mp4.demuxer.AbstractMP4DemuxerTrack; //导入依赖的package包/类
private void copyEdits(AbstractMP4DemuxerTrack from, AbstractMP4MuxerTrack two, Rational tsRatio) {
    List<Edit> edits = from.getEdits(), result = new ArrayList<Edit>();
    if(edits == null)
        return;
    for (Edit edit : edits) {
        result.add(new Edit(tsRatio.multiply(edit.getDuration()), edit.getMediaTime(), edit.getRate()));
    }

    two.setEdits(result);
}
 

开发者ID:PenoaksDev,
项目名称:OpenSpaceDVR,
代码行数:11,
代码来源:Remux.java

示例5: AVCMP4Adaptor

点赞 2

import org.jcodec.containers.mp4.demuxer.AbstractMP4DemuxerTrack; //导入依赖的package包/类
public AVCMP4Adaptor(AbstractMP4DemuxerTrack vt) {
    this(((AbstractMP4DemuxerTrack) vt).getSampleEntries());
}
 

开发者ID:PenoaksDev,
项目名称:OpenSpaceDVR,
代码行数:4,
代码来源:AVCMP4Adaptor.java

示例6: remux

点赞 2

import org.jcodec.containers.mp4.demuxer.AbstractMP4DemuxerTrack; //导入依赖的package包/类
public void remux(File tgt, File src, File timecode, Handler handler) throws IOException {
    SeekableByteChannel input = null;
    SeekableByteChannel output = null;
    SeekableByteChannel tci = null;
    try {
        input = readableFileChannel(src);
        output = writableFileChannel(tgt);
        MP4Demuxer demuxer = new MP4Demuxer(input);

        
        TimecodeMP4DemuxerTrack tt = null;
        if (timecode != null) {
            tci = readableFileChannel(src);
            MP4Demuxer tcd = new MP4Demuxer(tci);
            tt = tcd.getTimecodeTrack();
        }

        MP4Muxer muxer = WebOptimizedMP4Muxer.withOldHeader(output, Brand.MOV, demuxer.getMovie());

        List<AbstractMP4DemuxerTrack> at = demuxer.getAudioTracks();
        List<PCMMP4MuxerTrack> audioTracks = new ArrayList<PCMMP4MuxerTrack>();
        for (AbstractMP4DemuxerTrack demuxerTrack : at) {
            PCMMP4MuxerTrack att = muxer.addPCMAudioTrack(((AudioSampleEntry) demuxerTrack
                    .getSampleEntries()[0]).getFormat());
            audioTracks.add(att);
            att.setEdits(demuxerTrack.getEdits());
            att.setName(demuxerTrack.getName());
        }

        AbstractMP4DemuxerTrack vt = demuxer.getVideoTrack();
        FramesMP4MuxerTrack video = muxer.addTrack(VIDEO, (int) vt.getTimescale());
        // vt.open(input);
        video.setTimecode(muxer.addTimecodeTrack((int) vt.getTimescale()));
        copyEdits(vt, video, new Rational((int)vt.getTimescale(), demuxer.getMovie().getTimescale()));
        video.addSampleEntries(vt.getSampleEntries());
        MP4Packet pkt = null;
        while ((pkt = (MP4Packet)vt.nextFrame()) != null) {
            if (tt != null)
                pkt = tt.getTimecode(pkt);
            pkt = processFrame(pkt);
            video.addFrame(pkt);

            for (int i = 0; i < at.size(); i++) {
                AudioSampleEntry ase = (AudioSampleEntry) at.get(i).getSampleEntries()[0];
                int frames = (int) (ase.getSampleRate() * pkt.getDuration() / vt.getTimescale());
                MP4Packet apkt = (MP4Packet)at.get(i).nextFrame();
                audioTracks.get(i).addSamples(apkt.getData());
            }
        }

        MovieBox movie = muxer.finalizeHeader();
        if (handler != null)
            handler.handle(movie);
        muxer.storeHeader(movie);

    } finally {
        NIOUtils.closeQuietly(input);
        NIOUtils.closeQuietly(output);
        NIOUtils.closeQuietly(tci);
    }
}
 

开发者ID:PenoaksDev,
项目名称:OpenSpaceDVR,
代码行数:62,
代码来源:Remux.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)