Skip to content

opusenc: failing on a flac with ID3v2 #106

Description

@xolli
opusenc version

➜  ~ opusenc --version
opusenc opus-tools 0.2 (using libopus 1.6.1)
Copyright (C) 2008-2018 Xiph.Org Foundation

I know that the flac format does not support ID3v2 tags, but there are several tracks in my music library that have the ID3v2 tag added to them (judging by the flac -t output)

It may not be the reason for an issue, but it is the result of my investigation

opusenc fails with the error Error: unsupported input file when attempting to encode it when I try to convert it

~ opusenc /tmp/test.flac /tmp/test.opus                          
Error: unsupported input file: /tmp/test.flac
➜  ~ 

I removed all possible tags in Kid3: no tags, no cover picture

Kid3 screenshot

Image

The metainfo about the problem file

Details

~ mediainfo --Full /tmp/test.flac
General
Count                                    : 360
Count of stream of this kind             : 1
Kind of stream                           : General
Kind of stream                           : General
Stream identifier                        : 0
Count of audio streams                   : 1
Audio_Format_List                        : FLAC
Audio_Format_WithHint_List               : FLAC
Audio codecs                             : FLAC
Audio_Channels_Total                     : 2
Complete name                            : /tmp/test.flac
Folder name                              : /tmp
File name extension                      : test.flac
File name                                : test
File extension                           : flac
Format                                   : FLAC
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Format/Url                               : https://xiph.org/flac/
Format/Extensions usually used           : fla flac
Commercial name                          : FLAC
Internet media type                      : audio/x-flac
File size                                : 14465854
File size                                : 13.8 MiB
File size                                : 14 MiB
File size                                : 14 MiB
File size                                : 13.8 MiB
File size                                : 13.80 MiB
Duration                                 : 173547
Duration                                 : 2 min 53 s
Duration                                 : 2 min 53 s 547 ms
Duration                                 : 2 min 53 s
Duration                                 : 00:02:53.547
Duration                                 : 00:02:53.547
Overall bit rate mode                    : VBR
Overall bit rate mode                    : Variable
Overall bit rate                         : 666833
Overall bit rate                         : 667 kb/s
Stream size                              : 4636
Stream size                              : 4.53 KiB (0%)
Stream size                              : 5 KiB
Stream size                              : 4.5 KiB
Stream size                              : 4.53 KiB
Stream size                              : 4.527 KiB
Stream size                              : 4.53 KiB (0%)
Proportion of this stream                : 0.00032
Title                                    : Flaws
Album                                    : Life is Strange : Before the Storm - Original Soundtrack
Part/Position                            : 1
Part/Total                               : 1
Track name                               : Flaws
Track name/Position                      : 01
Track name/Total                         : 15
Performer                                : Daughter
Encoded by                               : Exact Audio Copy   (??????????? ?????)
File last modification date              : 2026-04-24 15:29:19 UTC
File last modification date (local)      : 2026-04-24 19:29:19
Writing library                          : flac.exe -V -8 -T "Genre=" -T "Artist=Daughter" -T "Title=Flaws" -T "Album=Life is Strange : Before the Storm - Original Soundtrack" -T "Date=" -T "Tracknumber=01" -T "Comment="
Writing library                          : flac.exe -V -8 -T "Genre=" -T "Artist=Daughter" -T "Title=Flaws" -T "Album=Life is Strange : Before the Storm - Original Soundtrack" -T "Date=" -T "Tracknumber=01" -T "Comment="
MCDI                                     : Yes

Audio
Count                                    : 286
Count of stream of this kind             : 1
Kind of stream                           : Audio
Kind of stream                           : Audio
Stream identifier                        : 0
Format                                   : FLAC
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Format/Url                               : https://xiph.org/flac/
Commercial name                          : FLAC
Internet media type                      : audio/x-flac
Duration                                 : 173547
Duration                                 : 2 min 53 s
Duration                                 : 2 min 53 s 547 ms
Duration                                 : 2 min 53 s
Duration                                 : 00:02:53.547
Duration                                 : 00:02:53.547
Bit rate mode                            : VBR
Bit rate mode                            : Variable
Bit rate                                 : 666600
Bit rate                                 : 667 kb/s
Channel(s)                               : 2
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Channel positions                        : 2/0/0
Channel layout                           : L R
Sampling rate                            : 44100
Sampling rate                            : 44.1 kHz
Samples count                            : 7653408
Bit depth                                : 16
Bit depth                                : 16 bits
Compression mode                         : Lossless
Compression mode                         : Lossless
Stream size                              : 14460804
Stream size                              : 13.8 MiB (100%)
Stream size                              : 14 MiB
Stream size                              : 14 MiB
Stream size                              : 13.8 MiB
Stream size                              : 13.79 MiB
Stream size                              : 13.8 MiB (100%)
Proportion of this stream                : 0.99965
Writing library                          : reference libFLAC 1.3.2 20170101
Writing library                          : libFLAC 1.3.2 (2017-01-01)
Encoded_Library_Name                     : libFLAC
Encoded_Library_Version                  : 1.3.2
Encoded_Library_Date                     : 2017-01-01
MD5 of the unencoded content             : 60E1E691CF6573358C47027621EF8597

➜  ~ metaflac --list /tmp/test.flac
METADATA block #0
  type: 0 (STREAMINFO)
  is last: false
  length: 34
  minimum blocksize: 4096 samples
  maximum blocksize: 4096 samples
  minimum framesize: 1174 bytes
  maximum framesize: 11884 bytes
  sample_rate: 44100 Hz
  channels: 2
  bits-per-sample: 16
  total samples: 7653408
  MD5 signature: 60e1e691cf6573358c47027621ef8597
METADATA block #1
  type: 3 (SEEKTABLE)
  is last: false
  length: 324
  seek points: 18
    point 0: sample_number=0, stream_offset=0, frame_samples=4096
    point 1: sample_number=438272, stream_offset=405004, frame_samples=4096
    point 2: sample_number=880640, stream_offset=852944, frame_samples=4096
    point 3: sample_number=1318912, stream_offset=1324866, frame_samples=4096
    point 4: sample_number=1761280, stream_offset=1820210, frame_samples=4096
    point 5: sample_number=2203648, stream_offset=2366129, frame_samples=4096
    point 6: sample_number=2641920, stream_offset=3001286, frame_samples=4096
    point 7: sample_number=3084288, stream_offset=3955220, frame_samples=4096
    point 8: sample_number=3526656, stream_offset=5165623, frame_samples=4096
    point 9: sample_number=3964928, stream_offset=6358318, frame_samples=4096
    point 10: sample_number=4407296, stream_offset=7567070, frame_samples=4096
    point 11: sample_number=4849664, stream_offset=8769430, frame_samples=4096
    point 12: sample_number=5287936, stream_offset=9700595, frame_samples=4096
    point 13: sample_number=5730304, stream_offset=10665887, frame_samples=4096
    point 14: sample_number=6172672, stream_offset=11728059, frame_samples=4096
    point 15: sample_number=6610944, stream_offset=12799685, frame_samples=4096
    point 16: sample_number=7053312, stream_offset=13861345, frame_samples=4096
    point 17: sample_number=7495680, stream_offset=14381778, frame_samples=4096
METADATA block #2
  type: 4 (VORBIS_COMMENT)
  is last: true
  length: 40
  vendor string: reference libFLAC 1.3.2 20170101
  comments: 0

➜  ~ flac -t /tmp/test.flac        

flac 1.5.0
Copyright (C) 2000-2009  Josh Coalson, 2011-2025  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

test.flac: WARNING, ID3v2 tag found. This is non-standard and strongly discouraged
test.flac: ok                    
➜  ~ 

Otherwise, this track is perfectly readable by all programs, and ffmpeg converts this file without errors or warnings

The same file with ffmpeg

~ ffmpeg -i /tmp/test.flac /tmp/output.opus
ffmpeg version n8.1 Copyright (c) 2000-2026 the FFmpeg developers
  built with gcc 15.2.1 (GCC) 20260209
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav --enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
  libavutil      60. 26.100 / 60. 26.100
  libavcodec     62. 28.100 / 62. 28.100
  libavformat    62. 12.100 / 62. 12.100
  libavdevice    62.  3.100 / 62.  3.100
  libavfilter    11. 14.100 / 11. 14.100
  libswscale      9.  5.100 /  9.  5.100
  libswresample   6.  3.100 /  6.  3.100
Input #0, flac, from '/tmp/test.flac':
  Metadata:
    title           : Flaws
    artist          : Daughter
    album           : Life is Strange : Before the Storm - Original Soundtrack
    disc            : 1/1
    track           : 01/15
    TLEN            : 173546
    encoded_by      : Exact Audio Copy   (??????????? ?????)
    encoder         : flac.exe -V -8 -T "Genre=" -T "Artist=Daughter" -T "Title=Flaws" -T "Album=Life is Strange : Before the Storm - Original Soundtrack" -T "Date=" -T "Tracknumber=01" -T "Comment="
  Duration: 00:02:53.55, start: 0.000000, bitrate: 666 kb/s
  Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> opus (libopus))
Press [q] to stop, [?] for help
[libopus @ 0x558e9599ef40] No bit rate set. Defaulting to 96000 bps.
Output #0, opus, to '/tmp/output.opus':
  Metadata:
    title           : Flaws
    artist          : Daughter
    album           : Life is Strange : Before the Storm - Original Soundtrack
    disc            : 1/1
    track           : 01/15
    TLEN            : 173546
    encoded_by      : Exact Audio Copy   (??????????? ?????)
    encoder         : Lavf62.12.100
  Stream #0:0: Audio: opus, 48000 Hz, stereo, s16, 96 kb/s
    Metadata:
      encoder         : Lavc62.28.100 libopus
      title           : Flaws
      artist          : Daughter
      album           : Life is Strange : Before the Storm - Original Soundtrack
      DISCNUMBER      : 1/1
      TRACKNUMBER     : 01/15
      TLEN            : 173546
      encoded_by      : Exact Audio Copy   (??????????? ?????)
[out#0/opus @ 0x558e959a30c0] video:0KiB audio:2117KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.762223%
size=    2133KiB time=00:02:53.54 bitrate= 100.7kbits/s speed= 177x elapsed=0:00:00.97    
➜  ~ 

If I rebuild this file with ffmpeg from flac to flac and then try to convert it with opusenc, I get no errors (I think ffmpeg strips the ID3v2 tag from a flac file)

Details

~ ffmpeg -i /tmp/test.flac /tmp/test_rebuild.flac          
ffmpeg version n8.1 Copyright (c) 2000-2026 the FFmpeg developers
  built with gcc 15.2.1 (GCC) 20260209
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav --enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
  libavutil      60. 26.100 / 60. 26.100
  libavcodec     62. 28.100 / 62. 28.100
  libavformat    62. 12.100 / 62. 12.100
  libavdevice    62.  3.100 / 62.  3.100
  libavfilter    11. 14.100 / 11. 14.100
  libswscale      9.  5.100 /  9.  5.100
  libswresample   6.  3.100 /  6.  3.100
Input #0, flac, from '/tmp/test.flac':
  Metadata:
    title           : Flaws
    artist          : Daughter
    album           : Life is Strange : Before the Storm - Original Soundtrack
    disc            : 1/1
    track           : 01/15
    TLEN            : 173546
    encoded_by      : Exact Audio Copy   (??????????? ?????)
    encoder         : flac.exe -V -8 -T "Genre=" -T "Artist=Daughter" -T "Title=Flaws" -T "Album=Life is Strange : Before the Storm - Original Soundtrack" -T "Date=" -T "Tracknumber=01" -T "Comment="
  Duration: 00:02:53.55, start: 0.000000, bitrate: 666 kb/s
  Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> flac (native))
Press [q] to stop, [?] for help
Output #0, flac, to '/tmp/test_rebuild.flac':
  Metadata:
    title           : Flaws
    artist          : Daughter
    album           : Life is Strange : Before the Storm - Original Soundtrack
    DISCNUMBER      : 1/1
    TRACKNUMBER     : 01/15
    TLEN            : 173546
    encoded_by      : Exact Audio Copy   (??????????? ?????)
    encoder         : Lavf62.12.100
  Stream #0:0: Audio: flac, 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      encoder         : Lavc62.28.100 flac
[out#0/flac @ 0x5570b8c770c0] video:0KiB audio:14089KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.058883%
size=   14097KiB time=00:02:53.54 bitrate= 665.4kbits/s speed=1.08e+03x elapsed=0:00:00.16    
➜  ~ opusenc /tmp/test_rebuild.flac /tmp/test_rebuild.opus
Encoding using libopus 1.6.1 (audio)
-----------------------------------------------------
   Input: 44.1 kHz, 2 channels
  Output: 2 channels (2 coupled)
          20ms packets, 96 kbit/s VBR
 Preskip: 312

Encoding complete                                
-----------------------------------------------------
       Encoded: 2 minutes and 53.56 seconds
       Runtime: 1 second
                (173.6x realtime)
         Wrote: 2185295 bytes, 8678 packets, 176 pages
       Bitrate: 99.9343 kbit/s (without overhead)
 Instant rates: 23.2 to 191.6 kbit/s
                (58 to 479 bytes per packet)
      Overhead: 0.788% (container+metadata)

➜  ~ mediainfo /tmp/test_rebuild.flac                     
General
Complete name                            : /tmp/test_rebuild.flac
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
File size                                : 13.8 MiB
Duration                                 : 2 min 53 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 665 kb/s
Title                                    : Flaws
Album                                    : Life is Strange : Before the Storm - Original Soundtrack
Part                                     : 1/1
Track name/Position                      : 01/15
Performer                                : Daughter
Writing application                      : Lavf62.12.100
TLEN                                     : 173546
encoded_by                               : Exact Audio Copy   (??????????? ?????)

Audio
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Duration                                 : 2 min 53 s
Bit rate mode                            : Variable
Bit rate                                 : 665 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Bit depth                                : 16 bits
Compression mode                         : Lossless
Stream size                              : 13.8 MiB (100%)
Writing library                          : Lavf62.12.100
MD5 of the unencoded content             : 60E1E691CF6573358C47027621EF8597


➜  ~ flac -t /tmp/test_rebuild.flac                 

flac 1.5.0
Copyright (C) 2000-2009  Josh Coalson, 2011-2025  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

test_rebuild.flac: ok                    
➜  ~ 

I have attached the original file that causes the crash (GitHub does not support the .flac files, I packed it into a zip)

test.flac.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions