Programatic cropping of transcoded stream

Hi,

I would like to be able to apply a crop to the output of the transcoder. i.e. we define a region of the video and the output is only that region, the height and width of the video would change according to the dimensions of the crop.

The resize only has to happen once (we know what the target dimensions will be), so, if it is not possible crop and resize, is it possible to just crop a region of the video and have it placed in the resized output, without scaling?

So far, we have tried using the SetCrop, SetDstRect, SetSrcRect. We have not had any luck affecting changes in real-time.

Thanks!

adam.

Hello Adam

You can look at the ILiveStreamTranscoderActionNotify interface and leverage the setCrop function similar to the following:

// event handler in ILiveStreamTranscoderActionNotify
 public void onInitAfterLoadTemplate(LiveStreamTranscoder liveStreamTranscoder) { 
       TranscoderStreamDestination streamDest = ... reference to your destination ...;
   		 
		int[] cropDef = new int[4];
		cropDef[0] = 10;
		cropDef[1] = 20;
		cropDef[2] = 20;
		cropDef[3] = 10;
	 streamDest.getVideo().setCrop(cropDef);
 }

Thanks,

Matt

Hi @Matt Young,

Can setCrop() be called any time? Such as from onBeforeEncode or onBeforeScale()?

Thanks,

Jeff