beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.84k stars 1.82k forks source link

Every import and convert attempt ends with "can't sync to MPEG frame" #3392

Closed ghost closed 4 years ago

ghost commented 5 years ago

Problem

Any attempt at converting .flac > .mp3 fails with same error in title.

$ beet -vv (... import ~/mnt/Dump/Deezer/Toxic\ Holocaust/ ...)

Led to this problem:

beet -vv import /mnt/Dump/Deezer/Toxic\ Holocaust/
user configuration: /home/james/.config/beets/config.yaml
data directory: /home/james/.config/beets
plugin paths: 
Sending event: pluginload
lyrics: Disabling google source: no API key configured.
lyrics: The Genius backend requires BeautifulSoup, which is not installed, so the source is disabled.
library database: /home/james/Music/Library/library.db
library directory: /home/james/Music/Library
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
Looking up: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019
Tagging Toxic Holocaust - Primal Future: 2019
No album ID found.
Search terms: Toxic Holocaust - Primal Future: 2019
Album might be VA: False
Searching for MusicBrainz releases with: {'release': 'primal future: 2019', 'artist': 'toxic holocaust', 'tracks': '10'}
Requesting MusicBrainz release 0cf6a713-f9e9-42d1-9a75-f981d69ce054
primary MB release type: album
Sending event: albuminfo_received
Candidate: Toxic Holocaust - Primal Future: 2019 (0cf6a713-f9e9-42d1-9a75-f981d69ce054)
Computing track assignment...
...done.
Success. Distance: 0.00
Requesting MusicBrainz release 55cab285-dcce-4315-8a4e-c54cefe39ade
primary MB release type: album
Sending event: albuminfo_received
Candidate: Holocaust - Primal (55cab285-dcce-4315-8a4e-c54cefe39ade)
Computing track assignment...
...done.
Success. Distance: 0.60
Requesting MusicBrainz release f4c28cc5-4ba7-4a84-9d35-8549d942b2e0
primary MB release type: album
Sending event: albuminfo_received
Candidate: Toxic Holocaust - Conjure and Command (f4c28cc5-4ba7-4a84-9d35-8549d942b2e0)
Computing track assignment...
...done.
Success. Distance: 0.64
Requesting MusicBrainz release 61cc7e12-ac17-4389-8741-37388eb191d6
primary MB release type: album
secondary MB release type(s): compilation
Sending event: albuminfo_received
Candidate: Toxic Holocaust - Toxic Thrash Metal (61cc7e12-ac17-4389-8741-37388eb191d6)
Computing track assignment...
...done.
Success. Distance: 0.63
Requesting MusicBrainz release 9524d514-e72d-4fe8-a0c4-ea9673515397
primary MB release type: album
Sending event: albuminfo_received
Candidate: Toxic Holocaust - Conjure and Command (9524d514-e72d-4fe8-a0c4-ea9673515397)
Computing track assignment...
...done.
Success. Distance: 0.64
Evaluating 5 candidates.

/mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019 (10 items)
Sending event: before_choose_candidate
Tagging:
    Toxic Holocaust - Primal Future: 2019
URL:
    https://musicbrainz.org/release/0cf6a713-f9e9-42d1-9a75-f981d69ce054
(Similarity: 100.0%) (Digital Media, 2019, XW)
 * Black Out The Code   -> Black Out the Code
 * Deafened By The Roar -> Deafened by the Roar
 * Controlled By Fear   -> Controlled by Fear
Sending event: import_task_choice
Sending event: import_task_apply
Replacing item 5574: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/1 - Chemical Warlords.flac
Sending event: database_change
Sending event: item_removed
Replacing item 5575: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/10 - Cybernetic War.flac
Sending event: database_change
Sending event: item_removed
Replacing item 5576: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/2 - Black Out The Code.flac
Sending event: database_change
Sending event: item_removed
Replacing item 5577: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/3 - New World Beyond.flac
Sending event: database_change
Sending event: item_removed
Replacing item 5578: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/4 - Deafened By The Roar.flac
Sending event: database_change
Sending event: item_removed
Replacing item 5579: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/5 - Time's Edge.flac
Sending event: database_change
Sending event: item_removed
Replacing item 5580: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/6 - Primal Future.flac
Sending event: database_change
Sending event: item_removed
Replacing item 5581: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/7 - Iron Cage.flac
Sending event: database_change
Sending event: item_removed
Replacing item 5582: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/8 - Controlled By Fear.flac
Sending event: database_change
Sending event: item_removed
Replacing item 5583: /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/9 - Aftermath.flac
Sending event: database_change
Sending event: database_change
Sending event: item_removed
10 of 10 items replaced
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Reimported album: added 1570237927.1137555, flexible attributes dict_keys([]) from album 435 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019
Reimported item added 1570237927.1181753 from item 5574 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/1 - Chemical Warlords.flac
Reimported item flexible attributes dict_keys(['data_source', 'track_alt']) from item 5574 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/1 - Chemical Warlords.flac
Sending event: database_change
Reimported item added 1570237927.1193845 from item 5575 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/10 - Cybernetic War.flac
Reimported item flexible attributes dict_keys(['data_source', 'track_alt']) from item 5575 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/10 - Cybernetic War.flac
Sending event: database_change
Reimported item added 1570237927.1204114 from item 5576 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/2 - Black Out The Code.flac
Reimported item flexible attributes dict_keys(['data_source', 'track_alt']) from item 5576 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/2 - Black Out The Code.flac
Sending event: database_change
Reimported item added 1570237927.1215248 from item 5577 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/3 - New World Beyond.flac
Reimported item flexible attributes dict_keys(['data_source', 'track_alt']) from item 5577 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/3 - New World Beyond.flac
Sending event: database_change
Reimported item added 1570237927.122511 from item 5578 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/4 - Deafened By The Roar.flac
Reimported item flexible attributes dict_keys(['data_source', 'track_alt']) from item 5578 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/4 - Deafened By The Roar.flac
Sending event: database_change
Reimported item added 1570237927.123498 from item 5579 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/5 - Time's Edge.flac
Reimported item flexible attributes dict_keys(['data_source', 'track_alt']) from item 5579 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/5 - Time's Edge.flac
Sending event: database_change
Reimported item added 1570237927.1244776 from item 5580 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/6 - Primal Future.flac
Reimported item flexible attributes dict_keys(['data_source', 'track_alt']) from item 5580 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/6 - Primal Future.flac
Sending event: database_change
Reimported item added 1570237927.1255224 from item 5581 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/7 - Iron Cage.flac
Reimported item flexible attributes dict_keys(['data_source', 'track_alt']) from item 5581 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/7 - Iron Cage.flac
Sending event: database_change
Reimported item added 1570237927.1265378 from item 5582 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/8 - Controlled By Fear.flac
Reimported item flexible attributes dict_keys(['data_source', 'track_alt']) from item 5582 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/8 - Controlled By Fear.flac
Sending event: database_change
Reimported item added 1570237927.1276474 from item 5583 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/9 - Aftermath.flac
Reimported item flexible attributes dict_keys(['data_source', 'track_alt']) from item 5583 for /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/9 - Aftermath.flac
Sending event: database_change
convert: Encoding /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/1 - Chemical Warlords.flac
convert: Finished encoding /mnt/Dump/Deezer/Toxic Holocaust/Primal Future_ 2019/1 - Chemical Warlords.flac
Sending event: write
open failed: can't sync to MPEG frame
Traceback (most recent call last):
  File "/usr/share/beets/beets/mediafile.py", line 129, in mutagen_call
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/mutagen/_util.py", line 148, in wrapper_func
    return func(h, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/mutagen/_file.py", line 297, in File
    return Kind(fileobj, filename=filething.filename)
  File "/usr/lib/python3/dist-packages/mutagen/_file.py", line 49, in __init__
    self.load(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/mutagen/_util.py", line 140, in wrapper
    return func(self, h, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/mutagen/id3/_file.py", line 406, in load
    self.info = self._Info(fileobj, offset)
  File "/usr/lib/python3/dist-packages/mutagen/_util.py", line 169, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/mutagen/mp3/__init__.py", line 403, in __init__
    raise HeaderNotFoundError("can't sync to MPEG frame")
mutagen.mp3.HeaderNotFoundError: can't sync to MPEG frame

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/beets/beets/library.py", line 642, in write
    id3v23=beets.config['id3v23'].get(bool))
  File "/usr/share/beets/beets/mediafile.py", line 1447, in __init__
    self.mgfile = mutagen_call('open', path, mutagen.File, path)
  File "/usr/share/beets/beets/mediafile.py", line 132, in mutagen_call
    raise UnreadableFileError(path, six.text_type(exc))
beets.mediafile.UnreadableFileError: can't sync to MPEG frame

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/beets/beets/ui/__init__.py", line 1256, in main
    _raw_main(args)
  File "/usr/share/beets/beets/ui/__init__.py", line 1243, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/share/beets/beets/ui/commands.py", line 943, in import_func
    import_files(lib, paths, query)
  File "/usr/share/beets/beets/ui/commands.py", line 913, in import_files
    session.run()
  File "/usr/share/beets/beets/importer.py", line 329, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/share/beets/beets/util/pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
    raise value
  File "/usr/share/beets/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
  File "/usr/share/beets/beets/util/pipeline.py", line 194, in coro
    func(*(args + (task,)))
  File "/usr/share/beets/beets/importer.py", line 1511, in plugin_stage
    func(session, task)
  File "/usr/share/beets/beets/plugins.py", line 140, in wrapper
    return func(*args, **kwargs)
  File "/usr/share/beets/beetsplug/convert.py", line 176, in auto_convert
    self.convert_on_import(config.lib, item)
  File "/usr/share/beets/beetsplug/convert.py", line 481, in convert_on_import
    item.write()
  File "/usr/share/beets/beets/library.py", line 644, in write
    raise ReadError(path, exc)
beets.library.ReadError: error reading /tmp/tmpubjuca1z.mp3: can't sync to MPEG frame

error reading /tmp/tmpubjuca1z.mp3: can't sync to MPEG frame

Setup

My configuration (output of beet config) is:

### Config

directory: /home/james/Music/Library
library: /home/james/Music/Library/library.db

paths:
    default: $albumartist/($original_year) $album/$track - $title
    comp: Various Artists/($original_year) $album/$track - $title
    singleton: Singles/$albumartist/($original_year) $album/$track - $title

## Import Options
import:
    copy: no
    move: yes
    write: yes
    incremental: yes
    autotag: yes

## Autotag Options
# Matching Thresh
match: 
    strong_rec_thresh: 0.10

original_date: yes

## Plugins
plugins: convert fetchart embedart lyrics ftintitle

embedart:
    auto: yes
    ifempty: yes

lyrics:
    sources: lyricwiki musixmatch
    force: yes

# Covert .xyz > .mp3
convert:
    format: mp3
    auto: yes
    never_covert_lossy_files: yes
    copy_album_art: yes
    embed: yes
    no_convert: path::\.(m4a|mp3|ogg|opus|wma)
sampsyo commented 5 years ago

That's odd! I'm not sure what to investigate here—can you check whether any of those files seem to be valid MP3s? Maybe something went wrong in the ffmpeg conversion?

ghost commented 5 years ago

They're all good, working files. Got one of the albums on my phone as a .flac and they work just fine but converting to .mp3 gives me this error every time with every possible song

sampsyo commented 5 years ago

Sorry, I meant the converted files—the MP3s, not your original FLACs.

ghost commented 5 years ago

They don't convert, it just throws this error right after importing

sampsyo commented 5 years ago

Notice the final error message:

error reading /tmp/tmpubjuca1z.mp3: can't sync to MPEG frame

Those temporary MP3s are the result of conversion.

stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

slyfoxgh commented 8 months ago

Notice the final error message:

error reading /tmp/tmpubjuca1z.mp3: can't sync to MPEG frame

Those temporary MP3s are the result of conversion.

Did you ever figure this out? I have the same error.