public VirtualTrackInfo(SequenceType seqType, StreamType stream) { this.seqType = seqType; // audio addParameter(ResourceContextParameters.CHANNELS_NUM, stream.getChannels()); addParameter(ResourceContextParameters.SAMPLE_RATE, stream.getSampleRate()); addParameter(ResourceContextParameters.BITS_PER_SAMPLE, stream.getBitsPerSample()); // video addParameter(ResourceContextParameters.WIDTH, stream.getWidth()); addParameter(ResourceContextParameters.HEIGHT, stream.getHeight()); addParameter(ResourceContextParameters.BIT_DEPTH, stream.getBitsPerRawSample()); addParameter(ResourceContextParameters.PIXEL_FORMAT, stream.getPixFmt()); String rFrameRate = stream.getRFrameRate(); if (rFrameRate != null) { addParameter(ResourceContextParameters.FRAME_RATE, ConversionHelper.rFrameRateToEditRate(rFrameRate)); } }
private void validateSequenceHomogeneous(VirtualTrackInfo prevVirtualTrackInfo, VirtualTrackInfo nextVirtualTrackInfo) { if (prevVirtualTrackInfo == null) { return; } if (nextVirtualTrackInfo == null) { return; } if (!Objects.equals( prevVirtualTrackInfo.getParameters().get(ResourceContextParameters.CHANNELS_NUM), nextVirtualTrackInfo.getParameters().get(ResourceContextParameters.CHANNELS_NUM))) { throw new ConversionException( "All audio resource tracks within an audio sequence (virtual track) must have the same number of channels!"); } if (!Objects.equals( prevVirtualTrackInfo.getParameters().get(ResourceContextParameters.FRAME_RATE), nextVirtualTrackInfo.getParameters().get(ResourceContextParameters.FRAME_RATE))) { throw new ConversionException( "All video resource tracks within an video sequence (virtual track) must have the same fps!"); } }
private VirtualTrackInfo getTrackInfo(File outputFile, ContextInfo contextInfo, String essence) throws XmlParsingException, MediaInfoException, FileNotFoundException { // 1. parse output xml FfprobeType mediaInfo = parseOutputFile(outputFile, contextInfo); // 2. check that info is available if (mediaInfo.getStreams() == null || mediaInfo.getStreams().getStream().isEmpty()) { throw new MediaInfoException("No streams output", essence); } StreamType stream = mediaInfo.getStreams().getStream().get(0); // 3. fill info return new VirtualTrackInfo(contextInfo.getSequenceType(), stream); }
private void buildResourceContext(VirtualTrackInfo virtualTrackInfo, ContextInfo contextInfo) { virtualTrackInfo.getParameters().forEach( (paramName, paramValue) -> contextProvider.getResourceContext().addResourceParameter( ResourceKey.create(contextInfo), contextInfo.getResourceUuid(), paramName, paramValue)); }
if (prevVirtualTrack.getParameters().containsKey(ResourceContextParameters.CHANNELS_NUM)) { sequenceContext.addSequenceParameter( seqType, seqUuid, SequenceContextParameters.CHANNELS_NUM, prevVirtualTrack.getParameters().get(ResourceContextParameters.CHANNELS_NUM)); if (seqType == SequenceType.VIDEO && prevVirtualTrack.getParameters().containsKey(ResourceContextParameters.FRAME_RATE)) { BigFraction frameRate = ConversionHelper.parseEditRate(prevVirtualTrack.getParameters() .get(ResourceContextParameters.FRAME_RATE)); sequenceContext.addSequenceParameter(