Opened 21 months ago
#10120 new defect
Combining -copyts with segmentation gives unexpected results on opus streams and possibly others
Reported by: | Jarno Suni | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | ffmpeg |
Version: | git-master | Keywords: | |
Cc: | Jarno Suni | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
When using -copyts with segmentation, output files do not have the expected duration and count.
How to reproduce:
% ffmpeg -v 9 -loglevel 99 -i http://volosatoff.ru:8008/euro.opus -c copy -copyts -t 25 -f segment -segment_time 10 -reset_timestamps 0 -strftime 0 recording-%05d.opus ffmpeg version N-109444-geef763c705 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1) configuration: libavutil 57. 43.100 / 57. 43.100 libavcodec 59. 55.103 / 59. 55.103 libavformat 59. 34.102 / 59. 34.102 libavdevice 59. 8.101 / 59. 8.101 libavfilter 8. 53.100 / 8. 53.100 libswscale 6. 8.112 / 6. 8.112 libswresample 4. 9.100 / 4. 9.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 'http://volosatoff.ru:8008/euro.opus'. Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'. Reading option '-copyts' ... matched as option 'copyts' (copy timestamps) with argument '1'. Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '25'. Reading option '-f' ... matched as option 'f' (force format) with argument 'segment'. Reading option '-segment_time' ... matched as AVOption 'segment_time' with argument '10'. Reading option '-reset_timestamps' ... matched as AVOption 'reset_timestamps' with argument '0'. Reading option '-strftime' ... matched as AVOption 'strftime' with argument '0'. Reading option 'recording-%05d.opus' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option v (set logging level) with argument 9. Applying option copyts (copy timestamps) with argument 1. Successfully parsed a group of options. Parsing a group of options: input url http://volosatoff.ru:8008/euro.opus. Successfully parsed a group of options. Opening an input file: http://volosatoff.ru:8008/euro.opus. [NULL @ 0x55e3dad746c0] Opening 'http://volosatoff.ru:8008/euro.opus' for reading [http @ 0x55e3dad74f80] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy,data' [tcp @ 0x55e3dad77dc0] Original list of addresses: [tcp @ 0x55e3dad77dc0] Address 93.92.207.107 port 8008 [tcp @ 0x55e3dad77dc0] Interleaved list of addresses: [tcp @ 0x55e3dad77dc0] Address 93.92.207.107 port 8008 [tcp @ 0x55e3dad77dc0] Starting connection attempt to 93.92.207.107 port 8008 [tcp @ 0x55e3dad77dc0] Successfully connected to 93.92.207.107 port 8008 [http @ 0x55e3dad74f80] request: GET /euro.opus HTTP/1.1 User-Agent: Lavf/59.34.102 Accept: */* Range: bytes=0- Connection: close Host: volosatoff.ru:8008 Icy-MetaData: 1 [http @ 0x55e3dad74f80] header='HTTP/1.0 200 OK' [http @ 0x55e3dad74f80] http_code=200 [http @ 0x55e3dad74f80] header='Server: Icecast 2.4.4' [http @ 0x55e3dad74f80] header='Connection: Close' [http @ 0x55e3dad74f80] header='Date: Sun, 25 Dec 2022 20:05:40 GMT' [http @ 0x55e3dad74f80] header='Content-Type: audio/ogg' [http @ 0x55e3dad74f80] header='Cache-Control: no-cache, no-store' [http @ 0x55e3dad74f80] header='Expires: Mon, 26 Jul 1997 05:00:00 GMT' [http @ 0x55e3dad74f80] header='Pragma: no-cache' [http @ 0x55e3dad74f80] header='Access-Control-Allow-Origin: *' [http @ 0x55e3dad74f80] header='icy-br:128' [http @ 0x55e3dad74f80] header='icy-description:EuroDance 90s (Opus 128 kbps)' [http @ 0x55e3dad74f80] header='icy-genre:EuroDance' [http @ 0x55e3dad74f80] header='icy-name:VOLOSATOE RADIO' [http @ 0x55e3dad74f80] header='icy-pub:1' [http @ 0x55e3dad74f80] header='icy-url:http://fm.spb.ru' [http @ 0x55e3dad74f80] header='' Probing ogg score:100 size:2048 [ogg @ 0x55e3dad746c0] Format ogg probed with size=2048 and score=100 [ogg @ 0x55e3dad746c0] ogg_packet: curidx=-1 [ogg @ 0x55e3dad746c0] ogg_packet: idx=0 pstart=0 psize=0 segp=0 nsegs=1 [ogg @ 0x55e3dad746c0] ogg_packet: curidx=-1 [ogg @ 0x55e3dad746c0] ogg_packet: idx=0 pstart=19 psize=0 segp=0 nsegs=3 [ogg @ 0x55e3dad746c0] 636 bytes of comment header remain [ogg @ 0x55e3dad746c0] ogg_packet: curidx=-1 [ogg @ 0x55e3dad746c0] ogg_packet: idx=0 pstart=783 psize=0 segp=0 nsegs=86 [ogg @ 0x55e3dad746c0] found headers [ogg @ 0x55e3dad746c0] Before avformat_find_stream_info() pos: 14698 bytes read:14698 seeks:0 nb_streams:1 For transform of length 120, inverse, mdct_float, flags: [aligned, out_of_place], found 5 matches: 1: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: [30, ∞], factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only], prio: 304 2: mdct_pfa_5xM_inv_float_c - type: mdct_float, len: [10, ∞], factors[2]: [5, any], flags: [unaligned, out_of_place, inv_only], prio: 144 3: mdct_pfa_3xM_inv_float_c - type: mdct_float, len: [6, ∞], factors[2]: [3, any], flags: [unaligned, out_of_place, inv_only], prio: 112 4: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: 96 5: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: -130976 For transform of length 4, inverse, fft_float, flags: [aligned, inplace, preshuf], found 2 matches: 1: fft4_fwd_float_sse2 - type: fft_float, len: 4, factor: 2, flags: [aligned, inplace, out_of_place, preshuf], prio: 352 2: fft4_ns_float_c - type: fft_float, len: 4, factor: 2, flags: [unaligned, inplace, out_of_place, preshuf], prio: 96 Transform tree: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: 120, factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only] fft4_fwd_float_sse2 - type: fft_float, len: 4, factor: 2, flags: [aligned, inplace, out_of_place, preshuf] For transform of length 240, inverse, mdct_float, flags: [aligned, out_of_place], found 5 matches: 1: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: [30, ∞], factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only], prio: 304 2: mdct_pfa_5xM_inv_float_c - type: mdct_float, len: [10, ∞], factors[2]: [5, any], flags: [unaligned, out_of_place, inv_only], prio: 144 3: mdct_pfa_3xM_inv_float_c - type: mdct_float, len: [6, ∞], factors[2]: [3, any], flags: [unaligned, out_of_place, inv_only], prio: 112 4: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: 96 5: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: -130976 For transform of length 8, inverse, fft_float, flags: [aligned, inplace, preshuf], found 4 matches: 1: fft8_ns_float_avx - type: fft_float, len: 8, factor: 2, flags: [aligned, inplace, out_of_place, preshuf], prio: 480 2: fft8_ns_float_sse3 - type: fft_float, len: 8, factor: 2, flags: [aligned, inplace, out_of_place, preshuf], prio: 352 3: fft_pfa_ns_float_c - type: fft_float, len: [6, ∞], factors[2]: [7, 5, 3, 2, any], flags: [unaligned, inplace, out_of_place, preshuf], prio: 112 4: fft8_ns_float_c - type: fft_float, len: 8, factor: 2, flags: [unaligned, inplace, out_of_place, preshuf], prio: 96 Transform tree: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: 240, factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only] fft8_ns_float_avx - type: fft_float, len: 8, factor: 2, flags: [aligned, inplace, out_of_place, preshuf] For transform of length 480, inverse, mdct_float, flags: [aligned, out_of_place], found 5 matches: 1: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: [30, ∞], factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only], prio: 304 2: mdct_pfa_5xM_inv_float_c - type: mdct_float, len: [10, ∞], factors[2]: [5, any], flags: [unaligned, out_of_place, inv_only], prio: 144 3: mdct_pfa_3xM_inv_float_c - type: mdct_float, len: [6, ∞], factors[2]: [3, any], flags: [unaligned, out_of_place, inv_only], prio: 112 4: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: 96 5: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: -130976 For transform of length 16, inverse, fft_float, flags: [aligned, inplace, preshuf], found 3 matches: 1: fft16_ns_float_avx - type: fft_float, len: 16, factor: 2, flags: [aligned, inplace, out_of_place, preshuf], prio: 480 2: fft_pfa_ns_float_c - type: fft_float, len: [6, ∞], factors[2]: [7, 5, 3, 2, any], flags: [unaligned, inplace, out_of_place, preshuf], prio: 112 3: fft16_ns_float_c - type: fft_float, len: 16, factor: 2, flags: [unaligned, inplace, out_of_place, preshuf], prio: 96 Transform tree: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: 480, factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only] fft16_ns_float_avx - type: fft_float, len: 16, factor: 2, flags: [aligned, inplace, out_of_place, preshuf] For transform of length 960, inverse, mdct_float, flags: [aligned, out_of_place], found 5 matches: 1: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: [30, ∞], factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only], prio: 304 2: mdct_pfa_5xM_inv_float_c - type: mdct_float, len: [10, ∞], factors[2]: [5, any], flags: [unaligned, out_of_place, inv_only], prio: 144 3: mdct_pfa_3xM_inv_float_c - type: mdct_float, len: [6, ∞], factors[2]: [3, any], flags: [unaligned, out_of_place, inv_only], prio: 112 4: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: 96 5: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: -130976 For transform of length 32, inverse, fft_float, flags: [aligned, inplace, preshuf], found 3 matches: 1: fft32_ns_float_avx - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf], prio: 480 2: fft_pfa_ns_float_c - type: fft_float, len: [6, ∞], factors[2]: [7, 5, 3, 2, any], flags: [unaligned, inplace, out_of_place, preshuf], prio: 112 3: fft32_ns_float_c - type: fft_float, len: 32, factor: 2, flags: [unaligned, inplace, out_of_place, preshuf], prio: 96 Transform tree: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: 960, factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only] fft32_ns_float_avx - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf] [ogg @ 0x55e3dad746c0] ogg_packet: curidx=0 [ogg @ 0x55e3dad746c0] ogg_packet: idx=0 pstart=783 psize=0 segp=0 nsegs=86 [opus @ 0x55e3dad7a7c0] skip 312 / discard 0 samples due to side data [opus @ 0x55e3dad7a7c0] skip 312/960 samples [ogg @ 0x55e3dad746c0] All info found [ogg @ 0x55e3dad746c0] stream 0: start_time: 1.48417e+07 duration: NOPTS [ogg @ 0x55e3dad746c0] format: start_time: 1.48417e+07 duration: NOPTS (estimate from bit rate) bitrate=0 kb/s [ogg @ 0x55e3dad746c0] After avformat_find_stream_info() pos: 14698 bytes read:14698 seeks:0 frames:1 Input #0, ogg, from 'http://volosatoff.ru:8008/euro.opus': Metadata: icy-br : 128 icy-description : EuroDance 90s (Opus 128 kbps) icy-genre : EuroDance icy-name : VOLOSATOE RADIO icy-pub : 1 icy-url : http://fm.spb.ru Duration: N/A, start: 14841699.000000, bitrate: N/A Stream #0:0, 1, 1/48000: Audio: opus, 48000 Hz, stereo, fltp, delay 312 Metadata: ENCODER : opusenc from opus-tools 0.2-3-gf5f571b ENCODER_OPTIONS : --bitrate 128 Successfully opened the file. Parsing a group of options: output url recording-%05d.opus. Applying option c (codec name) with argument copy. Applying option t (record or transcode "duration" seconds of audio/video) with argument 25. Applying option f (force format) with argument segment. Successfully parsed a group of options. Opening an output file: recording-%05d.opus. Successfully opened the file. [segment @ 0x55e3dad88dc0] Selected stream id:0 type:audio [segment @ 0x55e3dad88dc0] Opening 'recording-00000.opus' for writing [file @ 0x55e3dadd9780] Setting default whitelist 'file,crypto,data' Output #0, segment, to 'recording-%05d.opus': Metadata: icy-br : 128 icy-description : EuroDance 90s (Opus 128 kbps) icy-genre : EuroDance icy-name : VOLOSATOE RADIO icy-pub : 1 icy-url : http://fm.spb.ru encoder : Lavf59.34.102 Stream #0:0, 0, 1/48000: Audio: opus, 48000 Hz, stereo, fltp, delay 312 Metadata: ENCODER : opusenc from opus-tools 0.2-3-gf5f571b ENCODER_OPTIONS : --bitrate 128 Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) [ogg @ 0x55e3dad746c0] ogg_packet: curidx=0 [ogg @ 0x55e3dad746c0] ogg_packet: idx=0 pstart=1057 psize=0 segp=2 nsegs=86 [ogg @ 0x55e3dad746c0] ogg_packet: curidx=0 [ogg @ 0x55e3dad746c0] ogg_packet: idx=0 pstart=1312 psize=0 segp=4 nsegs=86 No more output streams to write to, finishing. -0.0kbits/s speed=N/A All streams finished for output file #0 Terminating muxer thread 0 [segment @ 0x55e3dad88dc0] segment:'recording-00000.opus' count:0 ended [AVIOContext @ 0x55e3dadd0700] Statistics: 343 bytes written, 0 seeks, 1 writeouts size=N/A time=-577014:32:22.77 bitrate=N/A speed=N/A video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Input file #0 (http://volosatoff.ru:8008/euro.opus): Input stream #0:0 (audio): 1 packets read (274 bytes); Total: 1 packets (274 bytes) demuxed Output file #0 (recording-%05d.opus): Output stream #0:0 (audio): 0 packets muxed (0 bytes); Total: 0 packets (0 bytes) muxed 0 frames successfully decoded, 0 decoding errors Terminating demuxer thread 0 [AVIOContext @ 0x55e3dad8a040] Statistics: 14698 bytes read, 0 seeks
This will create one small output file that seems to be invalid. Not three playable files.
If you leave out -t option, the command will produce less than 1kB files fast, not one in 10s.
If the example stream fails, you could replace it by any other opuse stream from e.g. https://dir.xiph.org/codecs/Opus
Note:
See TracTickets
for help on using tickets.