8

I am trying to find the magic options that make mp4 work in Chrome. I think my videos were working, but don't seem to any more after Chrome updated.

Chrome, Version 41.0.2272.101 (Windows)

I tried some other machines and found some of the videos worked on older versions, and my Mac seems to still work on the latest Chrome.

I am using the ffmpeg options to convert from png series,

ffmpeg -framerate 10 -i dance%02d.png  -r 10 -pix_fmt yuv420p dance.mp4

Some videos work, some don't, some work some of the time, or stop half way through.

I tried various other options like,

ffmpeg -start_number 16 -framerate 10 -i dance%02d.png -r 10 -an -s hd720 \
-vcodec libx264 -pix_fmt yuv420p -preset slow -profile:v baseline \
-movflags faststart -y dance.mp4

but this just seemed to make things worse.

here is one of the videos, http://www.botlibre.com/media/a786625.mp4

and another one, http://www.botlibre.com/media/a812450.mp4

Firefox seems to work no problem, on any version, grey background though. IE works fine, white background. Safari works, grey background.

Another thing, they videos used to have white background on older Chrome version, but now are grey, except on Mac still white.

and one more thing. Webm format works, but anyone know the option to remove transparency? I'm using,

ffmpeg -i dance%02d.png  -r 10 -c:v libvpx -crf 10 -b:v 512k -c:a libvorbis dance.webm

just want a solid white background.

llogan
  • 121,796
  • 28
  • 232
  • 243
James
  • 17,965
  • 11
  • 91
  • 146
  • To remove tranparency you could use a filter like ` format=rgba,lutrgb=a=minval`. See [this](http://stackoverflow.com/questions/11260930/ffmpeg-splitting-rgb-and-alpha-channels-using-filter). Or just flatten the images with a white background before encoding using convert. – aergistal Mar 24 '15 at 10:46

1 Answers1

3

The video provided works fine with Chrome v. 44 (although, now both links are down). As you state you think the videos worked before you upgraded to v. 41, it indicates a bug in Chrome in the version 41 to (possibly) 43.

As to the background. PNGs are often transparent and the encoded MP4 stream seem to be encoded as 32-bit stream (24-bit colors, 8-bit alpha). Only webm truly supports alpha in the browser (and currently only with Chrome and Opera).

Chrome uses FFmpeg to decode mp4 video and Firefox uses whatever the host system provides. The different background colors is to indicate transparency as the video isn't actually shown with the alpha channel available.

The recommended way is to render out your frames without the alpha channel (if you are not gonna use it for anything), or to convert the PNG-sequence into a non-alpha channel PNG before decoding them into a video. This is both for mp4 and webm.

  • 1
    Yes, seemed to be a Chrome bug that has been fixed since. I guess I will capture the image series without the alpha and regenerate the videos. I do want the alpha, and it works for webm, but I guess I need a separate images series for mp4. – James Apr 22 '15 at 00:05