Skip to content

Commit

Permalink
kwarg: ffmpeg_loglevel (#294)
Browse files Browse the repository at this point in the history
* ffmpeg_loglevel
  • Loading branch information
Wikunia committed Nov 24, 2020
1 parent d9a45da commit e393802
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ A clear and concise description of what the bug is.
A clear and concise description of what you expected to happen followed up with an explanation of what actually happened.

**Stacktrace (If Applicable)**
If the stacktrace includes some ffmpeg error please set the kwarg `ffmpeg_loglevel` to `"info"` i.e `render(your_video, "your_animation.gif", ffmpeg_loglevel = "info")`

**Screenshots**
If applicable, add your gif or drawing to help explain your problem.
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Javis.jl - Changelog

## v0.3.2 (24th of November)
- added `ffmpeg_loglevel` option for debugging purposes

## v0.3.1 (18th of November 2020)
- removed `ColorTypes` as a dependency
- docstring fixes for `morph_to`
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Javis"
uuid = "78b212ba-a7f9-42d4-b726-60726080707e"
authors = ["Ole Kröger <o.kroeger@opensourc.es>", "Jacob Zelko <jacobszelko@gmail.com>"]
version = "0.3.1"
version = "0.3.2"

[deps]
Animations = "27a7e980-b3e6-11e9-2bcd-0b925532e340"
Expand Down
11 changes: 8 additions & 3 deletions src/Javis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ end
framerate=30,
pathname="javis_GIBBERISH.gif",
tempdirectory="",
liveview=false
liveview=false,
ffmpeg_loglevel="panic"
)
Renders all previously defined [`Object`](@ref) drawings to the user-defined `Video` as a gif or mp4.
Expand All @@ -178,13 +179,17 @@ Renders all previously defined [`Object`](@ref) drawings to the user-defined `Vi
- `tempdirectory::String`: The folder where each frame is stored
Defaults to a temporary directory when not set
- `liveview::Bool`: Causes a live image viewer to appear to assist with animation development
- `ffmpeg_loglevel::String`:
- Can be used if there are errors with ffmpeg. Defaults to panic:
All other options are described here: https://ffmpeg.org/ffmpeg.html
"""
function render(
video::Video;
framerate = 30,
pathname = "javis_$(randstring(7)).gif",
liveview = false,
tempdirectory = "",
ffmpeg_loglevel = "panic",
)
objects = video.objects
frames = preprocess_frames!(objects)
Expand Down Expand Up @@ -231,10 +236,10 @@ function render(
isempty(pathname) && return
if ext == ".gif"
# generate a colorpalette first so ffmpeg does not have to guess it
ffmpeg_exe(`-loglevel panic -i $(tempdirectory)/%10d.png -vf
ffmpeg_exe(`-loglevel $(ffmpeg_loglevel) -i $(tempdirectory)/%10d.png -vf
"palettegen=stats_mode=diff" -y "$(tempdirectory)/palette.bmp"`)
# then apply the palette to get better results
ffmpeg_exe(`-loglevel panic -framerate $framerate -i $(tempdirectory)/%10d.png -i
ffmpeg_exe(`-loglevel $(ffmpeg_loglevel) -framerate $framerate -i $(tempdirectory)/%10d.png -i
"$(tempdirectory)/palette.bmp" -lavfi
"paletteuse=dither=sierra2_4a" -y $pathname`)
elseif ext == ".mp4"
Expand Down

0 comments on commit e393802

Please sign in to comment.