[object Object] Icon

Encoding
Learn how to create, start, manage and modify Encodings

[object Object] Icon

Player
Learn how to create, start, manage and modify Players

[object Object] Icon

Analytics
Learn how to create, start, manage and modify Analyticss

Docs Home
User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Mon Aug 27 2018

How do I configure an codec configuration to maintain aspect ratio of the original video?

You can create an codec configuration, that will keep the aspect ratio of the original video by just omitting either the width or the height when you create it. This tells our service to maintain the aspect ratio of your input file, and will calculate the omitted value based on that.

In the following an example for an encoding profile that will keep aspect ratio:

1$name = "1080p";
2$profile = H264Profile::HIGH;
3$bitrate = 4800000;
4$frameRate = 30;
5$width = 1920;
6$codecConfigVideo = new H264VideoCodecConfiguration($name, $profile, $bitrate, $frameRate);
7$codecConfigVideo->setWidth($width);
8$apiClient->codecConfigurations()->videoH264()->create($codecConfigVideo);

or

1$name = "1080p";
2$profile = H264Profile::HIGH;
3$bitrate = 4800000;
4$frameRate = 30;
5$height = 1080;
6$codecConfigVideo = new H264VideoCodecConfiguration($name, $profile, $bitrate, $frameRate);
7$codecConfigVideo->setHeight($height);
8$apiClient->codecConfigurations()->videoH264()->create($codecConfigVideo);

Give us feedback