How do I concatenate audio files and produce two copies in different formats?

classic Classic list List threaded Threaded
2 messages Options
ms
Reply | Threaded
Open this post in threaded view
|

How do I concatenate audio files and produce two copies in different formats?

ms
I tried

ffmpeg -i a.mp3 -i b.mp3 -filter_complex concat=n=2:v=0:a=1 c.mp3 c.ogg

but c.mp3 is the concatenated result while c.ogg is a converted copy of a.mp3

I've tried a bunch of other possibilities, including using asplit, but I just end up with less than helpful error messages. I've read much of the extensive ffmpeg documentation, including the filter document, but I don't think I understand how one connects the various streams that can be created. Even an explanation of why the above command does what it does would be helpful.
Reply | Threaded
Open this post in threaded view
|

Re: How do I concatenate audio files and produce two copies in different formats?

Moritz Barsnick
Hi ms,

On Wed, Oct 21, 2015 at 08:25:36 -0700, ms wrote:
> ffmpeg -i a.mp3 -i b.mp3 -filter_complex concat=n=2:v=0:a=1 c.mp3 c.ogg
>
> but c.mp3 is the concatenated result while c.ogg is a converted copy of
> a.mp3
[...]
> Even an explanation of why the above command does what it does would be
> helpful.

You are specifying two outputs. The second output gets a completely new
set of output arguments, i.e. options which apply to it. You didn't
provide any, so ffmpeg uses defaults. In your case, it uses no filter
and the first input source for the second output.

To resolve this, you could specify filter_complex twice (with explicit
[0:0][1:0] inputs). Or even better, you duplicate the result of the
filter chain using the mentioned asplit, and use the results each for
your outputs respectively:

$ ffmpeg -i a.mp3 -i b.mp3 -filter_complex "concat=n=2:v=0:a=1,asplit[a1][a2]" -map "[a1]" c.mp3 -map "[a2]" c.ogg

> I've tried a bunch of other possibilities, including using asplit, but I
> just end up with less than helpful error messages.

If you had shown us the complete, uncut console output (along with the
command line), we could have pointed out what you should have been
looking at. ;-)

> I've read much of the extensive ffmpeg documentation, including the
> filter document, but I don't think I understand how one connects the
> various streams that can be created.

Hints at what can be improved in the documentation are always gladly
taken.

Chapter 3 has some simpler graphs:
https://ffmpeg.org/ffmpeg.html#Detailed-description
but here are some nice ones to explain the scenarios you have been
using or trying to use:
https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs

Hope this helps,
cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user