[FFmpeg-user] Mixing audio tracks

Andrey Utkin andrey.krieger.utkin at gmail.com
Wed May 23 10:44:22 CEST 2012


Hi. I fail to mix two audio tracks using ffmpeg utility.

First i tried with recently added -af flag, but it looks unclear how
to address different input files, and is it is possible at all. See
Listing 1.
Then i tried -f lavfi, but having confusion about usability of it.
amerge filter tells on merging two mono files "Inputs overlap: output
layout will be meaningless". Also, before, i tried the same without
adding "pan" filter, with original stereo channels layouts. See
Listing 2.
Do i miss some point, or is that really not finely usable case of
ffmpeg utility? Or some regression?


=======
Listing 1
=======
ffmpeg -i /home/krieger_nocrypt/music/Iron_Maiden/Brave_new_world/05-out_of_the_silent_planet.mp3
-i /home/krieger_nocrypt/music/Iron_Maiden/Brave_new_world/04-ghost_of_the_navigator.mp3
-codec libfaac -af "amerge" -y /tmp/amerge.flv -loglevel debug
ffmpeg version N-40958-gea5dab5 Copyright (c) 2000-2012 the FFmpeg developers
  built on May 23 2012 10:37:31 with gcc 4.5.3
  configuration: --enable-encoder=pcm_s16be --enable-encoder=libx264
--enable-encoder=libfaac --enable-static --enable-shared
--enable-libx264 --enable-libfaac --enable-libfreetype
--enable-nonfree --disable-zlib --enable-gpl --extra-libs=
--extra-cflags= --extra-ldflags= --disable-debug
--enable-optimizations --enable-yasm --enable-asm
  libavutil      51. 53.100 / 51. 53.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 76.100 /  2. 76.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[mp3 @ 0x884a3c0] Format mp3 probed with size=2048 and score=51
[mp3 @ 0x884a3c0] File position before avformat_find_stream_info() is 0
[mp3 @ 0x884a3c0] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x884a3c0] Estimating duration from bitrate, this may be inaccurate
[mp3 @ 0x884a3c0] File position after avformat_find_stream_info() is 102400
Input #0, mp3, from
'/home/krieger_nocrypt/music/Iron_Maiden/Brave_new_world/05-out_of_the_silent_planet.mp3':
  Metadata:
    title           : Out of the silent planet
    artist          : Iron Maiden
    album           : Brave new world
    date            : 2000
    comment         :
  Duration: 00:06:25.54, start: 0.000000, bitrate: 160 kb/s
    Stream #0:0, 194, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16, 160 kb/s
[mp3 @ 0x8844940] Format mp3 probed with size=2048 and score=51
[mp3 @ 0x8844940] File position before avformat_find_stream_info() is
0
[mp3 @ 0x8844940] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x8844940] Estimating duration from bitrate, this may be
inaccurate
[mp3 @ 0x8844940] File position after avformat_find_stream_info() is
102400
Input #1, mp3, from
'/home/krieger_nocrypt/music/Iron_Maiden/Brave_new_world/04-ghost_of_the_navigator.mp3':
  Metadata:
    title           : Ghost of the navigator
    artist          : Iron Maiden
    album           : Brave new world
    date            : 2000
    comment         :
  Duration: 00:06:50.07, start: 0.000000, bitrate: 160 kb/s
    Stream #1:0, 194, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16, 160 kb/s
[abuffer source @ 0x8895c80] Setting entry with key 'time_base' to
value '1/14112000'
[abuffer source @ 0x8895c80] Setting entry with key 'sample_rate' to
value '44100'
[abuffer source @ 0x8895c80] Setting entry with key 'sample_fmt' to
value 's16'
[abuffer source @ 0x8895c80] Setting entry with key 'channel_layout'
to value '0x3'
[abuffer @ 0x8866380] tb:1/14112000 samplefmt:s16 samplerate: 44100 ch
layout:0x3
[aformat filter @ 0x88a5fc0] Setting entry with key 'sample_fmts' to value 's16'
[aformat filter @ 0x88a5fc0] Setting entry with key 'channel_layouts'
to value '0x4,0x3,0x7,0x107,0x37,0x3f'
Output pad "default" for the filter "src" of type "abuffer" not
connected to any destination
Error opening filters!


=======
Listing 2
=======

LD_LIBRARY_PATH=. ./ffmpeg -f lavfi -i
"amovie=/home/krieger_nocrypt/music/Iron_Maiden/Brave_new_world/05-out_of_the_silent_planet.mp3,pan=1
[a0]; amovie=/home/krieger_nocrypt/music/Iron_Maiden/Brave_new_world/04-ghost_of_the_navigator.mp3,pan=1
[a1]; [a0][a1] amerge,pan=1" -codec libfaac -y /tmp/amerge.flv
-loglevel debug
ffmpeg version N-40958-gea5dab5 Copyright (c) 2000-2012 the FFmpeg developers
  built on May 23 2012 10:37:31 with gcc 4.5.3
  configuration: --enable-encoder=pcm_s16be --enable-encoder=libx264
--enable-encoder=libfaac --enable-static --enable-shared
--enable-libx264 --enable-libfaac --enable-libfreetype
--enable-nonfree --disable-zlib --enable-gpl --extra-libs=
--extra-cflags= --extra-ldflags= --disable-debug
--enable-optimizations --enable-yasm --enable-asm
  libavutil      51. 53.100 / 51. 53.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 76.100 /  2. 76.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[mp3 @ 0x8923440] Format mp3 probed with size=2048 and score=51
[mp3 @ 0x8923440] File position before avformat_find_stream_info() is 0
[mp3 @ 0x8923440] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x8923440] Estimating duration from bitrate, this may be inaccurate
[mp3 @ 0x8923440] File position after avformat_find_stream_info() is 102400
[amovie @ 0x8923200] seek_point:0 format_name:(null)
file_name:/home/krieger_nocrypt/music/Iron_Maiden/Brave_new_world/05-out_of_the_silent_planet.mp3
stream_index:0
[mp3 @ 0x893c840] Format mp3 probed with size=2048 and score=51
[mp3 @ 0x893c840] File position before avformat_find_stream_info() is 0
[mp3 @ 0x893c840] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x893c840] Estimating duration from bitrate, this may be inaccurate
[mp3 @ 0x893c840] File position after avformat_find_stream_info() is 102400
[amovie @ 0x895bce0] seek_point:0 format_name:(null)
file_name:/home/krieger_nocrypt/music/Iron_Maiden/Brave_new_world/04-ghost_of_the_navigator.mp3
stream_index:0
[amerge @ 0x8953ee0] Inputs overlap: output layout will be meaningless
Segmentation fault (core dumped)

-- 
Andrey Utkin


More information about the ffmpeg-user mailing list