crisbal / album-splitter

Split single-file MP3 albums into separate tracks. Downloads from YouTube supported.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Output file encoding

rubisco57 opened this issue Β· comments

I like this project!
I was not able to figure out how to control FFmpeg's audio encoding (bit rate, file type).
Could the necessary arguments be added in the future?

Hey, thanks for the interest. Right now we are using a wrapper library for FFMpeg, so there is not much customization.

There was a fork by another user (https://github.com/rgamici/Album-Splitter/commit/da5df0df62f23bc84db7f3462e6a118e7861459b) that used raw FFMpeg command but he never proposed a merge and right now the fork is outdated. If you want you could try the fork, update it and create a merge request, otherwise I will get to this as soon as I have some time.

#33 should enable flac output

#33 should enable flac output

That feature is gone in the latest version. I don't see the --format flag in --help. Right now it defaults to wav which I convert manually to mp3. I used this project a in may and got mp3 by default.

Hello @Vorlent

Right now the behavior is to respect the format of the input because conversion is an "hard" task to get right (there are many parameters, rules and possibilities), for example From WAV->MP3 I might need to forcefully choose a bitrate or other compression parameters that some users might not like, so it is better to just copy over the audio format and let the conversion up for some other tools, more suitable for this.

In general this was discussed in #42 and there was proposed a simple command to do WAV to MP3 conversion.

find . -iname "*.wav" -exec lame -V0 {} \;

I agree that the README should be a bit more clear about this.

There was a fork by another user (https://github.com/rgamici/Album-Splitter/commit/da5df0df62f23bc84db7f3462e6a118e7861459b) that used raw FFMpeg command but he never proposed a merge and right now the fork is outdated.

This repo is now gone...

There was a fork by another user (https://github.com/rgamici/Album-Splitter/commit/da5df0df62f23bc84db7f3462e6a118e7861459b) that used raw FFMpeg command but he never proposed a merge and right now the fork is outdated.

This repo is now gone...

Hello @nicolaasjan

As I mentioned below, this fork should not be necessary anymore. My script was updated to use for the output the same encoding/format/specifications as the source file. Any later post-processing on the output files (for example changing wav to mp3, or changing the bitrate or whatever else), you must do it with ffmpeg commands directly on the output files.

Let me know if this answer your problem.

I have clarified this in the README, together with some examples. This issue can be closed if it is all clear on your side @nicolaasjan

https://github.com/crisbal/album-splitter#output-format

I have clarified this in the README, together with some examples. This issue can be closed if it is all clear on your side @nicolaasjan

https://github.com/crisbal/album-splitter#output-format

Thanks!
I'm quite comfortable with using Ffmpeg. πŸ™‚

Feel free to close it, if it's OK with @rubisco57.

Sidenote:
I had two other issues, but I think one it the same as #30.
(test video here)
File names ended up like e.g. Olivia Newton-JohnMagic.wav.
It should be 01 - Olivia Newton-John - Magic.wav.

And the other is, that tracks are not placed in the right order, but instead alphabetically...
See also these Reddit comments.

Schermafdruk op 2022-08-22 11-04-58

@nicolaasjan you are absolutely right. I can push a fix for this now. I will ping you when you can try again.

@nicolaasjan would you prefer the track number to be assigned arbitrarily by the script or to be pulled from the .txt file?

In your case, do you want Olivia Newton-John - Magic to be 01 (assigned automatically) or 02 (pulled from the txt)?

01 - Blondie - Call me (BLOQUEADA / BLOCKED)
02 - Olivia Newton-John - Magic - [00:00]
03 - Rupert Holmes - Escape (The Pina Colada Song) - [04:28]

would you prefer the track number to be assigned arbitrarily by the script or to be pulled from the .txt file?

In your case, do you want Olivia Newton-John - Magic to be 01 (assigned automatically) or 02 (pulled from the txt)?

Well, in this particular case , I edited the text file, because 01 was blocked and it seemed logical to start with 01. πŸ˜€οΈ

@nicolaasjan I have updated the tool to include the track number on the filenames now. Sorry it took a while :)

@nicolaasjan I have updated the tool to include the track number on the filenames now. Sorry it took a while :)

πŸ‘οΈβ€οΈ
However, the -'s in the filenames in the case of video https://www.youtube.com/watch?v=WUNipoTGhMc were still omitted, e.g.:
01 Olivia Newton-JohnMagic.wav.
I would prefer 01 - Olivia Newton-John - Magic.wav.
Guess I could do this manually afterwards, if it's to difficult to implement.

Furthermore, good that you now use yt-dlp. πŸ‘οΈ

However, pip installed the Release version:
[debug] yt-dlp version 2022.09.01 [5d7c7d656]
So in my case it replaced my own self-compiled version from master, which I have in /usr/local/bin. πŸ˜€οΈ
[debug] yt-dlp version 2022.09.21 [f7c5a5e96] (zip)

Right @nicolaasjan , I will open a new issue for this problem you mention. It is not particularly difficult to implement, I will need to replace some old code that I don't recognize anymore (it was written years ago) with some new code that handle these cases well.

In terms of yt-dlp, pip will fetch the latest stable version on pypi.org, if you want always want to use master you can replace yt-dlp in setup.cfg with git+https://github.com/yt-dlp/yt-dlp.git@master. This should work, and whenever you do pip install --upgrade . it will pull the latest version.

Anyway I have also setup a periodic check that will inform me if something breaks, so I can stay up to date with changes to yt-dlp.

In terms of yt-dlp, pip will fetch the latest stable version on pypi.org, if you want always want to use master you can replace yt-dlp in setup.cfg with git+https://github.com/yt-dlp/yt-dlp.git@master. This should work, and whenever you do pip install --upgrade . it will pull the latest version.

I had to do it like this:

python -m pip install --upgrade --force-reinstall git+https://github.com/yt-dlp/yt-dlp.git@master
Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/yt-dlp/yt-dlp.git@master
  Cloning https://github.com/yt-dlp/yt-dlp.git (to revision master) to /tmp/pip-req-build-c_2rio5w
  Running command git clone --filter=blob:none --quiet https://github.com/yt-dlp/yt-dlp.git /tmp/pip-req-build-c_2rio5w
  Resolved https://github.com/yt-dlp/yt-dlp.git to commit 5c8b2ee9ecf8773eb463b4ae218f8313a6626b2f
  Preparing metadata (setup.py) ... done
Collecting mutagen
  Downloading mutagen-1.45.1-py3-none-any.whl (218 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 218.7/218.7 kB 7.1 MB/s eta 0:00:00
Collecting pycryptodomex
  Downloading pycryptodomex-3.15.0-cp35-abi3-manylinux2010_x86_64.whl (2.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 12.7 MB/s eta 0:00:00
Collecting websockets
  Downloading websockets-10.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (111 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 111.3/111.3 kB 6.8 MB/s eta 0:00:00
Collecting certifi
  Downloading certifi-2022.9.14-py3-none-any.whl (162 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.5/162.5 kB 8.5 MB/s eta 0:00:00
Collecting brotli
  Downloading Brotli-1.0.9-cp38-cp38-manylinux1_x86_64.whl (357 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 357.2/357.2 kB 9.4 MB/s eta 0:00:00
Building wheels for collected packages: yt-dlp
  Building wheel for yt-dlp (setup.py) ... done
  Created wheel for yt-dlp: filename=yt_dlp-2022.9.1-py2.py3-none-any.whl size=2491737 sha256=99ef9852c11486ca99aeec009cc302ce51fe8e278345fc1b987d99b6076f7de5
  Stored in directory: /tmp/pip-ephem-wheel-cache-d_41vent/wheels/e0/fc/b4/a4585ce6382c887a851a4712dc1759c2b565cecbc085ccbb53
Successfully built yt-dlp
Installing collected packages: brotli, websockets, pycryptodomex, mutagen, certifi, yt-dlp
  Attempting uninstall: brotli
    Found existing installation: Brotli 1.0.9
    Uninstalling Brotli-1.0.9:
      Successfully uninstalled Brotli-1.0.9
  Attempting uninstall: websockets
    Found existing installation: websockets 10.1
    Uninstalling websockets-10.1:
      Successfully uninstalled websockets-10.1
  Attempting uninstall: pycryptodomex
    Found existing installation: pycryptodomex 3.12.0
    Uninstalling pycryptodomex-3.12.0:
      Successfully uninstalled pycryptodomex-3.12.0
  Attempting uninstall: mutagen
    Found existing installation: mutagen 1.45.1
    Uninstalling mutagen-1.45.1:
      Successfully uninstalled mutagen-1.45.1
Successfully installed brotli-1.0.9 certifi-2022.9.14 mutagen-1.45.1 pycryptodomex-3.15.0 websockets-10.3 yt-dlp-2022.9.1

With only --upgrade it said that yt-dlp-2022.9.1 was already installed ( the version number is not updated in the source).