Reputation: 38641
Background: I would like to use MLT melt
to render a project, but I'd like that render to result with separate audio and video files. I'd intend to use melt
's "consumer" avformat
which uses ffmpeg
's libraries, so I'm formulating this question as for ffmpeg
.
According to Useful FFmpeg Commands For Converting Audio & Video Files (labnol.org), the following is possible:
ffmpeg -i video.mp4 -t 00:00:50 -c copy small-1.mp4 -ss 00:00:50 -codec copy small-2.mp4
... which slices the "merged" audio+video files into two separate "chunk" files, which are also audio+video files, in a single call; that's not what I need.
Then, ffmpeg Documentation (ffmpeg.org), mentions this:
ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1
... which splits the entire duration of the content of two channels of a stereo audio file, into two mono files; that's more like what I need, except I want to split an A+V file into a stereo audio file, and a video file.
So I tried this with elephantsdream_teaser.ogv:
ffmpeg -i /tmp/elephantsdream_teaser.ogv \
-map 0.0 -vcodec copy ele.ogv -map 0.1 -acodec copy ele.ogg
... but this fails with "Number of stream maps must match number of output streams" (even if zero-size ele.ogv
and ele.ogg
are created).
So my question is - is something like this possible with ffmpeg
, and if it is, how can I do it?
Upvotes: 3
Views: 12072
Reputation: 51
Your command works, but you need to specify mapping with columns instead of dots as so:
ffmpeg -i /tmp/elephantsdream_teaser.ogv -map 0:0 -vcodec copy ele.ogv -map 0:1 -acodec copy ele.ogg
You might want to test with a more recent build of ffmpeg. Mine gave correct errors for your command:
[ogg @ 00000000043f8480] Invalid stream specifier: .0.
Last message repeated 3 times
Stream map '0.0' matches no streams.
Upvotes: 5