using ffmpeg to convert gif to mp4 , output doesn&

2019-05-07 17:44发布

问题:

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.

回答1:

Try this:

ffmpeg -i file.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4


回答2:

You can use this:

ffmpe -f gif -i firstFile.gif -pix_fmt yuv420p -c:v libx264 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' result.mp4


标签: ffmpeg gif mp4