When a vertical video is recorded via mobile phone and needs to be stitched with a horizontal video, the provided output has the vertical video part, rotated.
What may cause it:
$transcoderService = app('ITranscoderService');
$inputs = [
[
'Key' => $this->media->getOriginal('media_url'),
]
];
$this->prepend && array_unshift($inputs, ['Key' => $this->prepend]);
$this->append && array_push($inputs, ['Key' => $this->append]);
$outputs = [
[
"Key" => $this->getOutputFilename(),
'Rotate' => 'auto',
"PresetId" => '1653583660869-5jx367',//'1653583311105-8tip2c'//'1351620000001-000020',//$this->presetId
],
];
$transcoderJob = $transcoderService->createJob([
'PipelineId' => config('aws.elastic_transcoder.pipeline_id'),
'Inputs' => $inputs,
'OutputKeyPrefix' => $this->getFileDirectory() ,
'Outputs' => $outputs,
]);
I did found the solution after a bit of struggle with AWS Documentation. They didn't pointed that I must have to pass all input parameters even if I want default values (i.e auto), as I asume that word
auto
ordefault
should automatically considered true when value is not provided. (DATED: 20 OCT 2022).
Solution:
In addition to each input we have to explicitly tell AWS Elastic Transcoder that we want to use 'auto'
value for FrameRate
, Resolution
, AspectRatio
, Interlaced
and Container
, so that it uses these parameters from given file's meta. i.e in my case it:
$inputs = [
[
'Key' => $this->media->getOriginal('media_url'),
'FrameRate' => 'auto',
'Resolution' => 'auto',
'AspectRatio' => 'auto',
'Interlaced' => 'auto',
'Container' => 'auto'
]
];