1

I have a series of PNG images created in Blender that I need to combine into an mp4, or really any video format playable on the Oculus Go VR headset. This page has detailed information about video specifications for their platform Oculus Video, although I'm actually trying to use the apps Oculus Gallery and Skybox VR for local playback, so I'm not sure it applies the same.

ffmpeg -r 24 -vcodec h264 -i my_images_%04d.png -pix_fmt yuv420p output.mp4

This command is failing and giving me the following output: https://pastebin.com/xyNck7fa. If I add the corresponding audio with -i my_audio.wav, I get an audio-only file with a .mp4 file extension.

I was previously able to produce video that was playable on my PC but didn't play back at the correct speed to match the corresponding audio. (This is quite clear because it is specifically a music visualization video.) When transferred to the headset, it was unable to play at all in Oculus Gallery (would try to load indefinitely), and it would kind of play in Skybox VR but at maybe 1 fps, clearly struggling. To be honest, I'm not sure what I was doing differently before that allowed me to at least get a video. I had thought this was the exact command I was using, but I let some time go by and I guess I forgot some option.

I played the video I was able to create before in VLC and pulled up codec information to compare to other MP4 files I had downloaded. There were only two significant differences: the resolutions and the 'decoded format.' The resolution of my frames is 2880x810 (which I'm aware now is not the ideal aspect ratio for VR, but I can work on that once I have playable video), whereas a typical video I have is 864x480. All of my downloaded MP4s have the decoded format field blank when viewed in VLC, but the video I created reads 'Planar 4:4:4 YUV.'

That is all the relevant information I can think of. Can someone help me figure out what I need to do differently?

  • This, -vcodec h264 -i my_images_%04d.png, tells ffmpeg to use the h264 decoder to decode the input. a) this is wrong for PNG images. amd b) manual decoder specification is needed in only some cases. Remove -vcodec h264. Share the full readout for ffprobe WorkingVideo.mp4 – Gyan Mar 9 '19 at 5:18
  • @Gyan My issue is solved, but in case it helps someone in the future, here is the ffprobe output for my first video and the video that now works as it is supposed to – Rammschnev Mar 10 '19 at 5:59
2

Thanks to u/jesus_is_imba on Reddit for the following answer:

ffmpeg -r 24 -i my_images_%04d.png -c:v libx264 -crf 18 -preset slow -g 48 -pix_fmt yuv420p -movflags +faststart output.mp4

The -g argument defines keyframe interval in frames and according to Oculus should be 2 seconds, ie. 2x your frame rate.

This command produces video that plays back perfectly both in VLC and in Oculus Gallery.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.