Here we use ffmpeg command, which can be installed on Ubuntu / Debian using apt-get install ffmpeg.
Next commands can be combined into one, though I prefer to keep each part separate.
- Convert video (
mp4withaacaudio) to audio.
ffmpeg -i video.mp4 -vn -acodec copy video.aac