Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#6779 closed defect (fixed)

resampler=soxr:tsf=s32 failed

Reported by: omniplex Owned by:
Priority: minor Component: swresample
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: aresample resampler=soxr:tsf=s32 dislikes s32
How to reproduce:

ffmpeg started on 2017-10-26 at 06:01:36
Report written to "ffmpeg-20171026-060136.log"
Command line:
ffmpeg.exe -report -err_detect aggressive -v verbose -i battle_of_kings_preview.mp3 -vn -filter:a "aresample=48000:resampler=soxr:precision=28:ocl=downmix:cheby=1:matrix_encoding=dolby:tsf=s32" -f ogg -c:a libvorbis -b:a 25KiB "C:\\Users\\sysop\\Downloads\\battle_of_kings_preview.oga"
ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-err_detect' ...Routing option err_detect to both codec and muxer layer
 matched as AVOption 'err_detect' with argument 'aggressive'.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'verbose'.
Reading option '-i' ... matched as input url with argument 'battle_of_kings_preview.mp3'.
Reading option '-vn' ... matched as option 'vn' (disable video) with argument '1'.
Reading option '-filter:a' ... matched as option 'filter' (set stream filtergraph) with argument 'aresample=48000:resampler=soxr:precision=28:ocl=downmix:cheby=1:matrix_encoding=dolby:tsf=s32'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'ogg'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'libvorbis'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '25KiB'.
Reading option 'C:\Users\sysop\Downloads\battle_of_kings_preview.oga' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option v (set logging level) with argument verbose.
Successfully parsed a group of options.
Parsing a group of options: input url battle_of_kings_preview.mp3.
Successfully parsed a group of options.
Opening an input file: battle_of_kings_preview.mp3.
[NULL @ 000000000061a3e0] Opening 'battle_of_kings_preview.mp3' for reading
[file @ 000000000061ab00] Setting default whitelist 'file,crypto'
[mp3 @ 000000000061a3e0] Format mp3 probed with size=131072 and score=51
id3v2 ver:3 flags:00 len:120115
[mp3 @ 000000000061a3e0] Skipping 0 bytes of junk at 120125.
[mp3 @ 000000000061a3e0] Before avformat_find_stream_info() pos: 120125 bytes read:131072 seeks:0 nb_streams:2
[mp3 @ 000000000061a3e0] All info found
[mp3 @ 000000000061a3e0] Estimating duration from bitrate, this may be inaccurate
[mp3 @ 000000000061a3e0] After avformat_find_stream_info() pos: 173373 bytes read:196608 seeks:0 frames:51
Input #0, mp3, from 'battle_of_kings_preview.mp3':
  Metadata:
    album           : Machinimasound 2012
    artist          : Machinimasound
    album_artist    : MachinimaSound
    composer        : MachinimaSound
    copyright       : Creative Commons Attribution 2.0
    publisher       : Machinimasound
    title           : Battle of Kings
    date            : 2012
  Duration: 00:03:28.36, start: 0.000000, bitrate: 324 kb/s
    Stream #0:0, 50, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
    Stream #0:1, 1, 1/90000: Video: png, 1 reference frame, rgb24(pc), 600x600, 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)
Successfully opened the file.
Parsing a group of options: output url C:\Users\sysop\Downloads\battle_of_kings_preview.oga.
Applying option vn (disable video) with argument 1.
Applying option filter:a (set stream filtergraph) with argument aresample=48000:resampler=soxr:precision=28:ocl=downmix:cheby=1:matrix_encoding=dolby:tsf=s32.
Applying option f (force format) with argument ogg.
Applying option c:a (codec name) with argument libvorbis.
Applying option b:a (video bitrate (please use -b:v)) with argument 25KiB.
Successfully parsed a group of options.
Opening an output file: C:\Users\sysop\Downloads\battle_of_kings_preview.oga.
[file @ 000000000048aee0] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
detected 4 logical cores
[Parsed_aresample_0 @ 00000000006192a0] Setting 'sample_rate' to value '48000'
[Parsed_aresample_0 @ 00000000006192a0] Setting 'resampler' to value 'soxr'
[Parsed_aresample_0 @ 00000000006192a0] Setting 'precision' to value '28'
[Parsed_aresample_0 @ 00000000006192a0] Setting 'ocl' to value 'downmix'
[Parsed_aresample_0 @ 00000000006192a0] Setting 'cheby' to value '1'
[Parsed_aresample_0 @ 00000000006192a0] Setting 'matrix_encoding' to value 'dolby'
[Parsed_aresample_0 @ 00000000006192a0] Setting 'tsf' to value 's32'
[graph_0_in_0_0 @ 000000000046ade0] Setting 'time_base' to value '1/44100'
[graph_0_in_0_0 @ 000000000046ade0] Setting 'sample_rate' to value '44100'
[graph_0_in_0_0 @ 000000000046ade0] Setting 'sample_fmt' to value 's16p'
[graph_0_in_0_0 @ 000000000046ade0] Setting 'channel_layout' to value '0x3'
[graph_0_in_0_0 @ 000000000046ade0] tb:1/44100 samplefmt:s16p samplerate:44100 chlayout:0x3
[format_out_0_0 @ 00000000004a6a40] Setting 'sample_fmts' to value 'fltp'
[AVFilterGraph @ 00000000004c61c0] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
[Parsed_aresample_0 @ 00000000006192a0] [SWR @ 00000000004cdae0] Using s32 internally between filters
[Parsed_aresample_0 @ 00000000006192a0] [SWR @ 00000000004cdae0] Requested sample format s32 is not supported internally, S16/S32/S64/FLT/DBL is supported
[Parsed_aresample_0 @ 00000000006192a0] Failed to configure output pad on Parsed_aresample_0
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
[AVIOContext @ 000000000061bdc0] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 000000000061aca0] Statistics: 196608 bytes read, 0 seeks
Conversion failed!

The error message recommends S32 (capital S), but S32 or 32 never get as far as s32 (small s), which used to work as expected in older 2.x versions. Please holler if you prefer -report logs as attachment instead of inline in future tickets.

Attachments (1)

ffmpeg-20171027-045637.log (10.3 KB ) - added by omniplex 7 years ago.
Working 3.0 (Einstein) conversion report of the same file instead of 3.3.3

Download all attachments as: .zip

Change History (9)

comment:1 by Carl Eugen Hoyos, 7 years ago

Component: undeterminedswresample
Keywords: audio sample formats removed
Priority: normalminor
Version: unspecifiedgit-master

Feel free to test with tsf=s32p but I get a crash here with a simplified command line:

$ valgrind ./ffmpeg_g -f lavfi -i sine=r=96000 -af aresample=48000:ocl=downmix:tsf=s32p -f null -
==19549== Memcheck, a memory error detector
==19549== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==19549== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==19549== Command: ./ffmpeg_g -f lavfi -i sine=r=44100 -af aresample=48000:precision=28:ocl=downmix:cheby=1:tsf=s32p -f null -
==19549==
ffmpeg version N-88151-ga07ac93 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl
  libavutil      56.  0.100 / 56.  0.100
  libavcodec     58.  0.100 / 58.  0.100
  libavformat    58.  0.101 / 58.  0.101
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  0.100 /  7.  0.100
  libswscale      5.  0.100 /  5.  0.100
  libswresample   3.  0.100 /  3.  0.100
  libpostproc    55.  0.100 / 55.  0.100
Input #0, lavfi, from 'sine=r=44100':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
==19549== Invalid read of size 4
==19549==    at 0xFF6D80: copy_s32 (rematrix_template.c:65)
==19549==    by 0xFF737F: swri_rematrix (rematrix.c:516)
==19549==    by 0xFF898C: swr_convert_internal.part.3 (swresample.c:643)
==19549==    by 0xFF938C: swr_convert (swresample.c:748)
==19549==    by 0x5B45FE: filter_frame (af_aresample.c:217)
==19549==    by 0x4C24D9: ff_filter_activate (avfilter.c:1104)
==19549==    by 0x4C6B4B: av_buffersrc_add_frame_internal (buffersrc.c:181)
==19549==    by 0x4C6FFC: av_buffersrc_add_frame_flags (buffersrc.c:164)
==19549==    by 0x4A0E26: send_frame_to_filters (ffmpeg.c:2216)
==19549==    by 0x4A11E3: decode_audio (ffmpeg.c:2364)
==19549==    by 0x4A2DCC: process_input_packet (ffmpeg.c:2646)
==19549==    by 0x481866: main (ffmpeg.c:4450)
==19549==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==19549==
==19549==
==19549== Process terminating with default action of signal 11 (SIGSEGV)
==19549==  Access not within mapped region at address 0x0
==19549==    at 0xFF6D80: copy_s32 (rematrix_template.c:65)
==19549==    by 0xFF737F: swri_rematrix (rematrix.c:516)
==19549==    by 0xFF898C: swr_convert_internal.part.3 (swresample.c:643)
==19549==    by 0xFF938C: swr_convert (swresample.c:748)
==19549==    by 0x5B45FE: filter_frame (af_aresample.c:217)
==19549==    by 0x4C24D9: ff_filter_activate (avfilter.c:1104)
==19549==    by 0x4C6B4B: av_buffersrc_add_frame_internal (buffersrc.c:181)
==19549==    by 0x4C6FFC: av_buffersrc_add_frame_flags (buffersrc.c:164)
==19549==    by 0x4A0E26: send_frame_to_filters (ffmpeg.c:2216)
==19549==    by 0x4A11E3: decode_audio (ffmpeg.c:2364)
==19549==    by 0x4A2DCC: process_input_packet (ffmpeg.c:2646)
==19549==    by 0x481866: main (ffmpeg.c:4450)
==19549==  If you believe this happened as a result of a stack
==19549==  overflow in your program's main thread (unlikely but
==19549==  possible), you can try to increase the size of the
==19549==  main thread stack using the --main-stacksize= flag.
==19549==  The main thread stack size used in this run was 8388608.
==19549==
==19549== HEAP SUMMARY:
==19549==     in use at exit: 257,786 bytes in 187 blocks
==19549==   total heap usage: 672 allocs, 485 frees, 276,269 bytes allocated
==19549==
==19549== LEAK SUMMARY:
==19549==    definitely lost: 0 bytes in 0 blocks
==19549==    indirectly lost: 0 bytes in 0 blocks
==19549==      possibly lost: 4,352 bytes in 16 blocks
==19549==    still reachable: 253,434 bytes in 171 blocks
==19549==         suppressed: 0 bytes in 0 blocks
==19549== Rerun with --leak-check=full to see details of leaked memory
==19549==
==19549== For counts of detected and suppressed errors, rerun with: -v
==19549== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
Killed

comment:2 by Carl Eugen Hoyos, 7 years ago

Apparently not really a regression since 6c7a0876fefdd3c919afcabf493492cb4946ca6a as it didn't work before;-(

by omniplex, 7 years ago

Attachment: ffmpeg-20171027-045637.log added

Working 3.0 (Einstein) conversion report of the same file instead of 3.3.3

comment:3 by omniplex, 7 years ago

Just for fun I'll check if it was already broken in 3.2.4, last known good so far was 3.0 (report attached).

comment:4 by Carl Eugen Hoyos, 7 years ago

Please test tsf=s32p, no need to test older versions.

comment:5 by Carl Eugen Hoyos, 6 years ago

Resolution: fixed
Status: newclosed

I believe I fixed the trivial issue in 851829455889cfefee8d802d8428ed36effb9fcf, opened ticket #6785 for the more important bug.

comment:6 by omniplex, 6 years ago

FWIW FFmpeg -sample_fmts still claims to know s16, s32, and s64:

ffmpeg started on 2017-10-28 at 17:58:11
Report written to "ffmpeg-20171028-175811.log"
Command line:
"c:\\Program Files\\SysInternals\\ffmpeg.exe" -report -sample_fmts
ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-sample_fmts' ... matched as option 'sample_fmts' (show available audio sample formats) with argument '(null)'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option sample_fmts (show available audio sample formats) with argument (null).

name   depth
u8        8
s16      16
s32      32
flt      32
dbl      64
u8p       8
s16p     16
s32p     32
fltp     32
dblp     64
s64      64
s64p     64

in reply to:  6 comment:7 by Carl Eugen Hoyos, 6 years ago

Replying to omniplex:

FWIW FFmpeg -sample_fmts still claims to know s16, s32, and s64:

Of course!
But not all of them are supported by the resampler.

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

Replying to cehoyos:

Apparently not really a regression since 6c7a0876fefdd3c919afcabf493492cb4946ca6a as it didn't work before;-(

This comment apparently wasn't clear enough, sorry: tsf did not work correctly before said commit, you did not get the sample format you requested.

Note: See TracTickets for help on using tickets.