22 January 2019
almost 6 years ago by Encoding.com Product Team #2
Auto Crop
Detect and remove video letterbox.
<?xml version="1.0"?>
<query>
<userid><<id>></userid> <!-- required-->
<userkey><<key>></userkey> <!-- required-->
<action>[Action]</action> <!-- required-->
<format>
<auto_crop>
<enable>[yes|no]</enable>
<crop_type>[CropType]</crop_type>
<limit>[Detection]</limit>
<round>[CropRound]</round>
</auto_crop>
</format>
</query>
{
"query": {
"userid": "<<id>>",
"userkey": "<<key>>",
"action": "[Action]",
"format": {
"auto_crop": {
"enable": "[yes|no]",
"crop_type": "[CropType]",
"limit": "[Detection]",
"round": "[CropRound]"
}
}
}
}
Parameter | Description | Allowed Values | Default |
---|---|---|---|
enable | Enable auto-cropping. | yes, no | no |
crop_type | Specify cropping type. | resize - crop letterbox, then crop to keep width/height ratio then re-scaling to fit output size. stretch - crop letterbox, then re-scaling without saving of width/heigth ratio to fit output size crop - only letterbox cropping | resize |
limit | Higher black value threshold. | Positive integer number from 0 to 128. Value greater than 128 will be changed to 128. 0 – Pixel must be absolutely black to be classified as black. 128 – The lightest pixels would be classified as black. | 24 |
round | The value which the width/height should be divisible by. | Positive integer number. | 16 |
Note for crop_type
If <crop_type /> set to crop and specified for output then video will be re-scaled like if <crop_type /> set to stretch.
Note
Auto cropping will be ignored if <crop_* /> parameters are specified.
Consistent Arrays in JSON response
Request:
{
"query": {
"userid": "<<id>>",
"userkey": "<<key>>",
"action": "GetMediaInfoEx",
"mediaid": "[MediaID]",
"consistentarrays": "[1|0]"
}
}
Note for JSON request
If MediaInfo contains only one track, by default track parameter in response will be object. To keep it as array add
"consistentarrays": "1"
parameter to request.
Parameter | Description | Allowed Values | Default |
---|---|---|---|
consistentarrays | Make arrays consistent in response | 1, 0 | 0 |
Response:
{
"response": {
"Mediainfo": {
"File": {
"track": [
{
"@attributes": {"type": "[TrackType]"}
},
{
"@attributes": {"type": "[TrackType]"}
},
]
}
}
}
}
Changelog
- added: auto_crop parameters
- added: consistentarrays parameter for JSON requests