[FFmpeg-trac] #11196(avformat:new): ffmpeg is unable to identify/open mpeg 2/3 files with only one frame
FFmpeg
trac at avcodec.org
Tue Sep 17 13:09:58 EEST 2024
#11196: ffmpeg is unable to identify/open mpeg 2/3 files with only one frame
-------------------------------------+-------------------------------------
Reporter: Greisberger | Type: defect
Christophe |
Status: new | Priority: normal
Component: avformat | Version:
| unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
How to reproduce:
{{{
% ffmpeg -i input.21 output.wav
[mp3 @ 000001A7C88A2C00] Format mp3 detected only with low score of 1,
misdetection possible!
[mp3 @ 000001A7C88A2C00] Invalid frame size (768): Could not seek to 768.
[in#0 @ 000001A7C887E040] Error opening input: Invalid argument
Error opening input file input.21.
Error opening input files: Invalid argument
}}}
I tracked the problem in `libavformat/mp3_dec.c` here:
{{{
mp3_read_header(AVFormatContext *s)
{
...
ffio_ensure_seekback(s->pb, i + 1024 + frame_size + 4);
ret = check(s->pb, off + i + frame_size, &header2);
if (ret >= 0 &&
(header & MP3_MASK) == (header2 & MP3_MASK))
{
break;
} else if (ret == CHECK_SEEK_FAILED) {
av_log(s, AV_LOG_ERROR, "Invalid frame size (%d): Could
not seek to %"PRId64".\n", frame_size, off + i + frame_size);
return AVERROR(EINVAL);
}
}}}
It seeks to the end of the 1st (any unique) frame, then fails to read 4
bytes (of course).
With files with at least 2 frames, it works
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11196>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list