💾 Archived View for perso.pw › blog › articles › ffmpeg-separation-merge.gmi captured on 2023-07-22 at 16:41:12. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-05-24)
-=-=-=-=-=-=-
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
Short explanation:
- `-vn` means `-video null` and so you discard video
- `-an` means `-audio null` and so you discard audio
- `codec copy` means 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.
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