Convert audio to aac:
ffmpeg -i [file] -c:v copy -c:a aac -c:s mov_text -ab 320K -strict -2 [file].mp4
Convert file to mp4
ffmpeg -i [file] -c copy -strict -2 [file].mp4
Batch convert mkv to mp4:
for f in *.mkv; do ffmpeg -i "$f" -c:v copy -c:a aac -c:s mov_text -ab 320K -strict -2 "${f%.mkv}.mp4"; done
Scale to 480px height (auto width) with 27 quality (1 is best), unchanged audio, starting from 24th minute and lasting for 30s:
ffmpeg -i input.mp4 -vf scale=-1:480 -crf 27 -c:a copy -ss 00:24:00 -t 00:00:30 output.mp4