[FFmpeg-trac] #10038(undetermined:new): Wrong duration / speed in audio recording made with ffmpeg -f avfoundation

FFmpeg trac at avcodec.org
Tue Nov 15 14:25:23 EET 2022


#10038: Wrong duration / speed in audio recording made with ffmpeg -f avfoundation
-------------------------------------+-------------------------------------
             Reporter:  Raimondas    |                    Owner:  (none)
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:               |               Blocked By:
  avfoundation                       |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Comment (by Raimondas):

 Retested with current Git head build, same problem:
  - recorded ~20 sec of audio with MacBook Pro Microphone sampling rate set
 to 96k
  - resulting wav file is ~10 sec long

 There is a bitrate discrepancy.


 ffmpeg output:
 {{{
 ./ffmpeg -debug 1 -f avfoundation  -i ":0" -acodec pcm_s24le 96-24.wav
 (7:08 0)
 ffmpeg version N-109088-g52f7adfbde Copyright (c) 2000-2022 the FFmpeg
 developers
   built with Apple clang version 13.0.0 (clang-1300.0.29.30)
   configuration:
   libavutil      57. 42.100 / 57. 42.100
   libavcodec     59. 52.102 / 59. 52.102
   libavformat    59. 34.101 / 59. 34.101
   libavdevice    59.  8.101 / 59.  8.101
   libavfilter     8. 50.100 /  8. 50.100
   libswscale      6.  8.112 /  6.  8.112
   libswresample   4.  9.100 /  4.  9.100
  matched as AVOption 'debug' with argument '1'.
 Reading option '-f' ... matched as option 'f' (force format) with argument
 'avfoundation'.
 Reading option '-i' ... matched as input url with argument ':0'.
 Reading option '-acodec' ... matched as option 'acodec' (force audio codec
 ('copy' to copy stream)) with argument 'pcm_s24le'.
 Reading option '96-24.wav' ... matched as output url.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Successfully parsed a group of options.
 Parsing a group of options: input url :0.
 Applying option f (force format) with argument avfoundation.
 Successfully parsed a group of options.
 Opening an input file: :0.
 [avfoundation @ 0x15ae05270] audio device 'MacBook Pro Microphone' opened
 [avfoundation @ 0x15ae05270] All info found
 Input #0, avfoundation, from ':0':
   Duration: N/A, start: 337270.763406, bitrate: 3072 kb/s
   Stream #0:0, 1, 1/1000000: Audio: pcm_f32le, 96000 Hz, mono, flt, 3072
 kb/s
 Successfully opened the file.
 Parsing a group of options: output url 96-24.wav.
 Applying option acodec (force audio codec ('copy' to copy stream)) with
 argument pcm_s24le.
 Successfully parsed a group of options.
 Opening an output file: 96-24.wav.
 [file @ 0x15ba06460] Setting default whitelist 'file,crypto,data'
 Successfully opened the file.
 Stream mapping:
   Stream #0:0 -> #0:0 (pcm_f32le (native) -> pcm_s24le (native))
 Press [q] to stop, [?] for help
 cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
 if it occurs once at the start per stream)
     Last message repeated 2 times
 [avfoundation @ 0x15ae05270] Thread message queue blocking; consider
 raising the thread_queue_size option (current value: 1)
 detected 10 logical cores
 [graph_0_in_0_0 @ 0x15ae28440] Setting 'time_base' to value '1/96000'
 [graph_0_in_0_0 @ 0x15ae28440] Setting 'sample_rate' to value '96000'
 [graph_0_in_0_0 @ 0x15ae28440] Setting 'sample_fmt' to value 'flt'
 [graph_0_in_0_0 @ 0x15ae28440] Setting 'channel_layout' to value 'mono'
 [graph_0_in_0_0 @ 0x15ae28440] tb:1/96000 samplefmt:flt samplerate:96000
 chlayout:mono
 [format_out_0_0 @ 0x15ae1be20] Setting 'sample_fmts' to value 's32'
 [auto_aresample_0 @ 0x15ae15b20] Setting 'output_sample_bits' to value
 '24'
 [format_out_0_0 @ 0x15ae1be20] auto-inserting filter 'auto_aresample_0'
 between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
 [AVFilterGraph @ 0x15ae142c0] query_formats: 4 queried, 6 merged, 3
 already done, 0 delayed
 [auto_aresample_0 @ 0x15ae15b20] [SWR @ 0x140018000] Using fltp internally
 between filters
 [auto_aresample_0 @ 0x15ae15b20] ch:1 chl:mono fmt:flt r:96000Hz -> ch:1
 chl:mono fmt:s32 r:96000Hz
 Output #0, wav, to '96-24.wav':
   Metadata:
     ISFT            : Lavf59.34.101
   Stream #0:0, 0, 1/96000: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 96000
 Hz, mono, s32, 2304 kb/s
     Metadata:
       encoder         : Lavc59.52.102 pcm_s24le
 size=    2560kB time=00:00:20.75 bitrate=1010.6kbits/s speed=   1x

 [q] command received. Exiting.

 All streams finished for output file #0
 Terminating muxer thread 0
 [AVIOContext @ 0x15ba064e0] Statistics: 2678894 bytes written, 4 seeks, 13
 writeouts
 size=    2616kB time=00:00:20.81 bitrate=1029.8kbits/s speed=0.999x
 video:0kB audio:2616kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 0.003808%
 Input file #0 (:0):
   Input stream #0:0 (audio): 1744 packets read (3571712 bytes); 1744
 frames decoded (892928 samples);
   Total: 1744 packets (3571712 bytes) demuxed
 Output file #0 (96-24.wav):
   Output stream #0:0 (audio): 1744 frames encoded (892928 samples); 1744
 packets muxed (2678784 bytes);
   Total: 1744 packets (2678784 bytes) muxed
 1744 frames successfully decoded, 0 decoding errors
 Terminating demuxer thread 0

 }}}

 ffprobe output
 {{{
 ./ffprobe 96-24.wav
 (7:09 0)
 ffprobe version N-109088-g52f7adfbde Copyright (c) 2007-2022 the FFmpeg
 developers
   built with Apple clang version 13.0.0 (clang-1300.0.29.30)
   configuration:
   libavutil      57. 42.100 / 57. 42.100
   libavcodec     59. 52.102 / 59. 52.102
   libavformat    59. 34.101 / 59. 34.101
   libavdevice    59.  8.101 / 59.  8.101
   libavfilter     8. 50.100 /  8. 50.100
   libswscale      6.  8.112 /  6.  8.112
   libswresample   4.  9.100 /  4.  9.100
 Input #0, wav, from '96-24.wav':
   Metadata:
     encoder         : Lavf59.34.101
   Duration: 00:00:09.30, bitrate: 2304 kb/s
   Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 96000 Hz, mono,
 s32 (24 bit), 2304 kb/s
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10038#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list