I spend some hours to debug the issue. Here is the story:
1) I used FFMPEG. I found thumbnails was missing sometimes. For example, I set to 5 thumbnails but only 4 shown. I got error in Drupal log: "PHPVideoToolkit Error: Execute error. Output for file "/srv/www/htdocs/sites/default/files/videos/original/4how_the_private_file_system_works_1.mp4" was not found. No images were generated."
2) I searched keyword "Output for file" and the chain, then found that the thumbnail image was fail to generate.
3) I checked the command that generates thumbnail and found that it tried to take snapshot at 100.75 second. But the info of the video file shows it has no more than 96.38 seconds:
" Duration: 00:01:36.38, start: 0.000000, bitrate: 227 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 960x600, 141 kb/s, 8 fps, 8 tbr, 8 tbn, 16 tbc"
4) the wrong calculation starts at line 910:
" $data['duration']['timecode']['seconds']['total'] = $data['duration']['seconds'] = $this->formatTimecode($data['duration']['timecode']['frames']['exact'], '%hh:%mm:%ss.%fn', '%st.%ms', $data['video']['frame_rate']);"
It uses format of '%hh:%mm:%ss.%fn' to decode "00:01:36.38". %fn means frame number. There are 8 frames a second. So 1 minute + 36 seconds + 38 / 8 seconds = 100.75 seconds.
I tried to confirm this bug at http://code.google.com/p/phpvideotoolkit. But the project seems at low activity and code in SVN is even not the latest. I hope maintainers of Video know some detail about phpvideotoolkit and help to confirm it.
This fix of this bug is changing format string '%hh:%mm:%ss.%fn' to '%hh:%mm:%ss'. If anyone could help, I hope this fix could push to upstream. Thank you very much!
Cameron
Comments
Comment #1
Jorrit commentedUsing what version have you tested this? I have recently made a change such that the last screenshot is not taken from the last couple of seconds. Even if the duration calculation is off by a couple of seconds, this should no longer affect the last screenshot. I will look into it, however.
Comment #2
Jorrit commentedI think you're almost right, however, it should be %ms instead of %fn. The digits after the dot are milliseconds. Also, in the output format %st must be changed to %ss and in the module code I have added some floor() calls. Thanks for reporting this, by the way! Otherwise, I would not have found the cause of the wrong frame extraction calls.
Comment #3
hgneng commentedHi Jorrit,
Thank you for your extremely fast response! I've downloaded the latest dev and your fix works fine.
Comment #4.0
(not verified) commenteda mistake in previous description