The task is to convert gif to 2 video formats. There are no problems with webm, I apply

$ ffmpeg -f gif -i in.gif out.webm 

Everything is perfectly processed and works in browsers. I apply the same for mp4

 $ ffmpeg -f gif -i in.gif out.mp4 

There are no errors, the video is saved without any problems, but at the same time mp4 refuses to play in any browser except chrome. What could be the problem?

Other browsers support mp4, it works great on other sites, but I do not. If you download the video and run through any of the programs for viewing, then just a black screen for the entire time of the video.

UPD

I tried a bunch of other ways, including tips from the English-speaking SO, does not work everywhere except chrome. What kind of secret technology uses chrome?)

Here is what he writes to the console when converting

File 1.gif

File 2.gif after converting , Yandex converts it into a flash or does something with it and it starts working in all browsers :(

And if I just open the path to the file on the site after conversion, it will be (in the opera):

screen

In chrome, the video works, in the fox "the video can not be played, because the file is damaged ...

Here is a link to the 2.mp4 file, which is obtained after processing (not converted):

link

In any program, it opens as a black screen.

UPD

I would sin on browsers or codecs if the files: site / file.mp4 did not open on other sites (no flash, just a video object, where the source shows the path to mp4, which I do), and they open ... .

UPD

9 hour fight with mp4, nothing helps. Has nobody come across this or a similar task?

    2 answers 2

    Necropolis, but still.

    I tried to make from your 1.gif mp4 using the second command: the file opened normally in Firefox (45.0), ffmpeg - 3.0.

    Second, specify -pix_fmt yuv420p , as recommended by ffmpeg itself. But the trouble is: the h264 codec used by default is able to work with permissions multiple of two. You have the same - 477 width. Solution: sprinkle an image by 1 pixel:

     ffmpeg -i 1.gif -pix_fmt yuv420p -vf crop=476 out.mp4 

    In addition, it is worth trying other codecs:

     ffmpeg -i 1.gif -c:v mpeg2video out.mp4 ffmpeg -i 1.gif -c:v mpeg4 out.mp4 

      Try:

       ffmpeg -i in.gif -pix_fmt yuv420p out.mp4