Back in the Day: Static Line Jump

Perhaps this is more suited for throwback Thursday, but I came across this old video from college and thought I'd put it on the blog while I was thinking about it. Of course, I had to use that as an excuse to write a Jenkins job to upload videos to s3 (incorporating what I learned from posting the duet by Kenton and Duane). It's Tuesday so at least #TBT still works :P

I used aproxacs/s3sync to upload to S3. To make everything readable by the public by default in the video bucket, I used an example from amazon.com: Granting Read-Only Permission to an Anonymous User.

It was pretty straight forward - the only hiccup was that s3sync doesn't want to upload individual files - I had to create a directory and then call s3sync like:

s3sync ./${SYNC_DIR}/ nathangraham.info.videos:


Here's Jenkins build step (shell command) - UPLOADED_FILE and PREVIEW_FILE are file parameters.

# Can't get s3sync to work without copying directory contents!
SYNC_DIR=upload

mkdir -p ${SYNC_DIR}

mv UPLOADED_FILE ${SYNC_DIR}/${UPLOADED_FILE}
mv PREVIEW_FILE ${SYNC_DIR}/${PREVIEW_FILE}

NEW_FILE_NAME=${UPLOADED_FILE}.mp4
ffmpeg -i ${SYNC_DIR}/${UPLOADED_FILE} -c:a libfdk_aac -c:v h264 -preset medium -crf 25 ${SYNC_DIR}/${NEW_FILE_NAME}

s3sync ./${SYNC_DIR}/ nathangraham.info.videos:

cat << EOF > URLs.txt
URLS for setting up JWPlayer for your account:
https://s3.amazonaws.com/nathangraham.info.videos/${UPLOADED_FILE}
https://s3.amazonaws.com/nathangraham.info.videos/${PREVIEW_FILE}
EOF

Comments

Comments powered by Disqus