[FFmpeg-user] Probing jpg, png and tiff images without decoding frames

Paul B Mahol onemda at gmail.com
Wed Aug 7 14:17:28 CEST 2013


On 8/6/13, Robert Krueger <krueger at lesspain.de> wrote:
> On Tue, Aug 6, 2013 at 1:23 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>> Robert Krueger <krueger <at> lesspain.de> writes:
>>
>>> it seems the ffmpeg always decodes the listed
>>> types of images to determine their properties.
>>
>> In your email's subject, you used the term "probing"
>> which is defined for FFmpeg / libavformat.
>> For all listed image formats, FFmpeg does no probing,
>> it guesses the format reading the file suffix.
>> (Something FFmpeg does not do for nearly all formats
>> it supports.)
>>
>>> What I did to check this, was to run
>>> ffmpeg -i <imagefile> as well as
>>> ffprobe -show_streams <imagefile> with each of
>>> these formats and set a breakpoint in
>>> avcodec_decode_video2.
>>
>> I don't think it is generally possible to find out
>> properties of image files (that is apparently what
>> you need) without calling this function.
>
> apparently my writing is too imprecise. So let me try another time to
> avoid misunderstandings.
>
> So are you saying that for the given file formats it is technically
> not possible to find out resolution and pixel format without decoding
> an entire frame or that it is currently not possible with
> ffmpeg/libavformat/libavcodec?

Yes, it is currently not possible, but I guess one could hack something
which will just add some private option to interested decoder(s) to just fetch
headers - without actual uncompressing of frames.

One could also write raw image demuxers in lavf which would just do that,
which would need bigger changes in img2 (de)muxer.

>
> Or formulated in another way: I am looking for a way to extract this
> type of metadata from these file types with a lot fewer system
> resources than are currently used when calling
> avformat_find_stream_info, the way it is done when using the command
> line tools. Is there a way to do this with the current code or is this
> generally not possible?
>
> Is it clear now what my goal is and what the actual question is? If
> there is a solution that requires using the libraries in a certain
> way, this thread should probably be moved to libav-user.

Everything is exceptionaly clear.


More information about the ffmpeg-user mailing list