extract_metadata.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:mu 作者: excamera 项目源码 文件源码
def lambda_handler(self, event, context):
      # Loop through records provided by S3 Event trigger
      self.logger.info("Working on bucket-key in S3...")
      # Extract the Key and Bucket names for the asset uploaded to S3
      key = event['key']
      bucket = event['bucket']
      self.logger.info("Bucket: {} \t Key: {}".format(bucket, key))
      # Generate a signed URL for the uploaded asset
      signed_url = self.get_signed_url(self.SIGNED_URL_EXPIRATION, bucket, key)
      self.logger.info("Signed URL: {}".format(signed_url))
      # Launch MediaInfo
      # Pass the signed URL of the uploaded asset to MediaInfo as an input
      # MediaInfo will extract the technical metadata from the asset
      # The extracted metadata will be outputted in XML format and
      # stored in the variable xml_output
      xml_output = subprocess.check_output(["mediainfo", "--full", "--output=XML", signed_url])
      self.logger.info("Output: {}".format(xml_output))
      xml_json = xmltodict.parse(xml_output)
      return self.write_job_spec_to_file(xml_json, bucket, key)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号