Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6181 closed defect (fixed)

evalsrc : imprecise duration when specified using duration flag

Reported by: mtc Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: aeval
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description

Summary of the bug:
below example expected to be 48000*10 samples long, but instead is 480240 samples (ruins alignment work (require precise? else artifacts) later on.. )
How to reproduce:

% ffmpeg started on 2017-02-21 at 11:19:58
Report written to "ffmpeg-20170221-111958.log"
Command line:
"Q:\\ffmpeg-latest-win64-static\\ffmpeg-latest-win64-static\\bin\\ffmpeg.exe" -v 9 -loglevel 99 -filter_complex " aevalsrc=0:duration=10.0:sample_rate=48000 [out] " -map "[out]" "G:\\out01.wav" -report
ffmpeg version N-83507-g8fa18e0 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.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. 47.100 / 55. 47.100
  libavcodec     57. 80.100 / 57. 80.100
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument ' aevalsrc=0:duration=10.0:sample_rate=48000 [out] '.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '[out]'.
Reading option 'G:\out01.wav' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Applying option loglevel (set logging level) with argument 99.
Applying option filter_complex (create a complex filtergraph) with argument  aevalsrc=0:duration=10.0:sample_rate=48000 [out] .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
detected 8 logical cores
[Parsed_aevalsrc_0 @ 00000000006292e0] compat: called with args=[0:duration=10.0:sample_rate=48000]
[Parsed_aevalsrc_0 @ 00000000006292e0] Setting 'exprs' to value '0'
[Parsed_aevalsrc_0 @ 00000000006292e0] Setting 'duration' to value '10.0'
[Parsed_aevalsrc_0 @ 00000000006292e0] Setting 'sample_rate' to value '48000'
Parsing a group of options: output url G:\out01.wav.
Applying option map (set input stream mapping) with argument [out].
Successfully parsed a group of options.
Opening an output file: G:\out01.wav.
[file @ 000000000062a2c0] Setting default whitelist 'file,crypto'
Successfully opened the file.
[Parsed_aevalsrc_0 @ 00000000004c3de0] compat: called with args=[0:duration=10.0:sample_rate=48000]
[Parsed_aevalsrc_0 @ 00000000004c3de0] Setting 'exprs' to value '0'
[Parsed_aevalsrc_0 @ 00000000004c3de0] Setting 'duration' to value '10.0'
[Parsed_aevalsrc_0 @ 00000000004c3de0] Setting 'sample_rate' to value '48000'
[format_out_0_0 @ 000000000062ce80] Setting 'sample_fmts' to value 's16'
[format_out_0_0 @ 000000000062ce80] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_aevalsrc_0' and the filter 'format_out_0_0'
[AVFilterGraph @ 000000000062a4e0] query_formats: 3 queried, 3 merged, 3 already done, 0 delayed
[Parsed_aevalsrc_0 @ 00000000004c3de0] sample_rate:48000 chlayout:mono duration:10000000
[auto_resampler_0 @ 000000000062e720] [SWR @ 00000000004c3fe0] Using dblp internally between filters
[auto_resampler_0 @ 000000000062e720] ch:1 chl:mono fmt:dblp r:48000Hz -> ch:1 chl:mono fmt:s16 r:48000Hz
Output #0, wav, to 'G:\out01.wav':
  Metadata:
    ISFT            : Lavf57.66.102
    Stream #0:0, 0, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s (default)
    Metadata:
      encoder         : Lavc57.80.100 pcm_s16le
Stream mapping:
  aevalsrc -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
No more output streams to write to, finishing.
size=     938kB time=00:00:10.00 bitrate= 768.1kbits/s speed= 667x    
video:0kB audio:938kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.008121%
Output file #0 (G:\out01.wav):
  Output stream #0:0 (audio): 469 frames encoded (480256 samples); 469 packets muxed (960512 bytes); 
  Total: 469 packets (960512 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 000000000062a3c0] Statistics: 4 seeks, 472 writeouts

ffmpeg version
built on ... https://ffmpeg.zeranoe.com/builds/

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (5)

comment:1 by Elon Musk, 7 years ago

Resolution: wontfix
Status: newclosed

That is because you need to set nb_samples to multiple of duration samples. By default they are 1024 and not 1000 thus causing this "issue".

comment:2 by Cigaes, 7 years ago

Analyzed by developer: set
Component: undeterminedavfilter
Resolution: wontfix
Status: closedreopened
Version: unspecifiedgit-master

aevalsrc should check the duration not only to return EOF but also to adjust the number of samples of the last frame, like sine does for example. Quite an easy fix.

comment:3 by Cigaes, 7 years ago

Forgot to add: in the meantime, you can fix the duration using the trim filter.

comment:4 by Elon Musk, 7 years ago

Resolution: fixed
Status: reopenedclosed

comment:5 by Carl Eugen Hoyos, 7 years ago

Keywords: aeval added
Note: See TracTickets for help on using tickets.