[KPhotoAlbum] Video thumbnail check every start of program

Christoph Moseler forums at moseler.net
Tue Sep 17 18:14:48 BST 2013


Hi,
I had the same problem, and solved it like that:

diff --git a/ImageManager/ExtractOneVideoFrame.cpp 
b/ImageManager/ExtractOneVideoFrame.cpp
index b1ab6c2..fd05f33 100644
--- a/ImageManager/ExtractOneVideoFrame.cpp
+++ b/ImageManager/ExtractOneVideoFrame.cpp
@@ -57,10 +57,21 @@ ExtractOneVideoFrame::ExtractOneVideoFrame(const 
DB::FileName &fileName, double

  void ExtractOneVideoFrame::frameFetched()
  {
-    QImage image(m_workingDirectory + STR("/00000020.png"));
-    emit result(image);
-    deleteWorkingDirectory();
-    deleteLater();
+    int i = 20;
+    bool thumbnailFound = false;
+    QString fnTemplate(m_workingDirectory + STR("/%1.png"));
+    QString filename;
+    while(i > 0 && !thumbnailFound) {
+        filename = fnTemplate.arg(i,8,10,QChar::fromLatin1('0'));
+        QImage image(filename);
+        if(!image.isNull()) {
+            emit result(image);
+            deleteWorkingDirectory();
+            deleteLater();
+            thumbnailFound = true;
+        }
+        i--;
+    }
  }

  void ExtractOneVideoFrame::handleError(QProcess::ProcessError error)


That patch above might be a workaround only, but the cause for the 
behavior described here was, that for very short videos the mplayer call 
in ExtractOneVideoFrame::ExtractOneVideoFrame:

     arguments << STR("-nosound") << STR("-ss") << 
QString::number(offset,'f',4) << STR("-vf")
               << STR("screenshot") << STR("-frames") << STR("20") << 
STR("-vo") << STR("png:z=9") << fileName.absolute();
  qPrintable(arguments.join(QString::fromLatin1(" "))));

m_process->start(MainWindow::FeatureDialog::mplayerBinary(), arguments);

not necessarily creates a file 00000020.png. In that case no thumb is 
created for that particular video and on next startup of kpa it is tried 
to generate the thumbnail again (and this obviously fails again).

HTH Christoph


On 17/09/13 11:46, Jesper K. Pedersen wrote:
> Did you see if these were the files it re-generated each time? If so, could
> you let me have one of the file names so I can give it a try, please.
>
> KPHotoAlbum should pick up that you moved the files, and update the index.xml
> file itself, but of course it doesn't hurt making a copy of the index.xml file
> before doing the change :-)
>
> Cheers
>
> On Tuesday 17 September 2013 01:02:03 Angel Lopez wrote:
>> Hello,
>> One more thing. I think I'm narrowing the problem...
>> Some directory names have strange characters, probably because they were
>> created 9 years ago (in spain, so spanish characters) without UTF-8, then
>> copied to a CDROM and then back to the PC some time later (still without UTF
>> -8).
>>
>> I have started kphotoalbum redirecting the errors to file, so I could
>> discover this.
>>
>> I will rename the offending directories and files. (but, what should I do
>> with the database after do it?)
>>
>> Regards.
>>
>>
>>
>>
>>
>> ______________________________
>> ----------- Angel ------------
>>
>>
>>
>> 2013/9/16 Angel Lopez <anglopm at gmail.com>
>>
>>> Thanks for the suggestions.
>>> I'm ussing mplayer2 installed, as suggested by kphotoalbum at first start.
>>> Version is:  2.0-726.
>>> The command suggested by Johannes returns the video length in minutes.
>>> I've checked again and it seems that the image thumbnails generated in the
>>> .videoThumbnails directory are actually overwritten every time.
>>> Thanks for your help.
>>>
>>> Regards.
>>>
>>>
>>>
>>> ______________________________
>>> ----------- Angel ------------
>>>
>>>
>>>
>>> 2013/9/16 Jesper K. Pedersen <blackie at kde.org>
>>>
>>> If you click on the blinking led, it will show what it actually is doing.
>>>
>>>> Once
>>>> you know which files it wishes to revisit, check with mplayer as Johannes
>>>> suggesed.
>>>>
>>>> Cheers
>>>>
>>>> On Sunday 15 September 2013 22:47:47 Johannes Zarl wrote:
>>>>> Hi,
>>>>>
>>>>> On Friday 13 September 2013 10:11:21 Angel Lopez wrote:
>>>>>> But every time I start kphotoalbum it has the same pending jobs:
>>>>>> Checking video length (for every video in the database).
>>>>>> Generate thumbnail (for every video in the database).
>>>>>>
>>>>>> I let it finish (almost one hour). but next time it is the same...
>>>>>>
>>>>>> I have checked the .videothumbnails folder and hast a number of files
>>>> that
>>>>
>>>>>> is 10 times the number of movies in the database. I suppose this is
>>>> for
>>>>
>>>>>> the
>>>>>> sequence in thumbnail preview... So, all seams generated, but it
>>>>>> start
>>>>>> looking for the info again.
>>>>>>
>>>>>> One note, the creation date for the video thumbnails on hard disk is
>>>> the
>>>>
>>>>>> date for the first generation, so nothing is been written in the
>>>>>> subsequent
>>>>>> works.
>>>>>>
>>>>>>
>>>>>> Any idea?
>>>>> My first thought would be to check your mplayer version. Mplayer 1 has
>>>>> problems with some videos and can't get the correct video length of
>>>> those.
>>>>
>>>>> It's kind of strange though, that all your videos are affected.
>>>>>
>>>>> I assume, mplayer has no problems actually playing those video files?
>>>>>
>>>>> Can mplayer identify the image length when you do it manually?
>>>>> mplayer -identify -frames 0 -vc null -vo null -ao null "$VIDEOFILE"
>>>> |
>>>> |grep
>>>> |
>>>>> ID_LENGTH
>>>>>
>>>>>    Johannes
>>>>>
>>>>> _______________________________________________
>>>>> KPhotoAlbum mailing list
>>>>> KPhotoAlbum at mail.kdab.com
>>>>> https://mail.kdab.com/mailman/listinfo/kphotoalbum
>>>> --
>>>> Having trouble finding a given image in your collection containing
>>>> thousands of images?
>>>>
>>>> http://www.kphotoalbum.org might be the answer.
>>>>
>>>> _______________________________________________
>>>> KPhotoAlbum mailing list
>>>> KPhotoAlbum at mail.kdab.com
>>>> https://mail.kdab.com/mailman/listinfo/kphotoalbum




More information about the Kphotoalbum mailing list