Opened 5 years ago

Last modified 4 years ago

#2199 open defect

ffplay: stop time counter at the end of file

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


C:\>ffplay ayaneshk-test.avi
ffplay version N-49268-ge9d443c Copyright (c) 2003-2013 the FFmpeg developers
  built on Jan 24 2013 23:27:01 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --e
nable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --e
nable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --en
able-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable
-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 15.103 / 52. 15.103
  libavcodec     54. 90.100 / 54. 90.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 33.100 /  3. 33.100
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, avi, from 'ayaneshk-test.avi':
  Duration: 00:54:09.58, start: 0.000000, bitrate: 2 kb/s
    Stream #0:0: Video: msmpeg4v3 (DIV5 / 0x35564944), yuv420p, 512x384, 29.97 t
br, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 k
Frame changed from size:0x0 to size:512x384
  10.31 A-V: -0Truncating packet of size 7845 to 5101    0B f=0/0
[msmpeg4 @ 02661280]   10.ignoring overflow at 17 15=    0B f=0/0
51 A-V[msmpeg4 @ 02661280] ac-tex damaged at 17 15
:  0.0[msmpeg4 @ 02661280]
error while decoding block: 17 x 15 (2)
01 fd=[msmpeg4 @ 02661280]    1 aError at MB: 512
q=    [msmpeg4 @ 02661280] concealing 351 DC, 351 AC, 351 MV errors in P frame
[mp3 @ 0266fa60] incomplete frame  0KB vq=    0KB sq=    0B f=0/0
  14.37 A-V:  0.013 fd=   1 aq=    0KB vq=    0KB sq=    0B f=0/0

Change History (5)

comment:1 Changed 5 years ago by cehoyos

  • Component changed from undetermined to FFplay
  • Reproduced by developer set
  • Status changed from new to open
  • Version changed from unspecified to git-master

comment:2 Changed 4 years ago by MattE

For the case where autoexit is set to true, this is not a problem because it just ends. However, for the case where autoexit is false, this can be easily solved by setting pause to true when we reach the end. This will stop the audio from repeating.

On the other hand, pause doesn't seem to work for the end of this video: rtsp:// on this page: which is having the same issue. I'm not sure why.

comment:3 Changed 4 years ago by MattE

The problem appears to be that at the line

if ((packet_queue_get(&is->audioq, pkt, 1, &is->audio_pkt_temp_serial)) < 0)

the queue is set to block until another packet arrives, but no packet will arrive since we reached the end of the video so it gets stuck here and sdl keeps on replaying the old buffer. I'm not sure why no eof signal is sent for this video.

The proper way to fix this is to copy the silence buffer once a certain length of time has elapsed (i.e. the time when new audio has to be heard by user yet we have not received audio for). Doing that will also fix the issue where if you play a internet file and it's slow, the audio keeps on repeating itself during these delays. This will force it to be quiet as well as solve the original bug without having to pause it.

comment:4 Changed 4 years ago by MattE

Sorry for the spam, but I figured out how to solve the issue for both linked files as well as keep audio from looping during network delays. Change:

if ((packet_queue_get(&is->audioq, pkt, 1, &is->audio_pkt_temp_serial)) < 0)


if ((packet_queue_get(&is->audioq, pkt, 0, &is->audio_pkt_temp_serial)) < 0)

to make it non-blocking. And then change

} else if (!block) {
    ret = 0;


} else if (!block) {
    ret = -1;

This is not a problem since this will be the only place in the code calling packet_queue_get with block=0 so only this will be affected by the change.

I'm on Windows so I cannot patch and test easily, so please someone apply this change.


comment:5 Changed 4 years ago by llogan

Please provide a patch using "git format-patch" to the ffmpeg-devel mailing list.

Note: See TracTickets for help on using tickets.