beets icon indicating copy to clipboard operation
beets copied to clipboard

convert: WavPack can be either lossless or lossy

Open tzhao11 opened this issue 7 years ago • 1 comments

Problem

When convert: never_convert_lossy_files is set to yes, all WavPack files are copied instead of converted regardless of their losslessness, because currently convert treat wv files as lossy. It seems current logic is not sufficient to determine losslessness of WavPack files.

According to http://www.wavpack.com/wavpack_doc.html#wvunpack, wvunpack -f9 can be used to obtain the encoding mode of a wv file. Can we handle wv files correctly by checking MODE_LOSSLESS and MODE_HYBRID of it?

Setup

  • OS: Ubuntu 16.04.3 LTS (on Windows)
  • Python version: 3.6.4
  • beets version: 1.4.6

My configuration (output of beet config) is:

directory: ~/Music/Beets/Library
library: ~/Music/Beets/library.db
per_disc_numbering: yes

paths:
    default: $album%aunique{}/%if{$disctotal-1,,$disc-}$track $title
    comp: $album%aunique{}/%if{$disctotal-1,,$disc-}$track $title

ui:
    color: yes

import:
    write: yes
    copy: yes
    bell: yes

plugins: absubmit chroma convert embedart export fetchart fromfilename fuzzy info inline mbsubmit mbsync missing random web
absubmit:
    auto: no
    extractor: ~/bin/abzsubmit-0.1/streaming_extractor_music
chroma:
    auto: no
acoustid:
    apikey: REDACTED
convert:
    auto: yes
    never_convert_lossy_files: yes
    format: alac
    formats:
        auto: ~/.config/beets/convert.py $source $dest
        mp3: ffmpeg -i $source -y -vn -aq 1 $dest
        wavpack:
            command: wavpack -h $source -o $dest
            extension: wv
        aac:
            command: ffmpeg -i $source -y -vn -acodec aac -aq 1 $dest
            extension: m4a
        alac:
            command: ffmpeg -i $source -y -vn -acodec alac $dest
            extension: m4a
        flac: ffmpeg -i $source -y -vn -acodec flac $dest
        opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
        ogg: ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest
        wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
    dest:
    pretend: no
    threads: 4
    max_bitrate: 500
    tmpdir:
    quiet: no
    embed: yes

    paths: {}
    no_convert: ''
    copy_album_art: no
    album_art_maxwidth: 0
embedart:
    auto: yes
    remove_art_file: yes
    maxwidth: 0
    compare_threshold: 0
    ifempty: no
fetchart:
    auto: yes
    sources: coverart filesystem amazon albumart
    store_source: yes
    minwidth: 0
    maxwidth: 0
    enforce_ratio: no
    cautious: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
web:
    host: 127.0.0.1
    port: 8337
    cors: ''
    reverse_proxy: no
    include_paths: no
mbsubmit:
    format: $track. $title - $artist ($length)
    threshold: medium
pathfields: {}
item_fields: {}
album_fields: {}
fuzzy:
    prefix: '~'
    threshold: 0.7
export:
    default_format: json
    json:
        formatting:
            ensure_ascii: no
            indent: 4
            separators: [',', ': ']
            sort_keys: yes
missing:
    count: no
    total: no
    album: no

tzhao11 avatar Jan 13 '18 08:01 tzhao11

Good point; thanks! We don’t currently have a way exposed inside beets to determine the WavPack mode, so we’d need to build that first and then use it in that convert setting.

sampsyo avatar Jan 13 '18 18:01 sampsyo