Opened 11 years ago

Last modified 11 years ago

#1993 open defect

Badly interleaved partial AVI file causes audio/video desync

Reported by: gjdfgh Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: avi
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Reproducible with streams.videolan.org/issues/ffmpeg/yet-another-broken-interleaved-avi.avi and

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

The problem description is exactly the same as #333, except with partial files (the complete test file as linked above works fine, just cutting it makes it fail).

Just like with bug #333 (before it was fixed), it causes desync after some time of normal playback in ffplay/mplayer, and it works correctly with mplayer -demuxer avi.

Compared to playback of the complete file, the following ffplay message is missing:

[avi @ 0x7f94980008c0] non-interleaved AVI

which possibly means that the demuxer fails to recognize the file as badly interleaved if the trailing part of the file is missing.

Change History (5)

comment:1 by Carl Eugen Hoyos, 11 years ago

Keywords: interleaved removed

Please add a command line that allows to reproduce the problem together with complete, uncut console output.

comment:2 by gjdfgh, 11 years ago

On a file cut to the length of 65932192 bytes:

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  

You experience A/V desync and eventually audio underruns after about 50 seconds. mplayer -demuxer avi has no such problems.

comment:3 by Carl Eugen Hoyos, 11 years ago

Reproduced by developer: set
Status: newopen

FFmpeg does not support non-interleaved avi files without index, ie if the index gets removed from a non-interleaved avi, it cannot be played anymore with ffplay and mplayer -demuxer lavf

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:4 by gjdfgh, 11 years ago

mplayer -demuxer avi can play it. You need to add -idx to seek in it.

(I'm assuming the index is located in the last few megabytes of the avi file, so an incomplete avi file would always be without index.)

in reply to:  4 comment:5 by Carl Eugen Hoyos, 11 years ago

Replying to gjdfgh:

mplayer -demuxer avi can play it. You need to add -idx to seek in it.

Sorry, there was a typo in my message, it should read "it cannot be played ... with ffplay and mplayer -demuxer lavf"

Note: See TracTickets for help on using tickets.