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

Convert FLAC files to Opus using FFmpeg #43

Closed
hknutsen opened this issue Jan 5, 2025 · 1 comment
Closed

Convert FLAC files to Opus using FFmpeg #43

hknutsen opened this issue Jan 5, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@hknutsen
Copy link
Owner

hknutsen commented Jan 5, 2025

Remove dependency on opus-tools by updating audio/encode_opus.sh to use ffmpeg instead of opusenc:

  • In sysadmin/install_software.yml, remove task Install Opus Tools:

    - name: Install Opus Tools
    become: true
    ansible.builtin.dnf:
    name: opus-tools
    state: present

  • In audio/encode_opus.yml, replace command opusenc with ffmpeg:

    opusenc --bitrate 128 --vbr --quiet "$flac_file" "$opus_file"

    Remember to investigate if the following behaviour is also true when using FFmpeg:

    # The Opus encoder provided by opus-tools will propagate tags from the input
    # FLAC file to the output Opus file, except "REPLAYGAIN_*" tags.
    #
    # Opus follows the EBU R128 specification for loudness normalization.
    # According to the Opus specification, gain must be stored in the "Output
    # Gain" field in the ID header. Media players should apply this gain by
    # default. Additional track and album gain can be stored in the
    # "R128_TRACK_GAIN" and "R128_ALBUM_GAIN" tags in the comment header.
    # Ref: https://datatracker.ietf.org/doc/html/rfc7845#section-5.2.1
    #
    # If the input FLAC file has a "REPLAYGAIN_ALBUM_GAIN" tag, its value will be
    # converted to the R128 reference level and stored in the "Output Gain" field
    # of the output Opus file. If the input FLAC file has a
    # "REPLAYGAIN_TRACK_GAIN" tag, its value relative to the album gain will be
    # converted to the R128 reference level and stored in the "R128_TRACK_GAIN"
    # tag of the output Opus file.
    # Ref: https://github.com/xiph/opus-tools/blob/v0.2/src/flac.c#L179-L193
    #
    # Some media players might require ReplayGain to be turned off in order apply
    # the default output gain (i.e. the album gain) without applying the
    # additional track gain.

    Also remember to update prerequisites for script (should be ffmpeg instead of opus-tools):

@hknutsen hknutsen added the enhancement New feature or request label Jan 5, 2025
@hknutsen hknutsen self-assigned this Jan 5, 2025
@hknutsen
Copy link
Owner Author

hknutsen commented Jan 6, 2025

Made redundant by 4c71515

@hknutsen hknutsen closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant