Hi Jonathan,

On Wed, Aug 26, 2015 at 14:11:05 +1200, Jonathan Viney wrote:

> high.mp4 is encoded correctly with the contents of output2, but
> medium.mp4 and low.mp4 are copies of input1.mkv.

Each new output file triggers a new set of output options. So strictly,
those are probably not "copies" but separate encodes with default
options (whatever ffmpeg applies by default to an mpeg4 container).

> Is there a way to encode multiple copies of output2 using -map?
> Specifying -map "[output2]" more than once causes errors saying it's
> already been used.

"-map" maps the _inputs_ to the filters/encoders. There are some nice
graphs here, and the solution(s) to your problem:
https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs

> Inserting a split=3 filter into the filter chain works fine and allows
> each output to be mapped individually:

Correct, now you get your intended outputs, but they're encoded
multiple times.

> Is that the best way to do this or can -map be used somehow? Would the
> split filter potentially be doing extra frame copies unnecessarily?
> I'm using current ffmpeg head.

No, that's not the best way. Don't worry about the frame copies - it's
the encodes that gobble up your CPU.

You're looking for the "tee" muxer:
https://www.ffmpeg.org/ffmpeg-formats.html#tee

  "The tee muxer can be used to write the same data to several files or
   any other kind of muxer. It can be used, for example, to both stream
   a video to the network and save it to disk at the same time.

   It is different from specifying several outputs to the ffmpeg
   command-line tool because the audio and video data will be encoded
   only once with the tee muxer; encoding can be a very expensive
   process."

ffmpeg -i input1.mkv -i input2.mkv -filter_complex
"myfilter[output1][output2]" -map "[output1]" -f null /dev/null -map
"[output2]" -y -f tee "high.mp4|medium.mp4|low.mp4"


(I think you now need to add "-c:v foo -c:a bar", as it seems that
using the tee muxer requires you to explicitly map input streams, and
to explicitly give encoding options, as ffmpeg can't determine
defaults.)

HTH,
Moritz
_______________________________________________
ffmpeg-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

Reply via email to