Exception after importing multiple tracks #293

Open
opened 2025-08-14 14:45:45 +01:00 by kae · 1 comment
Owner

Looks to be when replacing an existing track.

File "/home/kae/mm/app/file_importer.py", line 670, in run
    618  def run(self) -> None:
 (...)
    666                  log.error(f"Unable to retrieve {self.track_id=}")
    667                  return
    668          session.commit()
    669  
--> 670          helpers.normalise_track(self.destination_track_path)
    671  
    ..................................................
     self = <DoTrackImport(id=0x7f5280db9630, import_file_path=/home/kae
             /music/Singles/tmp/Streets of London - Ralph McTell.mp3
     log.error = <method 'Logger.error' of <Logger musicmuster (DEBUG)> __ini
                  t__.py:1541>
     self.track_id = 3458
     session.commit = <method 'Session.commit' of <sqlalchemy.orm.session.Session 
                       object at 0x7f5211bc8e60> session.py:1996>
     helpers.normalise_track = <function 'normalise_track' helpers.py:302>
     self.destination_track_path = '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Street
                                    s of London.flac'
    ..................................................

File "/home/kae/mm/app/helpers.py", line 313, in normalise_track
    302  def normalise_track(path: str) -> None:
 (...)
    309              f"helpers.normalise_track({path}): " f"File type {ftype} not implemented"
    310          )
    311  
    312      bitrate = mediainfo(path)["bit_rate"]
--> 313      audio = get_audio_segment(path)
    314      if not audio:
    ..................................................
     path = '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Street
             s of London.flac'
     ftype = 'flac'
     bitrate = '320442'
    ..................................................

File "/home/kae/mm/app/helpers.py", line 101, in get_audio_segment
    96   def get_audio_segment(path: str) -> Optional[AudioSegment]:
    97       try:
    98           if path.endswith(".mp3"):
    99               return AudioSegment.from_mp3(path)
    100          elif path.endswith(".flac"):
--> 101              return AudioSegment.from_file(path, "flac")  # type: ignore
    102      except AttributeError:
    ..................................................
     path = '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Street
             s of London.flac'
    ..................................................

File "/home/kae/mm/.venv/lib/python3.13/site-packages/pydub/audio_segment.py", line 773, in from_file
    645  def from_file(cls, file, format=None, codec=None, parameters=None, start_second=None, duration=None, **kwargs):
 (...)
    769  
    770      if p.returncode != 0 or len(p_out) == 0:
    771          if close_file:
    772              file.close()
--> 773          raise CouldntDecodeError(
    774              "Decoding failed. ffmpeg returned error code: {0}\n\nOutput from ffmpeg/avlib:\n\n{1}".format(
    ..................................................
     file = <_io.BufferedReader name='/home/kae/music/Various/40 Hits 19
             70 - 1974 CD 2/06. Streets of London.flac'>
     format = 'flac'
     codec = None
     parameters = None
     start_second = None
     duration = None
     kwargs = {}
     p.returncode = 183
     p_out = b''
     close_file = True
    ..................................................

---- (full traceback above) ----
File "/home/kae/mm/app/file_importer.py", line 670, in run
    helpers.normalise_track(self.destination_track_path)
File "/home/kae/mm/app/helpers.py", line 313, in normalise_track
    audio = get_audio_segment(path)
File "/home/kae/mm/app/helpers.py", line 101, in get_audio_segment
    return AudioSegment.from_file(path, "flac")  # type: ignore
File "/home/kae/mm/.venv/lib/python3.13/site-packages/pydub/audio_segment.py", line 773, in from_file
    raise CouldntDecodeError(

CouldntDecodeError: Decoding failed. ffmpeg returned error code: 183

Output from ffmpeg/avlib:

ffmpeg version 7.1.1-1+b1 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 14 (Debian 14.2.0-19)
  configuration: --prefix=/usr --extra-version=1+b1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.101 / 61. 19.101
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
[flac @ 0x55fb2b6a6180] Could not find codec parameters for stream 0 (Audio: flac, 0 channels): unspecified sample format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, flac, from '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Streets of London.flac':
  Metadata:
    title           : Streets of London
    artist          : Ralph McTell
    track           : 1/12
    album           : Streets...
    disc            : 1/1
    genre           : Country/Folk/Rock
    TMED            : CD
    TORY            : 1979
    MusicBrainz Release Track Id: 7ab7003f-39dc-4db4-b1ea-0df95f47005f
    album_artist    : Ralph McTell
    SCRIPT          : Latn
    TSO2            : McTell, Ralph
    artist-sort     : McTell, Ralph
    originalyear    : 1979
    ARTISTS         : Ralph McTell
    BARCODE         : 4009910476420
    CATALOGNUMBER   : REP 4764-WG
    publisher       : Repertoire Records (UK) Ltd.
    MusicBrainz Album Type: album
    MusicBrainz Album Status: official
    Acoustid Id     : 1a9117d5-72d1-43f8-8b48-9123d03d2c66
    MusicBrainz Album Id: 773518ff-f67e-4842-bea7-38d99c2b10d3
    MusicBrainz Artist Id: 8bf5abde-89d0-4676-98ef-7e1a4eecd03d
    MusicBrainz Album Artist Id: 8bf5abde-89d0-4676-98ef-7e1a4eecd03d
    MusicBrainz Release Group Id: a80951c0-caf8-4b30-951a-90747e7998ee
    date            : 1999
  Duration: N/A, bitrate: N/A
  Stream #0:0: Audio: flac, 0 channels
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Cannot determine format of input 0:0 after EOF
[af#0:0 @ 0x55fb2b6b4840] Task finished with error code: -1094995529 (Invalid data found when processing input)
[af#0:0 @ 0x55fb2b6b4840] Terminating thread with return code -1094995529 (Invalid data found when processing input)
[aost#0:0/pcm_s16le @ 0x55fb2b6b4340] Could not open encoder before EOF
[aost#0:0/pcm_s16le @ 0x55fb2b6b4340] Task finished with error code: -22 (Invalid argument)
[aost#0:0/pcm_s16le @ 0x55fb2b6b4340] Terminating thread with return code -22 (Invalid argument)
[out#0/wav @ 0x55fb2b6af2c0] Nothing was written into output file, because at least one of its streams received no packets.
size=       0KiB time=N/A bitrate=N/A speed=N/A    
Conversion failed!
Looks to be when replacing an existing track. ``` File "/home/kae/mm/app/file_importer.py", line 670, in run 618 def run(self) -> None: (...) 666 log.error(f"Unable to retrieve {self.track_id=}") 667 return 668 session.commit() 669 --> 670 helpers.normalise_track(self.destination_track_path) 671 .................................................. self = <DoTrackImport(id=0x7f5280db9630, import_file_path=/home/kae /music/Singles/tmp/Streets of London - Ralph McTell.mp3 log.error = <method 'Logger.error' of <Logger musicmuster (DEBUG)> __ini t__.py:1541> self.track_id = 3458 session.commit = <method 'Session.commit' of <sqlalchemy.orm.session.Session object at 0x7f5211bc8e60> session.py:1996> helpers.normalise_track = <function 'normalise_track' helpers.py:302> self.destination_track_path = '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Street s of London.flac' .................................................. File "/home/kae/mm/app/helpers.py", line 313, in normalise_track 302 def normalise_track(path: str) -> None: (...) 309 f"helpers.normalise_track({path}): " f"File type {ftype} not implemented" 310 ) 311 312 bitrate = mediainfo(path)["bit_rate"] --> 313 audio = get_audio_segment(path) 314 if not audio: .................................................. path = '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Street s of London.flac' ftype = 'flac' bitrate = '320442' .................................................. File "/home/kae/mm/app/helpers.py", line 101, in get_audio_segment 96 def get_audio_segment(path: str) -> Optional[AudioSegment]: 97 try: 98 if path.endswith(".mp3"): 99 return AudioSegment.from_mp3(path) 100 elif path.endswith(".flac"): --> 101 return AudioSegment.from_file(path, "flac") # type: ignore 102 except AttributeError: .................................................. path = '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Street s of London.flac' .................................................. File "/home/kae/mm/.venv/lib/python3.13/site-packages/pydub/audio_segment.py", line 773, in from_file 645 def from_file(cls, file, format=None, codec=None, parameters=None, start_second=None, duration=None, **kwargs): (...) 769 770 if p.returncode != 0 or len(p_out) == 0: 771 if close_file: 772 file.close() --> 773 raise CouldntDecodeError( 774 "Decoding failed. ffmpeg returned error code: {0}\n\nOutput from ffmpeg/avlib:\n\n{1}".format( .................................................. file = <_io.BufferedReader name='/home/kae/music/Various/40 Hits 19 70 - 1974 CD 2/06. Streets of London.flac'> format = 'flac' codec = None parameters = None start_second = None duration = None kwargs = {} p.returncode = 183 p_out = b'' close_file = True .................................................. ---- (full traceback above) ---- File "/home/kae/mm/app/file_importer.py", line 670, in run helpers.normalise_track(self.destination_track_path) File "/home/kae/mm/app/helpers.py", line 313, in normalise_track audio = get_audio_segment(path) File "/home/kae/mm/app/helpers.py", line 101, in get_audio_segment return AudioSegment.from_file(path, "flac") # type: ignore File "/home/kae/mm/.venv/lib/python3.13/site-packages/pydub/audio_segment.py", line 773, in from_file raise CouldntDecodeError( CouldntDecodeError: Decoding failed. ffmpeg returned error code: 183 Output from ffmpeg/avlib: ffmpeg version 7.1.1-1+b1 Copyright (c) 2000-2025 the FFmpeg developers built with gcc 14 (Debian 14.2.0-19) configuration: --prefix=/usr --extra-version=1+b1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared libavutil 59. 39.100 / 59. 39.100 libavcodec 61. 19.101 / 61. 19.101 libavformat 61. 7.100 / 61. 7.100 libavdevice 61. 3.100 / 61. 3.100 libavfilter 10. 4.100 / 10. 4.100 libswscale 8. 3.100 / 8. 3.100 libswresample 5. 3.100 / 5. 3.100 libpostproc 58. 3.100 / 58. 3.100 [flac @ 0x55fb2b6a6180] Could not find codec parameters for stream 0 (Audio: flac, 0 channels): unspecified sample format Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options Input #0, flac, from '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Streets of London.flac': Metadata: title : Streets of London artist : Ralph McTell track : 1/12 album : Streets... disc : 1/1 genre : Country/Folk/Rock TMED : CD TORY : 1979 MusicBrainz Release Track Id: 7ab7003f-39dc-4db4-b1ea-0df95f47005f album_artist : Ralph McTell SCRIPT : Latn TSO2 : McTell, Ralph artist-sort : McTell, Ralph originalyear : 1979 ARTISTS : Ralph McTell BARCODE : 4009910476420 CATALOGNUMBER : REP 4764-WG publisher : Repertoire Records (UK) Ltd. MusicBrainz Album Type: album MusicBrainz Album Status: official Acoustid Id : 1a9117d5-72d1-43f8-8b48-9123d03d2c66 MusicBrainz Album Id: 773518ff-f67e-4842-bea7-38d99c2b10d3 MusicBrainz Artist Id: 8bf5abde-89d0-4676-98ef-7e1a4eecd03d MusicBrainz Album Artist Id: 8bf5abde-89d0-4676-98ef-7e1a4eecd03d MusicBrainz Release Group Id: a80951c0-caf8-4b30-951a-90747e7998ee date : 1999 Duration: N/A, bitrate: N/A Stream #0:0: Audio: flac, 0 channels Stream mapping: Stream #0:0 -> #0:0 (flac (native) -> pcm_s16le (native)) Press [q] to stop, [?] for help Cannot determine format of input 0:0 after EOF [af#0:0 @ 0x55fb2b6b4840] Task finished with error code: -1094995529 (Invalid data found when processing input) [af#0:0 @ 0x55fb2b6b4840] Terminating thread with return code -1094995529 (Invalid data found when processing input) [aost#0:0/pcm_s16le @ 0x55fb2b6b4340] Could not open encoder before EOF [aost#0:0/pcm_s16le @ 0x55fb2b6b4340] Task finished with error code: -22 (Invalid argument) [aost#0:0/pcm_s16le @ 0x55fb2b6b4340] Terminating thread with return code -22 (Invalid argument) [out#0/wav @ 0x55fb2b6af2c0] Nothing was written into output file, because at least one of its streams received no packets. size= 0KiB time=N/A bitrate=N/A speed=N/A Conversion failed! ```
Author
Owner

This too:

File "/home/kae/mm/./app/musicmuster.py", line 2285, in preview
    2257  def preview(self) -> None:
 (...)
    2281              if not track:
    2282                  raise ApplicationError(
    2283                      f"musicmuster.preview: unable to retreive track {track_info.track_id=}"
    2284                  )
--> 2285              self.preview_manager.set_track_info(
    2286                  track_id=track.id,
    ..................................................
     self = <__main__.Window object at 0x7fb1203a5630>
     track = <Track(id=3458, title=Streets of London, artist=Ralph McTell
              , path=/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. 
              Streets of London.flac>
     track_info.track_id = 3458
     self.preview_manager.set_track_info = <method 'PreviewManager.set_track_info' of <__main__.Preview
                                            Manager object at 0x7fb0fc70aba0> musicmuster.py:771>
     track.id = 3458
    ..................................................

File "/home/kae/mm/./app/musicmuster.py", line 780, in set_track_info
    771  def set_track_info(self, track_id: int, track_intro: int, track_path: str) -> None:
 (...)
    776      # Check file readable
    777      if file_is_unreadable(self.path):
    778          raise ValueError(f"PreviewManager.__init__: {track_path=} unreadable")
    779  
--> 780      mixer.music.load(self.path)
    ..................................................
     self = <__main__.PreviewManager object at 0x7fb0fc70aba0>
     track_id = 3458
     track_intro = None
     track_path = '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Street
                   s of London.flac'
     self.path = '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Street
                  s of London.flac'
    ..................................................

error: FLAC__stream_decoder_process_until_end_of_metadata() failed
This too: ``` File "/home/kae/mm/./app/musicmuster.py", line 2285, in preview 2257 def preview(self) -> None: (...) 2281 if not track: 2282 raise ApplicationError( 2283 f"musicmuster.preview: unable to retreive track {track_info.track_id=}" 2284 ) --> 2285 self.preview_manager.set_track_info( 2286 track_id=track.id, .................................................. self = <__main__.Window object at 0x7fb1203a5630> track = <Track(id=3458, title=Streets of London, artist=Ralph McTell , path=/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Streets of London.flac> track_info.track_id = 3458 self.preview_manager.set_track_info = <method 'PreviewManager.set_track_info' of <__main__.Preview Manager object at 0x7fb0fc70aba0> musicmuster.py:771> track.id = 3458 .................................................. File "/home/kae/mm/./app/musicmuster.py", line 780, in set_track_info 771 def set_track_info(self, track_id: int, track_intro: int, track_path: str) -> None: (...) 776 # Check file readable 777 if file_is_unreadable(self.path): 778 raise ValueError(f"PreviewManager.__init__: {track_path=} unreadable") 779 --> 780 mixer.music.load(self.path) .................................................. self = <__main__.PreviewManager object at 0x7fb0fc70aba0> track_id = 3458 track_intro = None track_path = '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Street s of London.flac' self.path = '/home/kae/music/Various/40 Hits 1970 - 1974 CD 2/06. Street s of London.flac' .................................................. error: FLAC__stream_decoder_process_until_end_of_metadata() failed ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: kae/musicmuster#293
No description provided.