[FFmpeg-user] Are opus stream recordings generated by ffmpeg invalid?

Jarno Suni j_suni at yahoo.co.uk
Tue May 2 06:10:15 EEST 2023


On Monday, May 1, 2023 at 09:01:23 PM GMT+3, Ferdi Scholten <ferdi at sttc-nlp.nl> wrote:

Can you tell what exact command you used to record these streams? Which 
encoder did you use (two possibilities) and what was the screen output 
of the command?

I use the following script:

#!/bin/sh
set -e
url="http://stream.alandsradio.ax/stream.ogg"
mkdir test
cd test
ffmpeg -t 50 -i "$url" -c copy -f segment -segment_time 20 -reset_timestamps 1 -strftime 1 test-record'-%FT%H%M%S%z'-reset.opus
ffmpeg -t 50 -i "$url" -c copy -f segment -segment_time 20 -reset_timestamps 0 -strftime 1 test-record'-%FT%H%M%S%z'-no-reset.opus
ffmpeg -t 50 -i "$url" -c copy -f segment -segment_time 20 -reset_timestamps 1 -strftime 1 -copyts test-record'-%FT%H%M%S%z'-reset-copyts.opus
ffmpeg -t 50 -i "$url" -c copy -f segment -segment_time 20 -reset_timestamps 0 -strftime 1 -copyts test-record'-%FT%H%M%S%z'-no-reset-copyts.opus
ffmpeg -t 20 -i "$url" -c copy -copyts test-record-no-segments-copyts.opus
ffmpeg -t 20 -i "$url" -c copy test-record-no-segments.opus

This time I installed ffmpeg from https://git.ffmpeg.org/ffmpeg.git: N-110439-g5617465916

mpd (0.22.11) can only properly seek the last file. For the segmented files it gives "Seek amount would seek past the end of the song". I did not test by using ffmpeg option -stream_segment. As for test-record-no-segments-copyts.opus mpd kind of seeks to right position, but moves and starts playback from the start anyway.

FWIW screen output:


ffmpeg version N-110439-g5617465916 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  6.100 / 58.  6.100
  libavcodec     60. 10.100 / 60. 10.100
  libavformat    60.  5.100 / 60.  5.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  7.100 /  9.  7.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
[ogg @ 0x559ab050a7c0] 1 bytes of comment header remain
Input #0, ogg, from 'http://stream.alandsradio.ax/stream.ogg':
  Metadata:
    icy-pub         : 0
  Duration: N/A, start: 9007570.849292, bitrate: N/A
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
[segment @ 0x559ab0566d00] Opening 'test-record-2023-05-02T054248+0300-reset.opus' for writing
Output #0, segment, to 'test-record-%FT%H%M%S%z-reset.opus':
  Metadata:
    icy-pub         : 0
    encoder         : Lavf60.5.100
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[segment @ 0x559ab0566d00] Opening 'test-record-2023-05-02T054304+0300-reset.opus' for writing
[segment @ 0x559ab0566d00] Opening 'test-record-2023-05-02T054324+0300-reset.opus' for writing
[out#0/segment @ 0x559ab056d080] video:0kB audio:771kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
size=N/A time=00:00:49.99 bitrate=N/A speed=1.08x    
ffmpeg version N-110439-g5617465916 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  6.100 / 58.  6.100
  libavcodec     60. 10.100 / 60. 10.100
  libavformat    60.  5.100 / 60.  5.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  7.100 /  9.  7.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
[ogg @ 0x55a92012a7c0] 1 bytes of comment header remain
Input #0, ogg, from 'http://stream.alandsradio.ax/stream.ogg':
  Metadata:
    icy-pub         : 0
  Duration: N/A, start: 9007617.829292, bitrate: N/A
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
[segment @ 0x55a920186780] Opening 'test-record-2023-05-02T054335+0300-no-reset.opus' for writing
Output #0, segment, to 'test-record-%FT%H%M%S%z-no-reset.opus':
  Metadata:
    icy-pub         : 0
    encoder         : Lavf60.5.100
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[segment @ 0x55a920186780] Opening 'test-record-2023-05-02T054351+0300-no-reset.opus' for writing
[segment @ 0x55a920186780] Opening 'test-record-2023-05-02T054411+0300-no-reset.opus' for writing
[out#0/segment @ 0x55a92013d580] video:0kB audio:797kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
size=N/A time=00:00:49.99 bitrate=N/A speed=1.08x    
ffmpeg version N-110439-g5617465916 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  6.100 / 58.  6.100
  libavcodec     60. 10.100 / 60. 10.100
  libavformat    60.  5.100 / 60.  5.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  7.100 /  9.  7.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
[ogg @ 0x5605e63a17c0] 1 bytes of comment header remain
Input #0, ogg, from 'http://stream.alandsradio.ax/stream.ogg':
  Metadata:
    icy-pub         : 0
  Duration: N/A, start: 9007663.869292, bitrate: N/A
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
[segment @ 0x5605e6405200] Opening 'test-record-2023-05-02T054422+0300-reset-copyts.opus' for writing
Output #0, segment, to 'test-record-%FT%H%M%S%z-reset-copyts.opus':
  Metadata:
    icy-pub         : 0
    encoder         : Lavf60.5.100
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[segment @ 0x5605e6405200] Opening 'test-record-2023-05-02T054437+0300-reset-copyts.opus' for writing
[segment @ 0x5605e6405200] Opening 'test-record-2023-05-02T054457+0300-reset-copyts.opus' for writing
[out#0/segment @ 0x5605e6404700] video:0kB audio:774kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
size=N/A time=00:00:50.00 bitrate=N/A speed= 1.1x    
ffmpeg version N-110439-g5617465916 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  6.100 / 58.  6.100
  libavcodec     60. 10.100 / 60. 10.100
  libavformat    60.  5.100 / 60.  5.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  7.100 /  9.  7.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
[ogg @ 0x561a93ba87c0] 1 bytes of comment header remain
Input #0, ogg, from 'http://stream.alandsradio.ax/stream.ogg':
  Metadata:
    icy-pub         : 0
  Duration: N/A, start: 9007711.029292, bitrate: N/A
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
[segment @ 0x561a93c0c2c0] Opening 'test-record-2023-05-02T054508+0300-no-reset-copyts.opus' for writing
Output #0, segment, to 'test-record-%FT%H%M%S%z-no-reset-copyts.opus':
  Metadata:
    icy-pub         : 0
    encoder         : Lavf60.5.100
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[segment @ 0x561a93c0c2c0] Opening 'test-record-2023-05-02T054524+0300-no-reset-copyts.opus' for writing
[segment @ 0x561a93c0c2c0] Opening 'test-record-2023-05-02T054545+0300-no-reset-copyts.opus' for writing
[out#0/segment @ 0x561a93c0b580] video:0kB audio:763kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
size=N/A time=00:00:50.00 bitrate=N/A speed=1.09x    
ffmpeg version N-110439-g5617465916 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  6.100 / 58.  6.100
  libavcodec     60. 10.100 / 60. 10.100
  libavformat    60.  5.100 / 60.  5.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  7.100 /  9.  7.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
[ogg @ 0x55cbfa08a600] 1 bytes of comment header remain
Input #0, ogg, from 'http://stream.alandsradio.ax/stream.ogg':
  Metadata:
    icy-pub         : 0
  Duration: N/A, start: 9007757.809292, bitrate: N/A
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Output #0, opus, to 'test-record-no-segments-copyts.opus':
  Metadata:
    icy-pub         : 0
    encoder         : Lavf60.5.100
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      icy-pub         : 0
      encoder         : Lavf60.5.100
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[out#0/opus @ 0x55cbfa0ed500] video:0kB audio:316kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.842010%
size=     318kB time=00:00:20.00 bitrate= 130.4kbits/s speed=1.27x    
ffmpeg version N-110439-g5617465916 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  6.100 / 58.  6.100
  libavcodec     60. 10.100 / 60. 10.100
  libavformat    60.  5.100 / 60.  5.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  7.100 /  9.  7.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
[ogg @ 0x55d786ef85c0] 1 bytes of comment header remain
Input #0, ogg, from 'http://stream.alandsradio.ax/stream.ogg':
  Metadata:
    icy-pub         : 0
  Duration: N/A, start: 9007774.149292, bitrate: N/A
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Output #0, opus, to 'test-record-no-segments.opus':
  Metadata:
    icy-pub         : 0
    encoder         : Lavf60.5.100
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      icy-pub         : 0
      encoder         : Lavf60.5.100
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[out#0/opus @ 0x55d786f5b480] video:0kB audio:281kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.938108%
size=     284kB time=00:00:19.99 bitrate= 116.3kbits/s speed=1.29x




More information about the ffmpeg-user mailing list