I am writing a script that takes videofiles such as MKV or AVI and changes them to MP4, and then prepares them from web streaming. I want my output to use H.264 and AAC codecs.
So far my command looks like this:
ffmpeg -i input.mkv -vcodec h264 -acodec aac -ab 128k -ac 2 -strict -2 output.mp4
However, when the codec already is h.264 it still muxes it, it says: (h264 -> libx264).
If I replace '-vcodec h264' with '-vcodec copy' it goes a lot faster when the codec is H.264 but of course won't change the codec if there is a different codec in the input file.
Is there a way for FFmpeg to recognize that the codec is almost the same, and thus not muxing the videostream, but still changing video codec if the source isn't H.264?