use of com.amazonaws.kinesisvideo.common.exception.KinesisVideoException in project amazon-kinesis-video-streams-parser-library by aws.
the class H264FrameProcessor method initializeKinesisVideoProducer.
private void initializeKinesisVideoProducer(final int width, final int height, final byte[] cpd) {
try {
log.info("Initializing KVS Producer with stream name {} and region : {}", outputKvsStreamName, regionName);
final KinesisVideoClient kinesisVideoClient = KinesisVideoJavaClientFactory.createKinesisVideoClient(regionName, credentialsProvider);
final CameraMediaSourceConfiguration configuration = new CameraMediaSourceConfiguration.Builder().withFrameRate(30).withRetentionPeriodInHours(1).withCameraId("/dev/video0").withIsEncoderHardwareAccelerated(false).withEncodingMimeType("video/avc").withNalAdaptationFlags(StreamInfo.NalAdaptationFlags.NAL_ADAPTATION_ANNEXB_NALS).withIsAbsoluteTimecode(true).withEncodingBitRate(200000).withHorizontalResolution(width).withVerticalResolution(height).withCodecPrivateData(cpd).build();
this.KVSMediaSource = new KVSMediaSource(ProducerStreamUtil.toStreamInfo(outputKvsStreamName, configuration));
this.KVSMediaSource.configure(configuration);
// register media source with Kinesis Video Client
kinesisVideoClient.registerMediaSource(KVSMediaSource);
} catch (final KinesisVideoException e) {
log.error("Exception while initialize KVS Producer !", e);
}
}
Aggregations