CLI and library for running ffmpeg and output result to an S3 bucket.
ffmpeg executable must be available in path under the name ffmpeg
. When using S3 for output the AWS CLI must be installed and configured,.
Install the OSC command line tool (0.15.3+):
% npm install -g @osaas/cli
Repackage the content from HLS to a MP4 container.
% export OSC_ACCESS_TOKEN=<personal-access-token>
% osc create eyevinn-ffmpeg-s3 demo \
-o awsAccessKeyId="{{secrets.awsaccesskeyid}}" \
-o awsAccessKeyId="{{secrets.awssecretaccesskey}} \
-o cmdLineArgs='-i https://maitv-vod.lab.eyevinn.technology/VINN.mp4/master.m3u8 -d s3://lab-testcontent-output/demo/vinn.mp4 "-c:v copy -c:a copy"'
Repackage content from MP4 to a MOV container where the source is on S3 using signed URL for access.
% osc create eyevinn-ffmpeg-s3 demo \
-o awsAccessKeyId="{{secrets.awsaccesskeyid}}" \
-o awsSecretAccessKey="{{secrets.awssecretaccesskey}}" \
-o cmdLineArgs='-i https://lab-testcontent-input.s3.eu-north-1.amazonaws.com/NO_TIME_TO_DIE_short_Trailer_2021.mp4?SIGNED_URL -d s3://lab-testcontent-output/demo/trailer.mov "-c:v copy -c:a copy"'
Extract first 30 seconds of a video.
% osc create eyevinn-ffmpeg-s3 demo \
-o awsAccessKeyId="{{secrets.awsaccesskeyid}}" \
-o awsSecretAccessKey="{{secrets.awssecretaccesskey}}" \
-o cmdLineArgs='-i https://lab-testcontent-input.s3.eu-north-1.amazonaws.com/NO_TIME_TO_DIE_short_Trailer_2021.mp4?SIGNED_URL -d s3://lab-testcontent-output/demo/trailer-30sec.mov "-ss 0 -t 30 -c:v copy -c:a copy"'
% npm install -g ffmpeg-s3
Repackage the content from MP4 to a MOV container
% export AWS_ACCESS_KEY_ID=<aws-access-key-id>
% export AWS_SECRET_ACCESS_KEY=<aws-secret-access-key>
% ffmpeg-s3 -i https://lab-testcontent-input.s3.eu-north-1.amazonaws.com/NO_TIME_TO_DIE_short_Trailer_2021.mp4?SIGNED_URL -d s3://lab-testcontent-output/demo/trailer.mov "-c:v copy -c:a copy"
import { doFFmpeg } from '@eyevinn/ffmpeg-s3';
doFFMpeg({
dest: 's3://lab-testcontent-output/demo/trailer.mov',
cmdString: '-c:v copy -c:a copy',
source:
'https://lab-testcontent-input.s3.eu-north-1.amazonaws.com/NO_TIME_TO_DIE_short_Trailer_2021.mp4?SIGNED_URL'
})
.then(() => {
console.log('done and uploaded');
})
.catch((err) => {
console.error(err);
});
docker build -t ffmpeg-s3:local .
docker run --rm \
-e AWS_ACCESS_KEY_ID=<aws-access-key-id> \
-e AWS_SECRET_ACCESS_KEY=<aws-secret-access-key> \
ffmpeg-s3:local \
ffmpeg-s3 \
-i https://lab-testcontent-input.s3.eu-north-1.amazonaws.com/NO_TIME_TO_DIE_short_Trailer_2021.mp4?SIGNED_URL \
-d s3://lab-testcontent-output/demo/trailer.mov \
-- "c:v copy c:a copy"
Prerequisites:
- ffmpeg
- AWS cli
Run script locally
% npm run build
% node dist/cli.js -h
See CONTRIBUTING
This project is licensed under the MIT License, see LICENSE.
Join our community on Slack where you can post any questions regarding any of our open source projects. Eyevinn's consulting business can also offer you:
- Further development of this component
- Customization and integration of this component into your platform
- Support and maintenance agreement
Contact sales@eyevinn.se if you are interested.
Eyevinn Technology is an independent consultant firm specialized in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor. As our way to innovate and push the industry forward we develop proof-of-concepts and tools. The things we learn and the code we write we share with the industry in blogs and by open sourcing the code we have written.
Want to know more about Eyevinn and how it is to work here. Contact us at work@eyevinn.se!