When av_find_stream_info returns an error (i.e. < 0) I'm trying to determine
whether it's because the input file has no audio in it or because of some
transient error (e.g. some OS error, out of memory, etc.).

In r24518 of libavformat/utils.c, av_find_stream_info calls
av_read_frame_internal.  If av_read_frame_internal fails with something
besides AVERROR(EAGAIN), its actual return value is ignored, and assuming
av_find_stream_info doesn't find codec parameters, it returns -1.

It seems like it'd be easier to interpret the return value of
av_find_stream_info if it either passed along the return value of
av_read_frame_internal or returned AVERROR_INVALIDDATA in this case.

I could probably bypass all of this if there's a better way to find out
whether a file has valid audio in it.  For this particular file (attached),
av_open_input_file succeeds while logging this message:

Format detected only with low score of 1, misdetection possible!

Before returning -1, av_find_stream_info logs these messages:

Header missing
Header missing
Could not find codec parameters (Audio: mp3, 0 channels, s16)
Estimating duration from bitrate, this may be inaccurate

This file is meant to be difficult on purpose.  It's an APE tag with binary
info that looks like the beginning of an mpeg frame.  Ideally libav would be
able to figure out that it's an APE tag and not actual audio.

Can someone help point me to some info beyond av_find_stream_info's return
value for figuring this out?  I'm new to libav, so if the solution here is
to add something to the probing code to teach it about APE tags, some
pointers in that direction would be a bonus.

Thanks much.

-DB

Attachment: ape_with_binary_item.mp3
Description: audio/mpeg

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to