Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using ffmpeg to convert gif to mp4 , output doesn't play on android

Tags:

ffmpeg

mp4

gif

I just use the following command to convert a gif file to mp4 but the resulting mp4 file doesn't play in android default video player .
what did I wrong ?
is there any aditional steps should I take to produce android playable mp4 files ?

$ ffmpeg -f gif -i infile.gif outfile.mp4

my test gif file : Test Gif File
My desktop played the output.mp4 very well using VLC Media Player and also MX Player on my android device played the video file without any error.

like image 644
Mahdi Avatar asked Aug 03 '15 07:08

Mahdi


People also ask

How do I convert a GIF to a video on Android?

Whichever Android version you are using, download open Convertio app on your phone browser. Step 1: Search for GIF - Download and save GIF files on your Android phone. Step 2: Set output video format – Click the downward arrow on the MP4 and a drop-down menu will pop up.

Can I export a GIF as MP4?

Can I convert a GIF into a video? Yes, this converter tool quickly and easily transforms GIFs into MP4 video files. Additionally, this convert to MP4 tool is powered by Adobe Premiere, which provides you with professional quality results in seconds.

Can VLC convert GIF to MP4?

Launch VLC. Click on the Media menu, and choose the Convert / Save option from the menu. Go to the File window, click on + Add to select the GIFs you want to convert from your device.

Does FFmpeg support GIF?

By default, FFmpeg uses a generic 256-color palette for every GIF encoding and doesn't take into account the colors in the input video. However, we can use the palettegen and paletteuse filters of FFmpeg to generate a custom palette from the colors in our original video to create a higher-quality GIF.


1 Answers

Try this:

ffmpeg -i file.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4
like image 79
bkucera Avatar answered Oct 07 '22 13:10

bkucera