Opened 8 years ago

Last modified 8 years ago

#5053 new defect

Cannot select sample rate for the link between filters audio format

Reported by: Martin Strandgren Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I upgraded from 2.8 to 2.8.3 and my project no longer worked.

Query

ffmpeg -y \
-ss 0 -i testdata/video.webm \
-ss 0 -i backingtrack.mp3 \
-ss 0 -i testdata/audio.wav \
-i overlay.png \
-i suffix.mp4 \
-filter_complex \
\
        "[1:a][2:a] amix=inputs=2:duration=shortest [mergedAudio]; \
        [mergedAudio] asplit=3 [fullAudio][a1][a2]; \
        [a1] atrim=0:2 [vineAudio]; \
        [a2] atrim=0:4 [instagramAudio]; \
        [0]setpts=PTS-STARTPTS[video]; \
        [video][3]overlay[overlayed]; \
        [4]setpts=PTS-STARTPTS[suffix]; \
        [suffix] split=3 [suffix1][suffix2][suffix3]; \
        [overlayed] split=3 [fullIn][instagramIn][vineIn]; \
        [vineIn] trim=0:2 [vineOut]; \
        [instagramIn] trim=0:4 [instagramOut]; \
        [fullIn][suffix1] concat=n=2:v=1:a=0 [full]; \
        [vineOut][suffix2] concat=n=2:v=1:a=0 [vine]; \
        [instagramOut][suffix3] concat=n=2:v=1:a=0 [instagram]" \
\
-acodec libvorbis -b:a 128k -ac 2 -r 25 -vcodec libvpx -b:v 1024k \
-map [full] -map [fullAudio] testdata/output/full.webm \
-map [instagram] -map [instagramAudio] testdata/output/instagram.webm \
-map [vine] -map [vineAudio] testdata/output/vine.webm

Output:

ffmpeg version 2.8.3-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.1 (Debian 5.2.1-26) 20151125
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --cc=gcc
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'testdata/video.webm':
  Metadata:
    encoder         : whammy
  Duration: 00:00:08.08, start: 0.000000, bitrate: 2097 kb/s
    Stream #0:0: Video: vp8, yuv420p, 480x320, SAR 1:1 DAR 3:2, 1k tbr, 1k tbn, 1k tbc (default)
[mp3 @ 0xbc38740] Skipping 0 bytes of junk at 4096.
[mp3 @ 0xbc38740] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'backingtrack.mp3':
  Metadata:
    TSS             : Logic 10.2.0
  Duration: 00:00:08.07, start: 0.000000, bitrate: 164 kb/s
    Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 160 kb/s
Guessed Channel Layout for  Input Stream #2.0 : stereo
Input #2, wav, from 'testdata/audio.wav':
  Duration: 00:00:08.92, bitrate: 1411 kb/s
    Stream #2:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Input #3, png_pipe, from 'overlay.png':
  Duration: N/A, bitrate: N/A
    Stream #3:0: Video: png, rgba(pc), 480x320 [SAR 2835:2835 DAR 3:2], 25 tbr, 25 tbn, 25 tbc
Input #4, mov,mp4,m4a,3gp,3g2,mj2, from 'suffix.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.33.100
  Duration: 00:00:01.57, start: 0.000000, bitrate: 117 kb/s
    Stream #4:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 480x320 [SAR 1:1 DAR 3:2], 111 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
[audio format for output stream 0:1 @ 0xbc74960] Cannot select sample rate for the link between filters audio format for output stream 0:1 and output stream 0:1.
Error configuring complex filters.
Invalid argument

Also tested with git build g6b978da built on 20151130, same result.

It works if I add a "aformat=sample_rates=44100" step in the audio filter chain, but this was not needed before.

Change History (11)

comment:1 by Carl Eugen Hoyos, 8 years ago

Please test current FFmpeg git head.

comment:2 by Martin Strandgren, 8 years ago

Spent a few hours failing to build the latest version on my computer (only worked with static builds before). Will revisit this when I have more time to spare.

in reply to:  2 comment:3 by Carl Eugen Hoyos, 8 years ago

Replying to mstrandgren:

Spent a few hours failing to build the latest version on my computer

What is the issue? FFmpeg is supposed to build on many different systems out-of-the-box with ./configure --enable-gpl && make ffmpeg.

only worked with static builds before

All providers of static builds provide a current build, you provided console output for a release though. (The message on http://johnvansickle.com/ffmpeg/ concerning release builds has improved since you opened this ticket.)

Last edited 8 years ago by Carl Eugen Hoyos (previous) (diff)

comment:4 by Martin Strandgren, 8 years ago

Ok, here's the output from the latest git build:

ffmpeg version N-51439-g6b978da-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.1 (Debian 5.2.1-26) 20151125
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --cc=gcc
  libavutil      55.  9.100 / 55.  9.100
  libavcodec     57. 16.101 / 57. 16.101
  libavformat    57. 19.100 / 57. 19.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 17.100 /  6. 17.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'testdata/video.webm':
  Metadata:
    encoder         : whammy
  Duration: 00:00:08.08, start: 0.000000, bitrate: 2097 kb/s
    Stream #0:0: Video: vp8, yuv420p, 480x320, SAR 1:1 DAR 3:2, 1k tbr, 1k tbn, 1k tbc (default)
[mp3 @ 0xa879800] Skipping 0 bytes of junk at 481.
Input #1, mp3, from 'backingtrack.mp3':
  Metadata:
    TYER            : 2015-11-27T11:38
    date            : 2015-11-27T11:38
  Duration: 00:00:35.66, start: 0.025057, bitrate: 128 kb/s
    Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
    Metadata:
      encoder         : LAME3.97 
Guessed Channel Layout for  Input Stream #2.0 : stereo
Input #2, wav, from 'testdata/audio.wav':
  Duration: 00:00:08.92, bitrate: 1411 kb/s
    Stream #2:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Input #3, png_pipe, from 'overlay.png':
  Duration: N/A, bitrate: N/A
    Stream #3:0: Video: png, rgba(pc), 480x320 [SAR 2835:2835 DAR 3:2], 25 tbr, 25 tbn, 25 tbc
Input #4, mov,mp4,m4a,3gp,3g2,mj2, from 'suffix.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.33.100
  Duration: 00:00:01.57, start: 0.000000, bitrate: 117 kb/s
    Stream #4:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 480x320 [SAR 1:1 DAR 3:2], 111 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
[audio format for output stream 0:1 @ 0xa8d5660] Cannot select sample rate for the link between filters audio format for output stream 0:1 and output stream 0:1.
Error configuring complex filters.
Invalid argument

comment:5 by Carl Eugen Hoyos, 8 years ago

Please provide the needed input files (and please understand that you make an analysis much harder by separating the command line from the console output / not providing the command line).

comment:6 by Martin Strandgren, 8 years ago

But I did provide the command line, it's right there in the bug description?

comment:7 by Martin Strandgren, 8 years ago

The input files are here: https://www.dropbox.com/s/67bdul8jqwpxbx2/files.zip?dl=1 (Trac does not allow files larger than 2.5M, this seems easier for everyone).

comment:8 by Martin Strandgren, 8 years ago

Here's the command line and the console output in one block:

ffmpeg -y \
-ss 0 -i testdata/video.webm \
-ss 0 -i backingtrack.mp3 \
-ss 0 -i testdata/audio.wav \
-i overlay.png \
-i suffix.mp4 \
-filter_complex \
\
        "[1:a][2:a] amix=inputs=2:duration=shortest [mergedAudio]; \
        [mergedAudio] asplit=3 [fullAudio][a1][a2]; \
        [a1] atrim=0:2 [vineAudio]; \
        [a2] atrim=0:4 [instagramAudio]; \
        [0]setpts=PTS-STARTPTS[video]; \
        [video][3]overlay[overlayed]; \
        [4]setpts=PTS-STARTPTS[suffix]; \
        [suffix] split=3 [suffix1][suffix2][suffix3]; \
        [overlayed] split=3 [fullIn][instagramIn][vineIn]; \
        [vineIn] trim=0:2 [vineOut]; \
        [instagramIn] trim=0:4 [instagramOut]; \
        [fullIn][suffix1] concat=n=2:v=1:a=0 [full]; \
        [vineOut][suffix2] concat=n=2:v=1:a=0 [vine]; \
        [instagramOut][suffix3] concat=n=2:v=1:a=0 [instagram]" \
\
-acodec libvorbis -b:a 128k -ac 2 -r 25 -vcodec libvpx -b:v 1024k \
-map [full] -map [fullAudio] testdata/output/full.webm \
-map [instagram] -map [instagramAudio] testdata/output/instagram.webm \
-map [vine] -map [vineAudio] testdata/output/vine.webm

ffmpeg version N-51439-g6b978da-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.1 (Debian 5.2.1-26) 20151125
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --cc=gcc
  libavutil      55.  9.100 / 55.  9.100
  libavcodec     57. 16.101 / 57. 16.101
  libavformat    57. 19.100 / 57. 19.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 17.100 /  6. 17.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'testdata/video.webm':
  Metadata:
    encoder         : whammy
  Duration: 00:00:08.08, start: 0.000000, bitrate: 2097 kb/s
    Stream #0:0: Video: vp8, yuv420p, 480x320, SAR 1:1 DAR 3:2, 1k tbr, 1k tbn, 1k tbc (default)
[mp3 @ 0xa879800] Skipping 0 bytes of junk at 481.
Input #1, mp3, from 'backingtrack.mp3':
  Metadata:
    TYER            : 2015-11-27T11:38
    date            : 2015-11-27T11:38
  Duration: 00:00:35.66, start: 0.025057, bitrate: 128 kb/s
    Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
    Metadata:
      encoder         : LAME3.97 
Guessed Channel Layout for  Input Stream #2.0 : stereo
Input #2, wav, from 'testdata/audio.wav':
  Duration: 00:00:08.92, bitrate: 1411 kb/s
    Stream #2:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Input #3, png_pipe, from 'overlay.png':
  Duration: N/A, bitrate: N/A
    Stream #3:0: Video: png, rgba(pc), 480x320 [SAR 2835:2835 DAR 3:2], 25 tbr, 25 tbn, 25 tbc
Input #4, mov,mp4,m4a,3gp,3g2,mj2, from 'suffix.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.33.100
  Duration: 00:00:01.57, start: 0.000000, bitrate: 117 kb/s
    Stream #4:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 480x320 [SAR 1:1 DAR 3:2], 111 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
[audio format for output stream 0:1 @ 0xa8d5660] Cannot select sample rate for the link between filters audio format for output stream 0:1 and output stream 0:1.
Error configuring complex filters.
Invalid argument

comment:9 by Martin Strandgren, 8 years ago

Edit: removed duplicate comment

Last edited 8 years ago by Martin Strandgren (previous) (diff)

comment:10 by Cigaes, 8 years ago

The filter graph is too complex for FFmpeg to figure out a sample rate that suits all the paths. New heuristics could be added, but they would never cover all the cases.

Since you are controlling almost everything else, I suggest you disable automatic conversions and insert conversion filters explicitly.

Also, you should run different connected components of the graph in different graphs. That means audio and video here.

Last of all, in the future, if you want to increase your chances of getting attention fast, you should trim your command line to keep only what is necessary to exhibit the problem.

comment:11 by Martin Strandgren, 8 years ago

I reported it because it was a regression, it worked in 2.8 but not in 2.8.3, as advised in the irc channel. I added a conversion filter as you said, and it works well.

Last of all, the responses for this issue have been blazingly fast, but I'll make better reports in the future nonetheless :)

Note: See TracTickets for help on using tickets.