Reputation: 873
I am trying to use ElasticTranscoderPHP to create a new preset with php, but I am getting the error "start of list found where not expected"
https://github.com/LPology/ElasticTranscoderPHP
What would cause this error?
$photo_info = getimagesize($_FILES["photo-file"]['tmp_name']);
$photo_width = $photo_info[0];
$photo_height = $photo_info[1];
$options = array(
"Name" => $vivaloo_id,
"Description" => "testing 123",
"Container" => "mp4",
"Audio" => array(
"Codec" => "AAC",
"CodecOptions" => array(
"Profile" => "AAC-LC"
),
"SampleRate" => "44100",
"BitRate" => "128",
"Channels" => "2",
),
"Video" => array(
"Codec" => "H.264",
"CodecOptions" => array(
"Profile" => "baseline",
"Level" => "3",
"MaxReferenceFrames" => "3"
),
"KeyframesMaxDist" => "90",
"FixedGOP" => "false",
"BitRate" => "600",
"FrameRate" => "29.97",
"MaxWidth" => $photo_width,
"MaxHeight" => $photo_height,
"SizingPolicy" => "Fill",
"PaddingPolicy" => "NoPad",
"DisplayAspectRatio" => "auto"
),
"Thumbnails" => array(
"Format" => "jpg",
"Interval" => "9999",
"MaxWidth" => "480",
"MaxHeight" => "480",
"SizingPolicy" => "Fit",
"PaddingPolicy" => "NoPad"
)
);
$presetResult = AWS_ET::createPreset( array($options) );
if (!$presetResult) {
echo AWS_ET::getErrorMsg();
}else{
echo 'New preset ID: ';
}
Upvotes: 0
Views: 715
Reputation: 873
Answering my own question - hope it helps others...
I ultimately solved this issue by separating Audio, Video, and Thumbs settings into their own individual arrays. Here is an example:
//create a preset
$presetAudio = array(
"Codec" => "AAC",
"CodecOptions" => array( "Profile" => "AAC-LC"),
"SampleRate" => "32000",
"BitRate" => "64",
"Channels" => "2"
);
$presetVideo = array(
"Codec" => "H.264",
"CodecOptions" => array("Profile" => "baseline","Level" => "3","MaxReferenceFrames" => "3","BufferSize" => null, "MaxBitRate" => null),
"KeyframesMaxDist" => "90",
"FixedGOP" => "false",
"BitRate" => "500",
"FrameRate" => "29.97",
"MaxFrameRate" => null,
"MaxWidth" => "500", //note: MUST BE AN EVEN NUMBER
"MaxHeight" => "500", //note: MUST BE AN EVEN NUMBER
"SizingPolicy" => "Fill",
"PaddingPolicy" => "NoPad",
"DisplayAspectRatio" => "auto"
);
$presetThumbs = array(
"Format" => "jpg",
"Interval" => "9999",
"MaxWidth" => "100", //note: MUST BE AN EVEN NUMBER
"MaxHeight" => "100", //note: MUST BE AN EVEN NUMBER
"SizingPolicy" => "Fit",
"PaddingPolicy" => "NoPad"
);
$presetResult = AWS_ET::createPreset("name of preset", "description of preset", "mp4", $presetAudio, $presetVideo, $presetThumbs);
if (!$presetResult) {
echo AWS_ET::getErrorMsg();
} else {
$preset_id = $presetResult['Preset']['Id'];
echo $preset_id;
}
Upvotes: 1