FFMPEG不正确的图像扩展编码失败

时间:2014-03-24 08:49:39

标签: ffmpeg

我在图像上使用ffmpeg时遇到问题。我的问题是互联网上的很多图像都有不正确的扩展名(png文件名为.jpg和jpg文件名为.png),这使得ffmpeg失败。

我在互联网上找不到任何文件如何修复?我可以以某种方式强制ffmpeg尝试查看其他编解码器类型,而不仅仅是扩展名建议的吗?

要重现这一点,您只需从互联网上下载png并将其扩展名重命名为.jpg

即使您使用像ffmpeg -i image.jpg这样的最简单的命令,它也会失败:

ffprobe.exe -i tux.jpg -report
ffprobe version N-61663-g19139d8 Copyright (c) 2007-2014 the FFmpeg developers
  built on Mar 20 2014 22:06:17 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 67.100 / 52. 67.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 34.101 / 55. 34.101
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
[AVIOContext @ 00000000041614e0] Statistics: 41236 bytes read, 0 seeks
[mjpeg @ 0000000004160d60] marker=db avail_size_in_buf=41068
[mjpeg @ 0000000004160d60] dqt: invalid precision
[mjpeg @ 0000000004160d60] marker parser used 3 bytes (20 bits)
[mjpeg @ 0000000004160d60] marker=fe avail_size_in_buf=40036
[mjpeg @ 0000000004160d60] marker parser used 2 bytes (16 bits)
[mjpeg @ 0000000004160d60] marker=cf avail_size_in_buf=39899
[mjpeg @ 0000000004160d60] mjpeg: unsupported coding type (cf)
[mjpeg @ 0000000004160d60] marker parser used 0 bytes (0 bits)
[mjpeg @ 0000000004160d60] marker=c3 avail_size_in_buf=39465
[mjpeg @ 0000000004160d60] sof0: picture: 4697x50895
[image2 @ 000000000415fee0] decoding for stream 0 failed
[image2 @ 000000000415fee0] Could not find codec parameters for stream 0 (Video: mjpeg): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
tux.jpg: End of file

PS:我试图提高分析能力,如果不是很明显,那就会发生同样的事情。

1 个答案:

答案 0 :(得分:1)

这不是一个完美的答案,但也许你可以检查失败,然后尝试不同的格式,例如:

ffmpeg -c:v png -i lol.jpg

lol.jpg真是个png。或者,一旦知道了真正的格式,就可以将文件重命名为具有正确的扩展名。