我正在尝试使用ElasticTranscoderPHP用php创建一个新的预设,但我收到的错误是“找不到预期的列表的开头”
https://github.com/LPology/ElasticTranscoderPHP
什么会导致此错误?
$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: ';
}
答案 0 :(得分:1)
回答我自己的问题 - 希望它有助于其他人......
我最终通过将音频,视频和拇指设置分离到各自的阵列来解决了这个问题。这是一个例子:
//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;
}