弹性转码器错误”;在不期望的地方找到列表的开头”;


Elastic Transcoder error "Start of list found where not expected"

我正试图使用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: ';
    }

回答我自己的问题-希望它能帮助别人。。。

我通过将"音频"、"视频"answers"拇指"设置分离到各自的阵列中,最终解决了这个问题。这里有一个例子:

  //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;
  }