FFMPEG - Not finding codec parameters
Asked Answered
T

5

15

I'm trying to convert a sequence of images into a mpeg movie via FFMPEG, although I keep getting an error saying that it could not find the code parameters (Video: mjpeg). A Google search did not bring much up that was useful.

ffmpeg -f image2 -i /tmp/img%03d.jpg video.mpgFFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5.1-1ubuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Mar  4 2010 12:35:30, gcc: 4.4.3
[mjpeg @ 0x9069870]dqt: 16bit precision
[mjpeg @ 0x9069870]mjpeg: unsupported coding type (c9)
[mjpeg @ 0x9069870]mjpeg: unsupported coding type (cf)
[mjpeg @ 0x9069870]only 8 bits/component accepted
[mjpeg @ 0x9069870]dqt: 16bit precision
[mjpeg @ 0x9069870]huffman table decode error
[mjpeg @ 0x9069870]mjpeg: unsupported coding type (ca)
[mjpeg @ 0x9069870]mjpeg: unsupported coding type (ce)
[mjpeg @ 0x9069870]mjpeg: unsupported coding type (cb)
[mjpeg @ 0x9069870]decode_sos: invalid len (60581)
[mjpeg @ 0x9069870]only 8 bits/component accepted
[mjpeg @ 0x9069870]decode_sos: invalid len (56833)
[mjpeg @ 0x9069870]invalid id 207
[mjpeg @ 0x9069870]mjpeg: unsupported coding type (cd)
[mjpeg @ 0x9069870]huffman table decode error
[image2 @ 0x90682c0]Could not find codec parameters (Video: mjpeg)
/tmp/img%03d.jpg: could not find codec parameters

The images reside in the /tmp directory with names such as img001.jpg and img002.jpg.

Any ideas?

Thanks -Tanner

Thermoelectricity answered 17/9, 2010 at 13:43 Comment(1)
Baseline JPEG doesn't support 16-bit precision, but JPEG 2000 does.Maccabees
S
9

What ffmpeg is actually trying to tell you is, that your file has extension of jpeg, but the file actually is bmp or some other format.

Make sure that the file is encoded in jpeg and the problem will disappear.

Selfness answered 30/8, 2011 at 7:15 Comment(1)
It may be useful to do a sanity check of your images by running the command with just one: -i /path/to/single_image.jpg, as improperly setting up the input list can result in red herrings, which may have landed you on this post. -i and the related image2 flags, pattern_type, start_number, etc, can be a little confusing initially, see ffmpeg.org/ffmpeg-formats.html#image2-1Bullring
S
5

Some people here say that it is because the mjpeg codec cannot really be found. They suggested installing it from the source. I feel that it is more likely that the mjpeg is not installed. I feel there are two solutions for this.

  1. You can try to install that codec and see if it helps MJpeg Download For Win
  2. You can try forcing the ffmpeg to export it into a different codec Try: ffmpeg -f image2 -i /tmp/img%03d.jpg -vcodec mpeg2video video.mpg
Sartin answered 17/9, 2010 at 13:57 Comment(3)
I compiled and installed it from source and I still get the error. It seems as though the MJPG is not the same thing as is Windows only. I'm compiling and executing this on a Ubuntu machine.Thermoelectricity
I would try forcing a different codec using -vcodec, at least to see if it works.Sartin
Ill do some testing and get back with you.Sartin
L
3

It may be necessary to specify the input codec for the series of images. Note the -c:v gif addition in the second example, to be placed before the input source:

$ ffmpeg -f image2 -i %03d.gif zzz.webm
# Error: %03d.gif: could not find codec parameters

$ ffmpeg -f image2 -c:v gif -i %03d.gif zzz.webm
# Works! ffmpeg version 2.7
Leyes answered 26/2, 2016 at 21:35 Comment(1)
This is the first place where I saw that you can specify the input codec to use. It solved my similar problem.Michaels
M
3

There can be several issues of FFmpeg not being able decode your image. Other answers aren't insightful on this issue, none addressed the issue of unsupported coding algorithms.

The JFIF standard allows for Huffman or Arithmetic coding (Annex B.1.1.5). FFmpeg's implementation however, doesn't consider for Arithmetic coding, it outputs similar error messages to yours.


# query the coding type
exiftool image.jpg | grep -i "encoding"
Maccabees answered 15/10, 2019 at 9:2 Comment(2)
This is the correct approach, I am able to identify the image have unsupported encoding (or my case not showing any coding algorithm) and then make it Huffman.Duvetyn
ImageMagick supports other coding algorithms rather than only Huffman.Maccabees
P
0

Try this:

ffmpeg -f image2 -i /tmp/img%03d.**jpeg** video.mpg

Actually, I have a similar problem here .. (and solved).

I have a sequence of images named file-001, file-002 etc (.tiff files). I forgot to give an extension ".tiff", so I got an error when I ran ffmpeg command

ffmpeg -f image2 -i file-%03d.tiff video.mpg

It was solved when I renamed the files by adding ".tiff" extension.

Pastry answered 25/9, 2011 at 15:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.