diff --git a/Project.toml b/Project.toml index 0a842086115..edaf2959458 100644 --- a/Project.toml +++ b/Project.toml @@ -15,7 +15,7 @@ DelaunayTriangulation = "927a84f5-c5f4-47a5-9785-b46e178433df" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" -FFMPEG = "c87230d0-a227-11e9-1b43-d7ebe4e7570a" +FFMPEG_jll = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5" FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" FixedPointNumbers = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" Formatting = "59287772-0a20-5a39-b81b-1366585eb4c0" @@ -68,7 +68,6 @@ Contour = "0.5, 0.6" DelaunayTriangulation = "0.6.2, 0.7" Distributions = "0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25" DocStringExtensions = "0.8, 0.9" -FFMPEG = "0.2, 0.3, 0.4" FileIO = "1.6" FixedPointNumbers = "0.6, 0.7, 0.8" Formatting = "0.4" diff --git a/ReferenceTests/src/ReferenceTests.jl b/ReferenceTests/src/ReferenceTests.jl index fe844401fa1..28d62aff621 100644 --- a/ReferenceTests/src/ReferenceTests.jl +++ b/ReferenceTests/src/ReferenceTests.jl @@ -11,7 +11,6 @@ using FileIO using MacroTools using Makie using Makie: Record, Stepper, Axis -using Makie.FFMPEG using Printf using Tar using Downloads diff --git a/docs/documentation/animation.md b/docs/documentation/animation.md index 4b251dd1281..9c0faf351d1 100644 --- a/docs/documentation/animation.md +++ b/docs/documentation/animation.md @@ -50,7 +50,7 @@ record(change_function, fig, "color_animation.mp4", hue_iterator; framerate = fr ## File formats -Video files are created with [`FFMPEG.jl`](https://github.com/JuliaIO/FFMPEG.jl). +Video files are created with [`FFMPEG_jll.jl`](https://github.com/JuliaBinaryWrappers/FFMPEG_jll.jl). You can choose from the following file formats: - `.mkv` (the default, doesn't need to convert) diff --git a/src/Makie.jl b/src/Makie.jl index ddbb4929c05..2263a1d8569 100644 --- a/src/Makie.jl +++ b/src/Makie.jl @@ -15,7 +15,7 @@ using Base64 using LaTeXStrings using MathTeXEngine using Random -using FFMPEG # get FFMPEG on any system! +using FFMPEG_jll # get FFMPEG on any system! using Observables using GeometryBasics using PlotUtils diff --git a/src/ffmpeg-util.jl b/src/ffmpeg-util.jl index 32ea56ae096..2ae838e6d6d 100644 --- a/src/ffmpeg-util.jl +++ b/src/ffmpeg-util.jl @@ -25,7 +25,7 @@ you have issues playing a video, try `profile = "high"` or `profile = "main"`. - `pixel_format = "yuv420p"`: A ffmpeg compatible pixel format (`-pix_fmt`). Currently only applies to `mp4`. Defaults to `yuv444p` for `profile = high444`. - `loop = 0`: Number of times the video is repeated, for a `gif`. Defaults to `0`, which -means infinite looping. A value of `-1` turns off looping, and a value of `n > 0` and above +means infinite looping. A value of `-1` turns off looping, and a value of `n > 0` and above means `n` repetitions (i.e. the video is played `n+1` times). !!! warning @@ -48,12 +48,12 @@ struct VideoStreamOptions function VideoStreamOptions( format::AbstractString, framerate::Real, compression, profile, pixel_format, loop, loglevel::String, input::String, rawvideo::Bool=true) - + if !isa(framerate, Integer) @warn "The given framefrate is not a subtype of `Integer`, and will be rounded to the nearest integer. To supress this warning, provide an integer as the framerate." framerate = round(Int, framerate) end - + if format == "mp4" (profile === nothing) && (profile = "high422") (pixel_format === nothing) && (pixel_format = (profile == "high444" ? "yuv444p" : "yuv420p")) @@ -62,7 +62,7 @@ struct VideoStreamOptions if format in ("mp4", "webm") (compression === nothing) && (compression = 20) end - + if format == "gif" (loop === nothing) && (loop = 0) end @@ -131,7 +131,6 @@ function to_ffmpeg_cmd(vso::VideoStreamOptions, xdim::Integer=0, ydim::Integer=0 cpu_cores = length(Sys.cpu_info()) ffmpeg_prefix = ` - $(FFMPEG.ffmpeg) -y -loglevel $(vso.loglevel) -threads $(cpu_cores)` @@ -229,7 +228,7 @@ function VideoStream(fig::FigureLike; buffer = Matrix{RGB{N0f8}}(undef, xdim, ydim) vso = VideoStreamOptions(format, framerate, compression, profile, pixel_format, loop, loglevel, "pipe:0", true) cmd = to_ffmpeg_cmd(vso, xdim, ydim) - process = @ffmpeg_env open(`$cmd $path`, "w") + process = open(`$(FFMPEG_jll.ffmpeg()) $cmd $path`, "w") return VideoStream(process.in, process, screen, buffer, abspath(path), vso) end @@ -277,10 +276,10 @@ function convert_video(input_path, output_path; video_options...) format = lstrip(typ, '.') vso = VideoStreamOptions(; format=format, input=input_path, rawvideo=false, video_options...) cmd = to_ffmpeg_cmd(vso) - @ffmpeg_env run(`$cmd $output_path`) + return run(`$(FFMPEG_jll.ffmpeg()) $cmd $output_path`) end function extract_frames(video, frame_folder; loglevel="quiet") path = joinpath(frame_folder, "frame%04d.png") - FFMPEG.ffmpeg_exe(`-loglevel $(loglevel) -i $video -y $path`) + run(`$(FFMPEG_jll.ffmpeg()) -loglevel $(loglevel) -i $video -y $path`) end