Use byte seeking when time to seek is given in percentage #77

GoogleCodeExporter opened this Issue Mar 15, 2015 · 6 comments


None yet
3 participants
The default seeking method in ffmpegthumbnailer-2.0.6 (linked against 
ffmpeg-0.6) is always failing with my MPEG2-TS files and the first frame is 
used instead:

> ffmpegthumbnailer -t 30 -i video.ts -o thumb.jpg
[mpeg2video @ 0x822d8f0]mpeg_decode_postinit() failure
[mpegts @ 0x82292a0]max_analyze_duration reached
[NULL @ 0x822e890]start time is not set in av_estimate_timings_from_pts
[NULL @ 0x822f060]start time is not set in av_estimate_timings_from_pts
Seeking in video failed, will use first frame
[mpeg2video @ 0x822d8f0]mpeg_decode_postinit() failure
[mpegts @ 0x8229250]max_analyze_duration reached
[NULL @ 0x822cc70]start time is not set in av_estimate_timings_from_pts
[NULL @ 0x822f250]start time is not set in av_estimate_timings_from_pts

However, thumbnailing works nicely if seeking is done directly with byte 
offsets (AVSEEK_FLAG_BYTE) as implemented in the attached patch.

Original issue reported on by on 10 Jan 2011 at 12:05


Thanks for the effort, can you provide me with a file that fails so I can have 
a look at it?

Original comment by dirk.vdb on 14 Jan 2011 at 10:03

  • Changed state: Accepted
You can use for example this one with a command-line option "-t 50":

Without byte seeking a first frame is always used with all streaming containers 
that don't contain any duration information (i.e. MPEG2-TS). However, it might 
be convenient to add a new command-line option for the byte seeking as 50% of 
duration isn't exactly in the middle of the file (especially if VBR is used), 
but it's usually close enough.

Original comment by on 19 Jan 2011 at 1:45

I applied the patch to ffmpegthumbnailer-2.0.2 because 2.0.6 is not working on 
Linux Debian Lenny because of too old version libavcodec51.

It works fine on MPEG2-TS files in SD resolution (720x576) but there's a 
problem on TS files in HD resolution (1920×1080). There are plenty of errors 

[h264 @ 0x7f3ed8d03760]non existing PPS referenced
[h264 @ 0x7f3ed8d03760]decode_slice_header error
[h264 @ 0x7f3ed8d03760]no frame!
[h264 @ 0x7f3ed8d03760]B picture before any references, skip
[h264 @ 0x7f3ed8d03760]decode_slice_header error
[h264 @ 0x7f3ed8d03760]no frame!

Is this a known issue?


Original comment by on 16 Jun 2011 at 4:28

Updated the patch for recent ffmpeg library versions.

Original comment by on 12 Aug 2013 at 1:06


Has this been integrated into the main release, or do we still need the patch? I experience this issue on verson 2.0.7


dirkvdb commented Jul 18, 2015

I tried the patch but I see issues on other file formats. It needs some more investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment