Need to check video resolution before transcoding video file

850 Views Asked by At

I am converting video files using an elastic transcoder. AWS Lambda function get video file from s3 bucket and convert it according to PresetId.

But, I need to compare video file resolution with PresetId. If the video file resolution is higher than the PresetId video resolution, then convert this video file, otherwise do not need to convert all video files.

1

There are 1 best solutions below

1
On BEST ANSWER

Do you have access to ffmpeg/ffprobe/ffplay from AWS - is it possible to call them and take their console output? I'm not sure about what's allowed in AWS, but on Desktop you could call ffprobe etc. - it could return text or even JSON. Many ways are suggested here: Getting video dimension / resolution / width x height from ffmpeg

One of the suggested ways:

ffprobe -v error -show_entries stream=width,height -of csv=p=0:s=x input.m4v
1280x720