Skip to content

Impossible to set quality for libvorbis #2245

@shadowlmd

Description

@shadowlmd

I am trying to write Ogg Vorbis files with the following code:

        output = av.open(str(outfile), "w")
        out_stream = output.add_stream("libvorbis", rate=audio_stream.rate)
        out_stream.options["global_quality"] = "9"  # https://ffmpeg.org/ffmpeg-codecs.html#Options-21

        for packet in container.demux(audio_stream):
            for frame in packet.decode():
                pkt = out_stream.encode(frame)
                if pkt:
                    output.mux(pkt)

        for pkt in out_stream.encode():
            output.mux(pkt)

        output.close()

Everything works, but I get an ogg vorbis file with bitrate ~112 kbps, definitely not q9. I also tried to add out_stream.qscale = True, but then the bitrate of the output file is ~ 65 kbps.

Is it a bug or I am doing something wrong? How do I set quality for libvorbis encoder?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions