Opened 4 years ago
Closed 4 years ago
#8892 closed defect (duplicate)
Reading Ogg stream causes increasing CPU usage
Reported by: | Teodor Woźniak | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | git-master | Keywords: | ogg regression |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I am trying to record internet radio streaming in Ogg/Vorbis format.
FFmpeg uses more and more CPU. It may be related to:
Application provided invalid, non monotonically increasing dts to muxer in stream 0: 7072640 >= 7072640
showing in logs or metadata changing in the middle of stream, because it doesn't occur when feeding long Ogg/Vorbis stream from another instance of FFmpeg. The radio station uses Icecast.
How to reproduce:
wget http://lodz.radio.pionier.net.pl:8000/radiozak.ogg
leave it running for 30 minutes and press Ctrl-C. Do it between 22 and 16 o'clock UTC because otherwise there might be a long period without metadata change. (unfortunately you have to do it yourself, I can't publish recorded file because of copyrights. Or ask me and I'll put it on FTP, it's 48MB). Then:
cat radiozak.ogg | time ffmpeg -i - -map 0:a:0 -c:a copy -f null null
With n4.2.4 it returns:
1.28user 0.00system 0:01.28elapsed 99%CPU (0avgtext+0avgdata 7452maxresident)k
With n4.3:
59.54user 61.51system 2:01.06elapsed 99%CPU (0avgtext+0avgdata 135140maxresident)k
also note more memory usage.
It doesn't occur when the input is seekable:
ffmpeg -i radiozak.ogg -map 0:a:0 -c:a copy -f null null
It's regression since e983197cbc93420b67aa7e811be47d7278c2c8a2 (bisected).
Bisect helper script:
#!/bin/bash set -e cd "$(dirname "$0")" ./build_minimal || exit 255 cat radiozak.ogg | timeout 10 builddir/ffmpeg -i - -map 0:a:0 -c:a copy -f null null
build_minimal
script is the same as in #8881
File open log as required by bug reporting instruction:
$ builddir/ffmpeg -v 9 -loglevel 99 -i radiozak.ogg ffmpeg version N-98990-gf901d75bf1-minimal Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2) configuration: --extra-version=minimal --enable-static --disable-doc --disable-swscale --disable-postproc --enable-gpl --disable-everything --enable-protocol=file --enable-protocol=pipe --enable-protocol=http --enable-muxer=ogg --enable-muxer=matroska --enable-muxer=webm --enable-muxer=segment --enable-muxer=null --enable-demuxer=ogg --enable-indev=lavfi --disable-hwaccels --enable-libvorbis --enable-filter=anoisesrc --enable-filter=amerge --enable-filter=aformat --enable-filter=aresample --enable-encoder=libvorbis --enable-decoder=pcm_f64le --enable-decoder=vorbis --enable-gnutls libavutil 56. 58.100 / 56. 58.100 libavcodec 58.104.100 / 58.104.100 libavformat 58. 53.100 / 58. 53.100 libavdevice 58. 11.101 / 58. 11.101 libavfilter 7. 87.100 / 7. 87.100 libswresample 3. 8.100 / 3. 8.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 '-i' ... matched as input url with argument 'radiozak.ogg'. Finished splitting the commandline. Parsing a group of options: global . Applying option v (set logging level) with argument 9. Successfully parsed a group of options. Parsing a group of options: input url radiozak.ogg. Successfully parsed a group of options. Opening an input file: radiozak.ogg. [NULL @ 0x56477d5a65c0] Opening 'radiozak.ogg' for reading [file @ 0x56477d5a7040] Setting default whitelist 'file,crypto,data' Probing ogg score:100 size:2048 [ogg @ 0x56477d5a65c0] Format ogg probed with size=2048 and score=100 [ogg @ 0x56477d5a65c0] ogg_packet: curidx=-1 [ogg @ 0x56477d5a65c0] ogg_packet: idx=0 pstart=0 psize=0 segp=0 nsegs=1 [ogg @ 0x56477d5a65c0] ogg_packet: curidx=-1 [ogg @ 0x56477d5a65c0] ogg_packet: idx=0 pstart=30 psize=0 segp=0 nsegs=17 [ogg @ 0x56477d5a65c0] ogg_packet: curidx=0 [ogg @ 0x56477d5a65c0] ogg_packet: idx=0 pstart=437 psize=0 segp=2 nsegs=17 [ogg @ 0x56477d5a65c0] ogg_packet: curidx=-1 [ogg @ 0x56477d5a65c0] ogg_packet: idx=0 pstart=4120 psize=0 segp=0 nsegs=25 [ogg @ 0x56477d5a65c0] found headers [ogg @ 0x56477d5a65c0] failed to create or replace stream [ogg @ 0x56477d5a65c0] Before avformat_find_stream_info() pos: 8412 bytes read:65536 seeks:4 nb_streams:1 [ogg @ 0x56477d5a65c0] ogg_packet: curidx=0 [ogg @ 0x56477d5a65c0] ogg_packet: idx=0 pstart=4120 psize=0 segp=0 nsegs=25 [ogg @ 0x56477d5a65c0] All info found [ogg @ 0x56477d5a65c0] Estimating duration from bitrate, this may be inaccurate [ogg @ 0x56477d5a65c0] stream 0: start_time: 139.541 duration: 1769.19 [ogg @ 0x56477d5a65c0] format: start_time: 139.541 duration: 1769.19 (estimate from bit rate) bitrate=224 kb/s [ogg @ 0x56477d5a65c0] After avformat_find_stream_info() pos: 8412 bytes read:65536 seeks:4 frames:1 Input #0, ogg, from 'radiozak.ogg': Duration: 00:29:29.19, start: 139.541333, bitrate: 224 kb/s Stream #0:0, 1, 1/48000: Audio: vorbis, 48000 Hz, stereo, fltp, 224 kb/s Metadata: ARTIST : Pro8l3m TITLE : Art.258 [ŻAK - STUDENCKIE RADIO POLITECHNIKI ŁÓDZKIEJ 88,8 MHz www.zak.lodz.pl] GENRE : Alternative CONTACT : http://www.zak.lodz.pl/ comment : ŻAK 88,8 MHz - studenckie radio Politechniki Łódzkiej LOCATION : III DS PŁ, al. Politechniki 7, 93-590 Łódź, Polska ORGANIZATION : Politechnika Łódzka Successfully opened the file. At least one output file must be specified [AVIOContext @ 0x56477d5af400] Statistics: 65536 bytes read, 4 seeks
Duplicate of ticket #8778