Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per issue #45, here is a proposed PR to allow setting the ffmpeg log level with either
Xav.Reader.set_log_level/1. Compiled and tested on my MacBook Pro with ffmpeg@7.Summary
Adds a thin Elixir wrapper around FFmpeg's
av_log_set_level(int). Also adds an application-env-driven default so applications can configure the level once inconfig/runtime.exsinstead of calling the setter from their ownApplication.start/2. You may want to remove the second part.Background
libswscaleprints informational lines tostderrat FFmpeg's default log level (AV_LOG_INFO) whenever it falls back to a generic C conversion path instead of a SIMD-optimised one, for example:Today there is no way to silence the notices from Elixir code because Xav does not expose
av_log_set_level/1. Users have to either redirect stderr wholesale (which also hides real errors) or rebuild FFmpeg with the missing SIMD paths.Design
Wrapper lives on
Xav.Readerto keep it next to the most obvious caller, even thoughav_log_set_level/3is process-global and affects everylibav*call made from the VM (reader, decoder, encoder).Accepts atoms: (
:quiet | :panic | :fatal | :error | :warning | :info | :verbose | :debug | :trace) rather than FFmpeg's integer constants, so callers don't need to know the magic numbers. The atom → integer mapping is the Elixir side; the NIF itself just takes anint.Application-env default: A new
Xav.Applicationmodule readsApplication.get_env(:xav, :log_level)once at application start and applies it. Users who want quiet decoding globally just add:No behaviour change by default. If
:log_levelis unset,Xav.Application.start/2leaves FFmpeg's default untouched (AV_LOG_INFO), so existing users see identical output.Questions
Xavinstead ofXav.Reader?XAV_LOG_LEVEL) as well as the application env, to match what FFmpeg users might already expect? Easy to add —maybe_set_log_level/0would check both in order.use Application+ a no-children supervisor acceptable as a minimal app callback - its only there to read the config and set log level.