Changes between Version 1 and Version 2 of Seeking with FFmpeg
- Timestamp:
- 07/24/2012 10:57:13 PM (11 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Seeking with FFmpeg
v1 v2 10 10 }}} 11 11 12 [[Image(out1.jpg)]] 13 12 14 This example will produce 1 image frame (out1.jpg) somewhere around 3rd minute from the beginning of the movie. The input will be parsed '''using keyframes''', which is '''very fast'''. The drawback is that it will also finish the seeking at some keyframe, not necessarily located at specified time (00:03:00), so the seeking will not be as accurate as expected. 13 15 … … 20 22 }}} 21 23 22 This example will also produce 1 image frame (out2.jpg) precisely at 3rd minute from the beginning of the movie. The input is parsed '''very slowly''', frame by frame. The advantage is that you'll get the frame at exactly 3rd minute, but the drawback is that it will take a lot of time until it finally reaches that time point. The bigger the seeking time is, the longer you will have to wait. 24 [[Image(out2.jpg)]] 25 26 This example will also produce 1 image frame (out2.jpg) precisely at 3rd minute from the beginning of the movie. 27 28 ''Note the time difference on the clocks between the images out1.jpg and out2.jpg. The first one shows "00:02:05:05" and the second shows "00:02:05:06".'' 29 30 The input is parsed '''very slowly''', frame by frame. The advantage is that you'll get the frame at exactly 3rd minute, but the drawback is that it will take a lot of time until it finally reaches that time point. The bigger the seeking time is, the longer you will have to wait. 23 31 24 32 = Fast and accurate seeking = … … 30 38 }}} 31 39 40 [[Image(out3.jpg)]] 41 32 42 This approach is combining the best characteristics of both fast and accurate ways of seeking in FFmpeg. Shortly, we first seek very fast somewhere before the 3rd minute and then we slow down and seek frame by frame to the 3rd minute. This works because FFmpeg will first seek by keyframes, until it reaches at 00:02:30, when it will stop at the last keyframe found (somewhat before 00:02:30, depending on the [http://en.wikipedia.org/wiki/Group_of_pictures gop size]/keyframes interval of the input) and then it will slowly seek the next 00:00:30 seconds to the desired time point. The result should be the same as in "Accurate seeking" section, only a lot faster. 33 43 34 For the reference, compare the attached images of out1.jpg, out2.jpg and out3.jpg 44 ''Note that both out2.jpg and out3.jpg show the same time on the clock "00:02:05:06"''


