Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#7 closed defect (fixed)

seeking back to beginning of file sometimes fails badly

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


Hello, I have a bunch of DV videos in avi containers. They play fine in Windows Media Player or Quicktime, apparently with no errors/warnings. ffplay (linux or Windows) instead fails in:

  • seeking at any position;
  • determining video end.

What I'm trying to do for now is just playing them with ffplay <filename>.

The ffplay output is:

Input #0, avi, from 'dvvideo-seek-end-detection-problems.avi':

Duration: 00:00:10.96, start: 0.000000, bitrate: 30336 kb/s

Stream #0.0, 1, 1/25: Video: dvvideo, yuv420p, 720x576, 1/25, 28800 kb/s, PAR 59:54 DAR 295:216, 25 tbr, 25 tbn, 25 tbc
Stream #0.1, 1, 1/30000: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s

The error while seeking, even with -loglevel debug, is just "error while seeking" and seems to not work at all. After 10 seconds the video stream is clearly ended but the playback seems to continue indefinitely with no errors. Again, no problems with WMP or Quicktime.

I have uploaded one to a safe area with direct link [1]. It's ~40mb for 10 secs playback.


It follows "ffplay" output with no arguments.

FFplay version 0.6-4:0.6-2ubuntu6, Copyright (c) 2003-2010 the FFmpeg developers

built on Oct 5 2010 22:36:53 with gcc 4.4.5
configuration: --extra-version=4:0.6-2ubuntu6 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0

Change History (7)

comment:1 Changed 5 years ago by fpretto

My bad: the time increment for left or right keys was 10 seconds, and for 10 seconds videos this results in the not very helpufl "error while seeking" but seek was ok. I was confused by problems in other project (libvlc) using ffmpeg as backend, sorry. I supposed you can close as Invalid, but in the mean time I'm trying to understand if ending detection is really faulty or not.

comment:2 Changed 5 years ago by fpretto

I tried other videos and they all results in the playback time still incrementing even after the video stream is ended. Unsure if this is supposed to be correct or not in ffplay, anyway there doesn't seems to be any problem in core ffmpeg libraries. Please set this bug as invalid. Sorry to have disturbed you, as told was really confused by problems in other software.

comment:3 Changed 5 years ago by cehoyos

  • Component changed from avcodec to FFplay
  • Keywords dvvideo seek end removed
  • Reproduced by developer set
  • Status changed from new to open
  • Summary changed from dvvideo seek/end detection problems to seeking back to beginning of file sometimes fails badly

Note that there is a problem that was reported before (issue 1730) and is also reproducible with your sample:
If you play with ffplay, and immediately seek back, instead of seeking to the beginning, the "error while seeking" message is shown (and later on, if the sample were longer, playback gets corrupted / starts to loop seemingly randomly).

comment:4 Changed 5 years ago by DonMoir

Not directly related to ffplay, but what I find in my own app, is on a file by file basis seeking to start (rewind) does not work consistently and sometimes badly. Audio can be out of sync etc. Some file formats work well and some not. Sometimes a seek by byte just fails to seek on some files. Sometimes seek by frame works and sometimes not. So you get the picture. I have not taken the time to identify all this here yet as I need to get back to the seek issues in general.

The only way I have gotten this to work for all files is to do a parital shutdown of ffmpeg related file handling and restart. Fortunately, my seamless loops still look seamless when doing this on a relatively slow machine.

The easiest possible seek should be a rewind type and even if you had to specialize this it might be helpful. The real answer of course is to revisit seeking all together.

comment:5 Changed 5 years ago by cehoyos

  • Keywords seek added
  • Version set to git-master

comment:6 Changed 4 years ago by michael

  • Resolution set to worksforme
  • Status changed from open to closed

I cant reproduce any problem with seeking in this dv file with the current ffmpeg git. also to exit on end theres -autoexit

comment:7 Changed 4 years ago by cehoyos

  • Resolution changed from worksforme to fixed
Note: See TracTickets for help on using tickets.