Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lukehoban committed Mar 20, 2018
1 parent b3ba626 commit e55ef4a
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 1,612 deletions.
2 changes: 1 addition & 1 deletion video-thumbnailer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/node_modules/
/yarn.lock
/package-lock.json
/Pulumi.*.yaml
/Pulumi.*.yaml
2 changes: 1 addition & 1 deletion video-thumbnailer/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: video-thumbnailer
runtime: nodejs
description: A video thumbnail extractor using serverless functions + containers.
description: A video thumbnail extractor using serverless functions and containers.
1,604 changes: 4 additions & 1,600 deletions video-thumbnailer/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion video-thumbnailer/docker-ffmpeg-thumb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ COPY copy_video.sh /tmp/workdir
ENTRYPOINT echo "Starting..." && \
./copy_video.sh && \
ffmpeg -i ./${INPUT_VIDEO_FILE_NAME} -ss ${POSITION_TIME_DURATION} -vframes 1 -vcodec png -an -y ${OUTPUT_THUMBS_FILE_NAME} && \
./copy_thumb.sh
./copy_thumb.sh
2 changes: 1 addition & 1 deletion video-thumbnailer/docker-ffmpeg-thumb/copy_thumb.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

echo "Copying ${OUTPUT_THUMBS_FILE_NAME} to S3 at ${S3_BUCKET}/${OUTPUT_THUMBS_FILE_NAME} ..."
aws s3 cp ./${OUTPUT_THUMBS_FILE_NAME} s3:https://${S3_BUCKET}/${OUTPUT_THUMBS_FILE_NAME}
aws s3 cp ./${OUTPUT_THUMBS_FILE_NAME} s3:https://${S3_BUCKET}/${OUTPUT_THUMBS_FILE_NAME}
2 changes: 1 addition & 1 deletion video-thumbnailer/docker-ffmpeg-thumb/copy_video.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

echo "Copying from S3 ${S3_BUCKET}/${INPUT_VIDEO_FILE_NAME} to ${INPUT_VIDEO_FILE_NAME} ..."
aws s3 cp s3:https://${S3_BUCKET}/${INPUT_VIDEO_FILE_NAME} ./${INPUT_VIDEO_FILE_NAME}
aws s3 cp s3:https://${S3_BUCKET}/${INPUT_VIDEO_FILE_NAME} ./${INPUT_VIDEO_FILE_NAME}
16 changes: 9 additions & 7 deletions video-thumbnailer/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
let cloud = require("@pulumi/cloud-aws");
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.

const cloud = require("@pulumi/cloud-aws");

// A task which runs a containerized FFMPEG job to extract a thumbnail image.
let ffmpegThumbnailTask = new cloud.Task("ffmpegThumbTask", {
const ffmpegThumbnailTask = new cloud.Task("ffmpegThumbTask", {
build: "./docker-ffmpeg-thumb",
memoryReservation: 128,
});

// A bucket to store videos and thumbnails.
let bucket = new cloud.Bucket("bucket");
let bucketName = bucket.bucket.id;
const bucket = new cloud.Bucket("bucket");
const bucketName = bucket.bucket.id;

// When a new video is uploaded, run the FFMPEG job on the video file.
bucket.onPut("onNewVideo", bucketArgs => {
console.log(`A new ${bucketArgs.size}B video was uploaded to ${bucketArgs.key} at ${bucketArgs.eventTime}.`);
let key = bucketArgs.key;
let thumbnailFile = key.substring(0, key.indexOf('_')) + '.png';
let framePos = key.substring(key.indexOf('_')+1, key.indexOf('.')).replace('-',':');
const key = bucketArgs.key;
const thumbnailFile = key.substring(0, key.indexOf('_')) + '.png';
const framePos = key.substring(key.indexOf('_')+1, key.indexOf('.')).replace('-',':');
return ffmpegThumbnailTask.run({
environment: {
"S3_BUCKET": bucketName.get(),
Expand Down

0 comments on commit e55ef4a

Please sign in to comment.