1

I am trying to convert a GIF to a MP4. I am getting an error while doing that with specific parameters. What am I doing wrong? Any help would be nice. I would like a mp4 video with high quality, size is not a problem.

Command and log :

ffmpeg -i So_gehts.gif -c:v libvpx -crf 4 -b:v 500K output.mp4
ffmpeg version 2.7.6-0ubuntu0.15.10.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
  configuration: --prefix=/usr --extra-version=0ubuntu0.15.10.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-openal --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxvid --enable-libzvbi --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-libssh --enable-libsoxr --enable-libx264 --enable-libopencv --enable-libx265
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, gif, from 'So_gehts.gif':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: gif, bgra, 374x461, 29.25 fps, 100 tbr, 100 tbn, 100 tbc
File 'output.mp4' already exists. Overwrite ? [y/N] y
[libvpx @ 0x16a5940] v1.4.0
[mp4 @ 0x168ec60] Could not find tag for codec vp8 in stream #0, codec not currently supported in container
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf56.36.100
    Stream #0:0: Video: vp8 (libvpx), yuva420p, 374x461, q=-1--1, 500 kb/s, 100 fps, 100 tbn, 100 tbc
    Metadata:
      encoder         : Lavc56.41.100 libvpx
Stream mapping:
  Stream #0:0 -> #0:0 (gif (native) -> vp8 (libvpx))
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Any help would be nice. Thank you.

5

From your error message...

codec not currently supported in container

I don't think you can use VP8 with an MP4. Try a different codec or container format? I've provided some examples with links to documentation below.

MP4 w/ x264:

ffmpeg -i So_gehts.gif -c:v libx264 -crf 4 -b:v 500K output.mp4

MP4 w/ x264 (lossless):

ffmpeg -i So_gehts.gif -c:v libx264 -preset veryslow -qp 0 output.mp4

WebM w/ VP8:

ffmpeg -i So_gehts.gif -c:v libvpx -crf 4 -b:v 1M output.webm

WebM w/ VP9:

ffmpeg -i So_gehts.gif -c:v libvpx-vp9 -crf 0 -b:v 0 output.webm
  • The libx264 worked. It has increased the size of the video, does it have any change in quality as well? – We are Borg Apr 5 '16 at 8:03
  • VP8/VP9 should be of comparable quality to x264. If you're curious, you can always create a WebM with VP8 and a WebM with VP9 and compare all three. – Ryan Apr 5 '16 at 8:05
  • The mp4 didn't work in browser, had to use the webm. Thanks.. :-) – We are Borg Apr 5 '16 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.