Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mp4 resolution #2158

Open
jw3126 opened this issue Aug 25, 2019 · 3 comments
Open

mp4 resolution #2158

jw3126 opened this issue Aug 25, 2019 · 3 comments
Labels
enhancement improving existing functionality

Comments

@jw3126
Copy link
Contributor

jw3126 commented Aug 25, 2019

Is there a way to control the resolution of mp4 output? Here is what I tried:

julia> using Plots

julia> gr(windowsize=(100,100))
Plots.GRBackend()

julia> path = tempname() * ".mp4"
"/tmp/jl_haa4lh.mp4"

julia> anim = @animate for i in 1:100
           plot(randn(10))
       end
Animation("/tmp/jl_FqJLPd", ["000001.png", "000002.png", "000003.png", "000004.png", "000005.png", "000006.png", "000007.png", "000008.png", "000009.png", "000010.png"    "000091.png", "000092.png", "000093.png", "000094.png", "000095.png", "000096.png", "000097.png", "000098.png", "000099.png", "000100.png"])

julia> mp4(anim, path)
ERROR: failed process: Process(`/home/jan/.julia/packages/FFMPEG/9JQpZ/deps/usr/bin/ffmpeg -v 0 -framerate 20 -loop 0 -i /tmp/jl_FqJLPd/%06d.png -pix_fmt yuv420p -y /tmp/jl_haa4lh.mp4`, ProcessExited(1)) [1]

OTOH it works with gif:

julia> gif(anim, path * ".gif")
┌ Info: Saved animation to 
└   fn = "/tmp/jl_haa4lh.mp4.gif"
Plots.AnimatedGif("/tmp/jl_haa4lh.mp4.gif")
@grahamas
Copy link
Contributor

grahamas commented Sep 9, 2019

I think this may be the same problem I'm running into. I investigated the error and got:

[libx264 @ 0x1a1f980] width not divisible by 2 (799x800)", "Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height", "Conversion failed!"]

However, I'm manually setting the plot size to be 800x800.

@ssfrr
Copy link

ssfrr commented Apr 18, 2020

I just ran into this as well. This is hard to see what's going on because the call to ffmpeg throws a ProcessError but doesn't say what the problem is (it seems that ffmpeg is being run with -v 0 which disables error messages).

In my case I got it to work by setting dpi=101 which for my resolution (500x500) happened to give an even height and width. The return value seems to be of type AnimatedGif but it created the mp4 video.

@hdrake
Copy link

hdrake commented Dec 29, 2022

This bug is a result of the more fundamental bug discussed in #2303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improving existing functionality
Projects
None yet
Development

No branches or pull requests

5 participants