Answers.Body: <p>Thanks to u/jesus_is_imba on Reddit for the following answer:</p>
  
  <pre><code>ffmpeg -r 24 -i my_images_%04d.png -c:v libx264 -crf 18 -preset slow -g 48 -pix_fmt yuv420p -movflags +faststart output.mp4
  </code></pre>
  
  <blockquote>
    <p>The -g argument defines keyframe interval in frames and according to Oculus should be 2 seconds, ie. 2x your frame rate.</p>
  </blockquote>
  
  <p>This command produces video that plays back perfectly both in VLC and in Oculus Gallery.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-10T05:53:07.880Z
Answers.LastActivityDate: 2019-03-10T06:00:53.513Z
Answers.LastEditDate: 2019-03-10T06:00:53.513Z
Answers.UserDisplayName: Rammschnev
Body: <p>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. <a href="https://creator.oculus.com/distribute/oculus-video/" rel="nofollow noreferrer">This page</a> 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.</p>
  
  <pre><code>ffmpeg -r 24 -vcodec h264 -i my_images_%04d.png -pix_fmt yuv420p output.mp4
  </code></pre>
  
  <p>This command is failing and giving me the following output: <a href="https://pastebin.com/xyNck7fa" rel="nofollow noreferrer">https://pastebin.com/xyNck7fa</a>. If I add the corresponding audio with <code>-i my_audio.wav</code>, I get an audio-only file with a .mp4 file extension.</p>
  
  <p>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.</p>
  
  <p>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.'</p>
  
  <p>That is all the relevant information I can think of. Can someone help me figure out what I need to do differently?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-09T05:18:55.077Z
Comments.Text: 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`
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-10T05:59:22.883Z
Comments.Text: @Gyan My issue is solved, but in case it helps someone in the future, here is the ffprobe output for [my first video](https://pastebin.com/0AuLGLqN) and [the video that now works as it is supposed to](https://pastebin.com/UqS0cjBX)
Comments.UserDisplayName: Rammschnev
Tags: <ffmpeg><blender><vr>
Title: Can't Get Playable Video From Images in FFMPEG for Oculus Go
UserDisplayName: Rammschnev
ThreadText: # Can't Get Playable Video From Images in FFMPEG for Oculus Go
  
  (Asked by: username_0 on 2019-03-08)
  
  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](https://creator.oculus.com/distribute/oculus-video/) 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?
  
  **Tags:** ffmpeg, blender, vr
  
  > **Comments:**
  > **username_1**: 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`  
  > **username_0**: @username_1 My issue is solved, but in case it helps someone in the future, here is the ffprobe output for [my first video](https://pastebin.com/0AuLGLqN) and [the video that now works as it is supposed to](https://pastebin.com/UqS0cjBX)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-03-10. Score: 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.
  
  
  ---
  
  