I'm working on video machine learning and have a directory with plenty of small (1min up to 14min) *.avi files with different sizes and aspect ratios, slightly different frame rates (e.g. 25 Hz, 22 Hz, 30 Hz) and sometimes (unnecessary) audio. I want to equalize them so that I can quickly read the frames as training data without further preprocessing.
For the problem we are working on it is most important that temporal accuracy is preserved, i.e. the converted video must have the same duration and content must appear at the same time as in the original video. As we are doing action recognition we can not tolerate speed changes.
As we have to shrink the videos to 224x224 it should not be a problem if small visual artefacts are introduced.
In short, I want to:
vertically scale to 224px
center-crop to 224px (it is common to use square input)
change frame rate to 23 Hz
strip audio to save some space
I came up with this:
ffmpeg -i input_video.avi -filter:v scale=-1:224 crop=224:in_h:exact=1:keep_aspect=1 -r 23 -an output_video.avi
Is this the current best / recommended option for the quality target (temporal accuracy with minor visual artefacts)?
Can I avoid transcoding here at all?
I've read quite some older SE posts on
ffmpeg but the number of options (and apparent differences across versions) confuses me.