本文介绍了如何根据文件名的标题合并/连接存储在AWS S3存储桶中的视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一项服务,该服务允许我记录自动被推送到S3存储桶中的文件夹(提交)的视频.有多个视频,但是它们需要组合在一起并串联在一起,因此输出是每组一个视频.

I am using a service that allows me to record videos that get automatically pushed to a folder (submissions) in an S3 bucket. There are multiple videos however they need to be grouped together and concatenated so the output is one video per group.

那么,基本上,关于我如何根据标题拍摄视频并将它们缝合在一起的任何技巧?

So, basically, any tips on how I can take videos based on the title and stitch them together?

示例:

Submissions文件夹将具有:

Submissions folder will have:

a-100-2.mp4
a-200-6.mp4
b-123-5.mp4

已处理文件夹中的预期输出:

Expected output in processed folder:

a.mp4     - (both 'a' videos get stitched together)
b.mp4     - (only 'b' gets sent over since there is only one video.)

提前谢谢!

如果有帮助,请在下面提供一些其他详细信息.

文件将带有以下标签:{name}-{location}-{video_token}-{stream_token} .mp4

The files will be labeled with:{name}-{location}-{video_token}-{stream_token}.mp4

需要帮助创建脚本或过程,以使用以下概述的步骤将视频连接起来:

Need help creating a script or process that will concatenate the videos using the procedure outlined below:

处理规则(后端):

  1. 检查视频在提交文件夹"中是否具有相同的{video_token}.如果是这样,请保留最新的,然后删除旧的.

  1. Check if videos have same {video_token} in ‘submissions folder’. If so, keep the newest one and delete old ones.

以标题为{name}和{location}相同的"submissions folder"中的所有视频为例,并串联这些视频.将输出视频保存到标有{location}作为文件夹名称的存储桶中的新文件夹中.输出文件名:{name}-{location}-{year}.{mp4}.

Take all videos in ‘submissions folder’ with same {name} and {location} in title and concatenate the videos. Save output video to a new folder in the bucket labeled as the {location} for the folder name. Output file name: {name}-{location}-{year}.{mp4}.

示例:

提交文件夹:joey-toronto-001-354.mp4

Submissions folder:joey-toronto-001-354.mp4

joey-toronto-001-241.mp4-这将被删除

joey-toronto-001-241.mp4 - this will be deleted

joey-toronto-103-452.mp4

joey-toronto-103-452.mp4

alex-montreal-352-232.mp4

alex-montreal-352-232.mp4

alex-montreal-452-223.mp4

alex-montreal-452-223.mp4

结果输出:

多伦多文件夹:

Joey-toronto-2020.mp4

Joey-toronto-2020.mp4

蒙特利尔文件夹:

Alex-montreal-2020.mp4

Alex-montreal-2020.mp4

推荐答案

您可以使用剪辑针迹-Amazon Elastic Transcoder .

Amazon Elastic Transcoder 允许您从S3指定多个输入文件(甚至这些文件中的时间范围),并将它们输出到单个视频文件.只需提供输入源列表即可.

The Amazon Elastic Transcoder allows you to specify multiple input files from S3 (and even time ranges within those files) and output them to a single video file. It's just a matter of providing a list of input sources.

我将其用于:以您为明星的自动视频编辑!|AWS Machine Learning博客

该页面上有一些示例代码调用Elastic Transcoder:

There is some sample code on that page that calls Elastic Transcoder:

'''
The inputs array now looks like:
[
  {'Key': 'trainers.mp4', 'TimeSpan': {'StartTime': '99.8', 'Duration': '1.68'}},
  {'Key': 'trainers.mp4', 'TimeSpan': {'StartTime': '127.52', 'Duration': '4.24'}},
  ...
]
'''

# Call Amazon Elastic Transcoder to stitch together a new video
client = boto3.client('elastictranscoder', region_name = 'ap-southeast-2')

job = client.create_job(
  PipelineId = '...',
  Inputs=inputs,
  Output={'Key': person_to_find + '.mp4', 'PresetId': '...'}
)

AWS Elemental MediaConvert 也可能.

这篇关于如何根据文件名的标题合并/连接存储在AWS S3存储桶中的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 14:03