0

I'm trying to compose source video and audio into a final MP4 video. I have a problem with the WAV audio. After decoding and filtering, I'm getting an error from the output encoder: [aac @ 0x145e04c40] more samples than frame size

I initially used the following filter graph (minimal reproducible example):

    abuffer -> aformat -> abuffersink

At this point I was getting the error mentioned above.

Then, I tried to insert a aresample filter to the graph:

    abuffer -> aresample -> aformat -> abuffersink

But still getting the same error. This was based on the fact that the ffmpeg CLI uses this filter when converting WAV to MP4:

Command:

    ffmpeg -i source.wav output.mp4 -loglevel debug

Output contains:

    [graph_0_in_0_0 @ 0x138f06200] Setting 'time_base' to value '1/44100'
    [graph_0_in_0_0 @ 0x138f06200] Setting 'sample_rate' to value '44100'
    [graph_0_in_0_0 @ 0x138f06200] Setting 'sample_fmt' to value 's16'
    [graph_0_in_0_0 @ 0x138f06200] Setting 'channel_layout' to value 'mono'
    [graph_0_in_0_0 @ 0x138f06200] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:mono
    [format_out_0_0 @ 0x138f06620] Setting 'sample_fmts' to value 'fltp'
    [format_out_0_0 @ 0x138f06620] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
    [format_out_0_0 @ 0x138f06620] auto-inserting filter 'auto_aresample_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
    [AVFilterGraph @ 0x138f060f0] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
    [auto_aresample_0 @ 0x138f06c30] [SWR @ 0x120098000] Using s16p internally between filters
    [auto_aresample_0 @ 0x138f06c30] ch:1 chl:mono fmt:s16 r:44100Hz -> ch:1 chl:mono fmt:fltp r:44100Hz
    Output #0, mp4, to 'output.mp4':
      Metadata:
        encoder         : Lavf59.27.100
      Stream #0:0, 0, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, delay 1024, 69 kb/s
        Metadata:
          encoder         : Lavc59.37.100 aac

I'm trying to figure out whether I should use the SWR library directly as exemplified in the transcode_aac example.

vstrom coder
  • 297
  • 1
  • 8

0 Answers0