💾 Archived View for perso.pw › blog › articles › ffmpeg-separation-merge.gmi captured on 2023-04-26 at 13:49:57. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
NIL=> https://bsd.network/@solenepercent/104224828163445631 Comment on Mastodon
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