我正在尝试将 GIF 转换为 MP4。我在使用特定参数执行此操作时遇到错误。我究竟做错了什么?你能帮忙的话,我会很高兴。我想要一个高质量的mp4视频,大小不是问题。
命令和日志:
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
你能帮忙的话,我会很高兴。谢谢。
答案1
从你的错误信息来看...
codec not currently supported in container
我认为 VP8 不能与 MP4 一起使用。尝试不同的编解码器或容器格式?我提供了一些示例以及下面的文档链接。
ffmpeg -i So_gehts.gif -c:v libx264 -crf 4 -b:v 500K output.mp4
ffmpeg -i So_gehts.gif -c:v libx264 -preset veryslow -qp 0 output.mp4
ffmpeg -i So_gehts.gif -c:v libvpx -crf 4 -b:v 1M output.webm
ffmpeg -i So_gehts.gif -c:v libvpx-vp9 -crf 0 -b:v 0 output.webm