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

Output mp4 do not play if width/height not divisible by 2 #2

Closed
BurguerJohn opened this issue Nov 19, 2019 · 10 comments
Closed

Output mp4 do not play if width/height not divisible by 2 #2

BurguerJohn opened this issue Nov 19, 2019 · 10 comments

Comments

@BurguerJohn
Copy link

At least i think this is the problem. More of a mp4 limitation that a bug.
I usually fix this in ffmpeg using:
-vf "pad=ceil(iw/2)*2:ceil(ih/2)*2"

@sniklaus
Copy link
Owner

Thank you for bringing this to my attention! I am using MoviePy to convert a sequence of images to a video, which underneath the hood uses FFmpeg. So this is probably something that should be addressed within MoviePy. I just checked the Github issues for MoviePy but nothing came up with respect to this issue, which is a little surprising.

@BurguerJohn
Copy link
Author

I can't say for sure if this is the problem that are making some output not play correctly, but i can say that i managed to fix the video using this command:
!ffmpeg -y -i {input} -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -c:v libx264 -crf 17 -pix_fmt yuv420p {output}

@sniklaus
Copy link
Owner

Which would mean that FFmpeg can read and reprocess the video. So the issue is probably the video player, have you tried VLC?

@BurguerJohn
Copy link
Author

I did managed to open the video inside chrome without this step, but twitter failed to upload the file without it. I am sure that some players can open the file without it as well.

@sniklaus
Copy link
Owner

I see, that makes sense. Again, thank you for bringing this up!

@BurguerJohn
Copy link
Author

No problem! Awesome project btw. Keep the good work.

@JonathanFly
Copy link
Contributor

You can play the files with VLC, but not anything else. On the upside though if you try to re-encode them so Twitter accepts them you get a pretty cool effect! https://twitter.com/jonathanfly/status/1196711034628775936

@BurguerJohn
Copy link
Author

Thanks Jonathan, actually i already follow you in twitter and saw your tweet before coming here.
I just made a video on youtube showing this project with a few tests i made.
https://youtu.be/3JroOSnBuAk

@sniklaus
Copy link
Owner

sniklaus commented Nov 20, 2019

That's awesome, thank you for sharing these results!

@sniklaus
Copy link
Owner

Thank you all again for bringing this up and for the discussion. I am closing this for now since it is not an immediate issue with the provided code but with MoviePy / FFmpeg / VLC.

tlsaeger added a commit to tlsaeger/3d-ken-burns that referenced this issue Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants