No. FFmpeg can only copy bitstreams or re-encode. It can't guess if you want to keep a certain codec. You'll have to parse the file info and then decide whether you want to copy or not.
Some examples of how to do that are listed here: MKV to MP4 transcoding script issues
Basically, you could do this (shameless plug from @evilsoup there):
ffprobe input.mkv 2>&1 | sed -n '/Video:/s/.*: \([a-zA-Z0-9]*\).*/\1/p' | sed 1q'
This would output h264
for an H.264 video stream.
Minor tip: Try getting used to specifying the exact encoder you want. h264
isn't really an encoder for FFmpeg – it defaults to libx264
. So rather use -c:v libx264
.
One more thing: aac
is the built-in AAC encoder from FFmpeg. Third party encoders like libfdk_aac
or libfaac
offer a VBR encoding mode and generally better quality than aac
.