Opened 13 years ago

Closed 12 years ago

#333 closed defect (fixed)

Badly interleaved AVI file not handled

Reported by: Clément Bœsch Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: avi, interleaved
Cc: nfxjfg@googlemail.com Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

The broken file is available at streams.videolan.org/issues/ffmpeg/yet-another-broken-interleaved-avi.avi.

The file seems correctly interleaved, but around 01:08, only video packets seems to be decoded. While MPlayer AVI demuxer is able to handle it ("Badly interleaved AVI file detected - switching to -ni mode..."), FFmpeg AVI demuxer doesn't.

Change History (11)

comment:1 by Carl Eugen Hoyos, 13 years ago

Component: avformatundetermined
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

Works fine with ffmpeg and mplayer -demuxer avi, fails with ffplay and mplayer -demuxer lavf.

$ ffplay yet-another-broken-interleaved-avi.avi
ffplay version N-31287-gc3b6cc6, Copyright (c) 2003-2011 the FFmpeg developers
  built on Jul  7 2011 00:26:57 with gcc 4.5.3
  configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc
  libavutil    51. 11. 0 / 51. 11. 0
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  5. 0 / 53.  5. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 24. 3 /  2. 24. 3
  libswscale    2.  0. 0 /  2.  0. 0
Input #0, avi, from 'yet-another-broken-interleaved-avi.avi':
  Duration: 00:23:29.35, start: 0.000000, bitrate: 1247 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 640x480, 29.97 fps, 29.97 tbr, 29.97 tbn, 30k tbc
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 128 kb/s
[mpeg4 @ 0x12e56e0] looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
  50.14 A-V: -1.450 s:0.0 aq=    0KB vq=15365KB sq=    0B f=0/0   f=0/0
$ mplayer yet-another-broken-interleaved-avi.avi
MPlayer SVN-r33805-4.5.3 (C) 2000-2011 MPlayer Team

Playing yet-another-broken-interleaved-avi.avi.
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO:  [DIVX]  640x480  24bpp  29.970 fps  1105.7 kbps (135.0 kbyte/s)
Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
==========================================================================
Requested audio codec family [mpg123] (afm=mpg123) not available.
Enable it at compilation.
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 128.0 kbit/4.17% (ratio: 15999->384000)
Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
==========================================================================
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
[mpeg4 @ 0xd839c0]looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
Movie-Aspect is undefined - no prescaling applied.
VO: [vdpau] 640x480 => 640x480 Planar YV12
A:  68.6 V:  68.6 A-V:  0.000 ct:  0.000 2057/2057  3%  2%  0.4% 0 0

Badly interleaved AVI file detected - switching to -ni mode...
A:  69.7 V:  69.7 A-V:  0.000 ct:  0.000 2091/2091  3%  2%  0.4% 0 0

Exiting... (Quit)
$ mplayer yet-another-broken-interleaved-avi.avi -demuxer lavf
MPlayer SVN-r33805-4.5.3 (C) 2000-2011 MPlayer Team

Playing yet-another-broken-interleaved-avi.avi.
libavformat file format detected.
[lavf] stream 0: video (mpeg4), -vid 0
[lavf] stream 1: audio (mp3), -aid 0
VIDEO:  [MP4V]  640x480  24bpp  29.970 fps    0.0 kbps ( 0.0 kbyte/s)
Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
==========================================================================
Requested audio codec family [mpg123] (afm=mpg123) not available.
Enable it at compilation.
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 128.0 kbit/4.17% (ratio: 16000->384000)
Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
==========================================================================
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
[mpeg4 @ 0xd839c0]looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
Movie-Aspect is undefined - no prescaling applied.
VO: [vdpau] 640x480 => 640x480 Planar YV12
A:  68.6 V:  68.6 A-V:  0.000 ct:  0.000   0/  0  3%  2%  0.4% 0 0

Too many video packets in the buffer: (4096 in 21598698 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
A:  69.0 V:  71.4 A-V: -2.453 ct: -0.245   0/  0  3%  2%  0.4% 0 0

Exiting... (Quit)

comment:2 by Michael Niedermayer, 13 years ago

Resolution: fixed
Status: openclosed

comment:3 by gjdfgh, 12 years ago

Broken again, with the same sample. I do not know when it regressed.

comment:4 by gjdfgh, 12 years ago

Cc: nfxjfg@googlemail.com added
Component: undeterminedavformat
Resolution: fixed
Status: closedreopened

comment:5 by Carl Eugen Hoyos, 12 years ago

Since it works fine here, could one of you add a command line that allows to reproduce the problem together with complete, uncut console output?

comment:6 by gjdfgh, 12 years ago

ffplay yet-another\ broken-interleaved-avi.avi 
ffplay version N-47444-gb5ffbcd Copyright (c) 2003-2012 the FFmpeg developers
  built on Dec  5 2012 09:40:30 with gcc 4.7 (Debian 4.7.2-4)
  configuration: --prefix=/mnt/meh/chaos/source/normal/mpv/build_libs --enable-static --disable-shared --enable-avresample --enable-openssl --enable-gpl --enable-nonfree --disable-debug --enable-libx264 --enable-vaapi
  libavutil      52. 11.101 / 52. 11.101
  libavcodec     54. 79.100 / 54. 79.100
  libavformat    54. 44.100 / 54. 44.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 24.100 /  3. 24.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, avi, from 'yet-another broken-interleaved-avi.avi':
  Duration: 00:23:29.35, start: 0.000000, bitrate: 374 kb/s
    Stream #0:0: Video: mpeg4 (DIVX / 0x58564944), yuv420p, 640x480, 29.97 fps, 29.97 tbr, 29.97 tbn, 30k tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s
[mpeg4 @ 0x90f0c80] looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
Frame changed from size:0x0 to size:640x480
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   
  52.52 A-V: -4.707 fd=   0 aq=    0KB vq=15364KB sq=    0B f=0/0   

That's about 50 seconds in. A-V difference keeps getting worse from this point. The ALSA warnings are merely because ffplay doesn't feed it enough audio, and not a problem with my audio setup. File is linked in the top post.

comment:7 by Carl Eugen Hoyos, 12 years ago

Note the "non-interleaved AVI" line

$ md5sum yet-another-broken-interleaved-avi.avi
f93d8d482be9111bad1834a0acdaf5d7  yet-another-broken-interleaved-avi.avi
$ ffplay yet-another-broken-interleaved-avi.avi
ffplay version N-47444-gb5ffbcd Copyright (c) 2003-2012 the FFmpeg developers
  built on Dec  5 2012 10:36:55 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 11.101 / 52. 11.101
  libavcodec     54. 79.100 / 54. 79.100
  libavformat    54. 44.100 / 54. 44.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 24.100 /  3. 24.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[avi @ 0x7f94980008c0] non-interleaved AVI
Input #0, avi, from 'yet-another-broken-interleaved-avi.avi':
  Duration: 00:23:29.35, start: 0.000000, bitrate: 1247 kb/s
    Stream #0:0: Video: mpeg4 (DIVX / 0x58564944), yuv420p, 640x480, 29.97 fps, 29.97 tbr, 29.97 tbn, 30k tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s
[mpeg4 @ 0x7f949802b500] looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
Frame changed from size:0x0 to size:640x480   4KB sq=    0B f=0/0
  52.56 A-V:  0.010 fd=   0 aq=   10KB vq=   26KB sq=    0B f=0/0
Last edited 12 years ago by Carl Eugen Hoyos (previous) (diff)

comment:8 by gjdfgh, 12 years ago

So what's the difference? How to proceed? Just to be sure, I made a clean build of ffmpeg with no additional config option. Output with -loglevel debug:

ffplay ../yet-another\ broken-interleaved-avi.avi -loglevel debug
ffplay version N-47450-g217b10d Copyright (c) 2003-2012 the FFmpeg developers
  built on Dec  5 2012 11:03:58 with gcc 4.7 (Debian 4.7.2-4)
  configuration: --prefix=/tmp/ffmpeg_temp
  libavutil      52. 11.101 / 52. 11.101
  libavcodec     54. 79.100 / 54. 79.100
  libavformat    54. 44.100 / 54. 44.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 24.100 /  3. 24.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
[avi @ 0x90344a0] Format avi probed with size=2048 and score=100
[avi @ 0x9003100] use odml:1
st:0 removing common factor 10 from timebase
st:1 removing common factor 384 from timebase
[avi @ 0x90344a0] File position before avformat_find_stream_info() is 10252
[avi @ 0x90344a0] All info found
rfps: 29.666667 0.013650
    Last message repeated 1 times
rfps: 29.750000 0.007180
    Last message repeated 1 times
rfps: 29.833333 0.002771
    Last message repeated 1 times
rfps: 29.916667 0.000422
    Last message repeated 1 times
rfps: 30.000000 0.000134
    Last message repeated 1 times
rfps: 30.083333 0.001906
    Last message repeated 1 times
rfps: 30.166667 0.005738
    Last message repeated 1 times
rfps: 30.250000 0.011631
    Last message repeated 1 times
rfps: 30.333333 0.019584
    Last message repeated 1 times
rfps: 59.583333 0.018872
    Last message repeated 1 times
rfps: 59.666667 0.011084
    Last message repeated 1 times
rfps: 59.750000 0.005356
    Last message repeated 1 times
rfps: 59.833333 0.001688
    Last message repeated 1 times
rfps: 59.916667 0.000081
    Last message repeated 1 times
rfps: 60.000000 0.000534
    Last message repeated 1 times
rfps: 29.970030 0.000000
    Last message repeated 1 times
rfps: 59.940060 0.000000
    Last message repeated 1 times
[avi @ 0x90344a0] File position after avformat_find_stream_info() is 303757
Input #0, avi, from '../yet-another broken-interleaved-avi.avi':
  Duration: 00:23:29.35, start: 0.000000, bitrate: 374 kb/s
    Stream #0:0, 41, 100/2997: Video: mpeg4 (DIVX / 0x58564944), yuv420p, 640x480, 1/30000, 29.97 fps, 29.97 tbr, 29.97 tbn, 30k tbc
    Stream #0:1, 40, 3/125: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s
[mpeg4 @ 0x903c920] detected 2 logical cores
[mpeg4 @ 0x904c140] looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
Frame changed from size:0x0 to size:640x480  14KB sq=    0B f=0/0   
[buffer @ 0x903c8a0] Setting entry with key 'video_size' to value '640x480'
[buffer @ 0x903c8a0] Setting entry with key 'pix_fmt' to value '0'
[buffer @ 0x903c8a0] Setting entry with key 'time_base' to value '100/2997'
[buffer @ 0x903c8a0] Setting entry with key 'pixel_aspect' to value '0/1'
[ffplay_buffer @ 0x9078de0] w:640 h:480 pixfmt:yuv420p tb:100/2997 fr:0/1 sar:0/1 sws_param:
[ffplay_crop @ 0x903da40] w:640 h:480 sar:0/1 -> w:640 h:480 sar:0/1
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred  0B f=0/0   

comment:9 by Carl Eugen Hoyos, 12 years ago

Could you confirm the md5sum?

comment:10 by gjdfgh, 12 years ago

My test file was cut short (I probably wanted to save some space...). You can create a test file with:

dd if=yet-another-broken-interleaved-avi.avi of=test.avi bs=1048576 count=200

Note that this is almost the full file. md5sum: 96accaf5878be60f076a50038f85339c

mplayer -demux avi handles this fine (even without -idx, although it requires -idx for seeking), ffplay doesn't.

Shall I create a new ticket for this problem, or can I leave this ticket open?

comment:11 by Carl Eugen Hoyos, 12 years ago

Resolution: fixed
Status: reopenedclosed

Please open a new ticket.

Note: See TracTickets for help on using tickets.