sniklaus / 3d-ken-burns

an implementation of 3D Ken Burns Effect from a Single Image using PyTorch
Other
1.52k stars 225 forks source link

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

Closed BurguerJohn closed 4 years ago

BurguerJohn commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

BurguerJohn commented 5 years ago

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 commented 5 years ago

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

BurguerJohn commented 5 years ago

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

JonathanFly commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

sniklaus commented 4 years ago

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.