0

How can I debug what happened? I've tried this with variations to generate a short video from a single image:

ffmpeg -loop 1 -i black.png -vcodec libx264 -b 1500k -s 640x360 -t 1 out.mp4

tried:

  1. Changing aspect ration (or omitting it).
  2. using -image2 instead of -loop.
  3. omitting bitrate.
  4. creating longer videos.
  5. also tried different syntax for specifying video codec: -v:c libx264.
  6. tried mpeg instead of libx264.

In every case the effect is the same. The video plays in VLC, but not in the browser.

5
  • 1
  • @LordNeckbeard yes, thank you, that was it. Any idea why such a weird default? I was following ffmpeg's documentation / examples and they never even mention there are such parameters... Commented Aug 14, 2013 at 10:15
  • Can you provide a link to these examples? ffmpeg is technically doing what it should: preserving as much of the sample as supported by the encoder (specifically libx264). However, "dumb" players can not handle this so you have to be explicit in telling ffmpeg what you want since it can not guess. Unfortunately this can confuse users and some developers think yuv420p should be the default. Commented Aug 14, 2013 at 16:30
  • @LordNeckbeard FFMpeg track is down, this google search link would be pointing at the page I took the example from. Well, especially if there is a dispute, I think it would be worthwhile to mention this in docs / examples. Also, the quality, given the context, is subjective. What if I understand quality in terms of speed? Commented Aug 14, 2013 at 18:15
  • Oh, here's another reference: trac.ffmpeg.org/wiki/… Commented Aug 14, 2013 at 18:43

1 Answer 1

1

Browsers require certain metadata about the movie to be in the front of the file in order to be able to start playing right away. ffmpeg can achieve this using the -movflags faststart option.

Try:

ffmpeg -loop 1 -i black.png -vcodec libx264 -b 1500k -s 640x360 -t 1 -movflags faststart out.mp4

Note this does a second pass and will increase encoding time. Also be sure to be using a newer version of ffmpeg which supports this flag. More documentation can be found here.

Sign up to request clarification or add additional context in comments.

Comments