Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom encoder #73

Open
DarthGandalf opened this issue Sep 8, 2018 · 9 comments
Open

Custom encoder #73

DarthGandalf opened this issue Sep 8, 2018 · 9 comments

Comments

@DarthGandalf
Copy link

This is similar to #57 but to use a custom script I need to abuse one of existing formats, and to override path to the binary of encoder of that format.

This request is to let users add more "output formats" dynamically, each with its own path to encoder.

@SokoloffA
Copy link
Member

I don't mind adding custom encoders. But there are two problems.

  1. GUI for configuring quality for the encoders. Different encoders have different quality parameters, especially the lossy encoders.

  2. Different encoders have different command-line arguments. Now, I know which arguments I should to pass to the program. What arguments should I pass to the custom encoder?

The second problem can be solved if we add the "command string" parameter, something like:

flac 
    --force 
    --silent 
    --compression-level-%COMPRESSION_LEVEL%
    --tag "artist=%ARTIST%"
    --tag "album=%ALBUM%"
    --tag "genre=%GENRE%"
    --tag "date=%DATE%"
    --tag "title=%TITLE%"
    --tag "comment=%COMMENT%"
    --tag "discId=%DISKID%"
    --tag "TRACKNUMBER=%TRACKNUM%"
    --tag "TOTALTRACKS=%TRACKCOUNT%"
    --tag "TRACKTOTAL=%TRACKCOUNT%"
    - 
    -o "%_OUT_FILE%"

Or add a scripting layer (for example on LUA). All scripts is called uniformly, and all encoder specific things are defined inside the script.

But what to do with the first problem I do not know.
If you know convenient implementation in other program - ask me. Any ideas are welcome.

@SokoloffA
Copy link
Member

What do you use custom script for? If it's for resampling, I have good news for you. The new version will support changing bit depths and frequency resampling.

I want beta testers, if you're interested, you can build a version from the master branch, or send me name of your distribution and I'll build program for you.

@DarthGandalf
Copy link
Author

Here's mockup of how it could like.
mock flacon

I didn't think about lua, but probably it would be a path to the lua script.

Re my immediate use case: I tried to split an 192kHz album in 32-bit floating point. FLAC doesn't support that, and fails: Ошибка кодирования:-: ERROR: unsupported format type 3. The workaround I found was to tell flacon to write WavPack instead of FLAC; then I used ffmpeg on every track to convert it from .wv to .flac; ffmpeg was telling encoding as 24 bits-per-sample, but didn't fail the conversion.
So, ideally, I would tell flacon to do something like in the custom encoder script:

wavpack ... %ALBUM% -o /dev/stdout | ffmpeg -i /dev/stdin %OUT%.flac

Probably with temp files instead of pipe

@DarthGandalf
Copy link
Author

Depending on how exactly it would be implemented, I might need to move the "wavpack; ffmpeg" sequence to a separate shell script, and call it from flacon with arguments; but that's details.

@SokoloffA
Copy link
Member

SokoloffA commented Sep 10, 2018

I tried to split an 192kHz album in 32-bit floating point. FLAC doesn't support that, and fails

The developed version does exactly what you want.
If you have skills, you can build the project from sources. This page may be useful to you.

git clone https://github.com/flacon/flacon.git 
cd flacon 
mkdir build 
cd build 
cmake ..
make 

If you haven't such skill, say me what distibutive you are use, and I try to build program for you.

@DarthGandalf
Copy link
Author

The distribution is Gentoo, and I have enough skills :)
This feature request, however, is not limited to this one scenario.

I believe you that resampling works in the new version, and it's great that it does. Maybe I'll use the new version if I need to split another album like that, or if I find time to beta test it. But there are other scenarios why custom encoder can be useful.

@SokoloffA
Copy link
Member

Here's mockup of how it could like.

I was not saw about to the general GUI. The problem is different.
Each encoder program has its own settings for quality tuning, for example:

  • FLAC has one slider "Compression" from 0 to 8
  • WavPack - "Compression" , but from 0 to 2.
  • OPUS has 2 modes "VBR" and "CBR" and slider "Bitrate"
  • and so on

so each codec has its own parameters and knobs.

The question is how a custom encoder can pass information about its configuration controls to the main program. This should be easy and convenient for the normal user. I don't want to complicate the program, and turn it into the IDE.

@DarthGandalf
Copy link
Author

I see what you mean.
Why does the encoder need to pass any setting knob to flacon at all? If I (user) know what I want to run, and with which parameters, I can easily put that into my encoder script, without telling flacon what is the exact meaning of the parameters. I can even use --album=%ARTIST% --artist=%YEAR% --quality=42 --bitrate=987 if I wish. Flacon doesn't need to concern itself with a possible mismatch of albums and years in those parameters; if I'm passing those, I probably know what I'm doing.
The command line is the only setting needed. I added regain to the mock only because that setting is available in all existing encoders, so I thought its implementation is independent from the encoder. If it's not the case, feel free to not expose it either.

@brainchild0
Copy link

brainchild0 commented Oct 26, 2019

I have never had a desire to use Flacon with any encoding profile not supported by the native graphical interface, but I definitely agree that support could be provided through allowing users to specify a command string with interpolated variables. Similarly, support could be provided for adding parameters to commands created natively by Flacon for encoders already supported.

It would be beautiful and elegant if the application supported plugins describing parameters that could be tuned through graphical controls, but such a level of sophistication is far beyond what is required simply to support the advanced uses. Support for command strings, as previously suggested, would be adequate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants