JuliaIO / VideoIO.jl

Reading and writing of video files in Julia via ffmpeg
https://juliaio.github.io/VideoIO.jl/stable
Other
126 stars 53 forks source link

Helper methods for set/get ffmpeg log level, and info on default #189

Closed IanButterworth closed 5 years ago

IanButterworth commented 5 years ago

Addresses #184.

Default log level is set to AVUtil.AV_LOG_FATAL, and can be set with:

VideoIO.loglevel!(VideoIO.AVUtil.AV_LOG_VERBOSE)

Docstrings:

help?> VideoIO.loglevel
  loglevel() -> String

  Get FFMPEG log level as a variable name string.

help?> VideoIO.loglevel!
  loglevel!(loglevel::Integer)

  Set FFMPEG log level. Options are:

    •    VideoIO.AVUtil.AV_LOG_QUIET

    •    VideoIO.AVUtil.AV_LOG_PANIC

    •    VideoIO.AVUtil.AV_LOG_FATAL

    •    VideoIO.AVUtil.AV_LOG_ERROR

    •    VideoIO.AVUtil.AV_LOG_WARNING

    •    VideoIO.AVUtil.AV_LOG_INFO

    •    VideoIO.AVUtil.AV_LOG_VERBOSE

    •    VideoIO.AVUtil.AV_LOG_DEBUG

    •    VideoIO.AVUtil.AV_LOG_TRACE

I'm not sure that this is a good idea.. but I've added an info message at import.. Perhaps we don't need that..?

julia> using VideoIO
[ Info: VideoIO: Low-level FFMPEG reporting set to minimal (AV_LOG_FATAL). See `?VideoIO.loglevel!()` for options

The MWE from #184 no longer spits out warnings on this branch

using VideoIO
file = download("https://vision-group-temporary.s3.amazonaws.com//a.MTS")
f = openvideo(file)
seek(f, 30.0)

It also suppresses the non-test-breaking warnings during ] test VideoIO! woohoo!!

yakir12 commented 5 years ago

I think that "daily" users of VideoIO won't feel that such a warning is necessary. For those that want to debug, develop, or test things, then they'll go looking for ffmpeg-style log-levels and find it in the documentation (which would be good to add).

There are two bigger-picture related things to keep in mind here (in my humble opinion):

  1. VideoIOffmpeg: so we don't need to replicate every aspect of ffmpeg (e.g. the ffmpeg banner every time a command is run)
  2. There will be other default settings that we will silently set for the users, sane default settings, so keeping the verbosity minimal at import is wise (since you'll need to make this decision many more times in the future).
yakir12 commented 5 years ago

see #191

IanButterworth commented 5 years ago

I like your logic. +1 on reasons to have proper docs