[FFmpeg-user] creating dash multiple audio codecs

Moritz Barsnick barsnick at gmx.net
Sat Mar 16 02:25:49 EET 2019


Hi James,

On Sat, Mar 16, 2019 at 04:12:22 +0800, James Northrup wrote:
> my understanding is that dash is a format, so i can include multiple tracks
> or programs in one container.  what happens appears to be 3 opus instead of
> aac(orig)/aac(HE)/opus based on browser codec pref+bandwidth
> 
> ffmpeg -i 53f4cc2e686e87dc2004e0ed9669cb50.m4a -i
> 880f1ecd9c960940b077896915a3841c.m4a -i
> aff159b2496019e9b714e6d6660d779c.m4a  \
> -filter_complex 'concat=n=3:v=0:a=1:unsafe=1,asplit=3[out1][out2][out3]'
>  -nostdin \
> -map '[out1]' -c:a copy   \
> -map '[out2]' -c:a libfdk_aac -b:a 32k -profile:a aac_he_v2 -map 1:a \
> -map '[out3]' -c:a opus -b:a 32k -strict -2 -application voip
>  -frame_duration 60 -vbr off -compression_level 10  -packet_loss 0  \
> -dash_segment_type mp4  x.mpd
[...]
> Stream mapping:
>   Stream #0:0 (aac) -> concat:in0:a0 (graph 0)
>   Stream #1:0 (aac) -> concat:in1:a0 (graph 0)
>   Stream #2:0 (aac) -> concat:in2:a0 (graph 0)
>   asplit:output0 (graph 0) -> Stream #0:0 (opus)
>   asplit:output1 (graph 0) -> Stream #0:1 (opus)
>   Stream #1:0 -> #0:2 (aac (native) -> opus (native))
>   asplit:output2 (graph 0) -> Stream #0:3 (opus)

You need to realize that your "-c:a" options apply to a complete output
(x.mpd), so the third one is overwriting the first and the second (and
only one output follows - obviously).

If you want to apply different options to different streams within one
output, you need to use "-c:a:0", "-c:a:1", "-c:a:2". I also recommend
the stream specifier suffixes for the other options which are using
":a".

This and the following warnings should have given it away:
> Codec AVOption packet_loss (Expected packet loss percentage) specified for
> output file #0 (x.mpd) has not been used for any stream. The most likely
> reason is either wrong type (e.g. a video option with no video streams) or
> that it is a private option of some encoder which was not actually used for
> any stream.


Other notes:

Are you sure "-map 1:a" belongs in there? That gives you one additional
output stream from a single unconcatenated input.

What do you need "-strict -2" for? ffmpeg's aac codec hasn't required
that for over a year.


So, finally, let me guess (!):
$ ffmpeg -i 53f4cc2e686e87dc2004e0ed9669cb50.m4a -i \
  880f1ecd9c960940b077896915a3841c.m4a -i \
  aff159b2496019e9b714e6d6660d779c.m4a  \
  -filter_complex 'concat=n=3:v=0:a=1:unsafe=1,asplit=3[out1][out2][out3]'
  -nostdin \
  -map '[out1]' -c:a:0 copy   \
  -map '[out2]' -c:a:1 libfdk_aac -b:a:1 32k -profile:a:1 aac_he_v2 \
  -map '[out3]' -c:a:2 opus -b:a:2 32k -application voip \
  -frame_duration 60 -vbr off -compression_level 10  -packet_loss 0  \
  -dash_segment_type mp4 x.mpd

Cheers,
Moritz


More information about the ffmpeg-user mailing list