org.jcodec.codecs.h264.H264Decoder Java Examples

The following examples show how to use org.jcodec.codecs.h264.H264Decoder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JcodecFrameGrab.java    From cineast with MIT License 5 votes vote down vote up
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");
 }
 
Example #2
Source File: JcodecFrameGrab.java    From cineast with MIT License 5 votes vote down vote up
private VideoDecoder byFourcc(String fourcc) {
    if (fourcc.equals("avc1")) {
        return new H264Decoder();
    } else if (fourcc.equals("m1v1") || fourcc.equals("m2v1")) {
        return new MPEGDecoder();
    } else if (fourcc.equals("apco") || fourcc.equals("apcs") || fourcc.equals("apcn") || fourcc.equals("apch")
            || fourcc.equals("ap4h")) {
        return new ProresDecoder();
    }
    return null;
}