Extract audio and video (separation)
If for some reasons you want to separate the audio and the video from a file you can use those commands:
ffmpeg -i input_file.flv -vn -acodec copy audio.aac
ffmpeg -i input_file.flv -an -vcodec copy video.mp4
-video nulland so you discard video
-audio nulland so you discard audio
codec copymeans the output is using original format from the file. If the audio is mp3 then the output file will be a mp3 whatever the extension you choose.
Instead of using codec copy you can choose a different codec for the extracted file, but copy is a good choice, it performs really fast because you don’t need to re-encode it and is loss-less.
I use this to rework the audio with audacity.
Merge audio and video into a single file (merge)
After you reworked tracks (audio and/or video) of your file, you can combine them into a single file.
ffmpeg -i input_audio.aac -i input_video.mp4 -acodec copy -vcodec copy -f flv merged_video.flv