Split audio and video into two separate files

audioencodingquicktimevideo

Is there a way (I'm thinking using QuickTime perhaps) of taking a video+audio file and splitting it into two separate files, one of just the video, and one of just the audio? I know that in Finder, there's a context menu item "Encode Selected Video Files" which lets you encode it as audio-only, but not as video-only.

Thanks!

Best Answer

ffmpeg supports demuxing without re-encoding:

ffmpeg -i input.mkv # show stream numbers and formats
ffmpeg -i input.mkv -c copy audio.m4a # AAC
ffmpeg -i input.mkv -c copy audio.mp3 # MP3
ffmpeg -i input.mkv -c copy audio.ac3 # AC3
ffmpeg -i input.mkv -an -c copy video.mkv
ffmpeg -i input.mkv -map 0:a:1 -c copy audio.m4a # stream 1

-c copy is like -vcodec copy -acodec copy. -map 0:1 means file 0, stream 1. -an means audio none.

-- Edited: -map 0:1 => -map 0:a:1 (pick 2nd audio not just 2nd any stream)