[thumbnails] Package to Auto-Generate Recordings Thumbnails

Black Hole

May contain traces of nut
Credit for this goes to af123; I only supplied the initial inspiration, steering, and testing.

This follows on from previous discussion here: https://hummy.tv/forum/threads/suggestion-cf-generated-thumbnails.7766/

Installing the thumbnails package adds a process to the end-of-recording actions (after decryption and arbookmarks) to generate the standard Humax .thm file, instead of waiting for the recording to be played (which generates the thumbnail if there isn't one) or for the shutdown process (which generates all missing thumbnails during the shutdown housekeeping, before the unit goes into standby). This is useful for those of us who rarely or never perform a controlled shutdown (if you run your 'Fox 24/7, it only ever crashes or gets rebooted - it never goes through a controlled shutdown), and therefore usually have media lists full of blank thumbnails.

Settings in WebIF >> Settings >> Settings for thumbnails package provide options to choose the offset from the start of the recording to the thumbnail frame, and the option to use the position of the first bookmark (handy in conjunction with auto-padding recordings and the arbookmarks package - the frame chosen will be the point where the AR flag occurs in the recording). The default setting is 1 second into the recording (which is the standard behaviour of the Humax software), or the first bookmark if present (turn this off to obtain standard behaviour in all cases).

Note that the WebIF provides tools to manually set thumbnails on individual recordings, and where a .thm file already exists the thumbnails package will not override it.

thumbnails also provides a catch-up facility, such that it scans for recordings without a .thm once a day and queues any found for thumbnail generation. The genthumbs diagnostic can also be run, which performs a complete sweep and queues recordings for thumbnail generation immediately.

Thumbnail generation using the default setting (offset 1 second) is quick; using a bookmark several minutes into a recording will be slow.
 
Last edited:
A few initial thoughts
Installing the thumbnails package adds a process to the end-of-recording actions (after decryption and arbookmarks)
The queuing priority should probably be after Detectads since that will also give you an initial bookmark at start of program or have cropped off the preceding ads
Thumbnail generation using the default setting (offset 1 second) is quick; using a bookmark several minutes into a recording will be slow.
Could the nts file be used to find the frame offset of an i-frame and start the image extract from that point?

Thumbnails is not in the Sweeper Queue for actions list.
I would like to be able to create sweeper rules that run thumbnails with a longer offset for BBC programs that have not been ad detected than for those that have been cropped.
where a .thm file already exists the thumbnails package will not override it.
It would be nice to have an option when adding entries to the queue to override an existing thm, For example you might want to select a bunch of recording that have poor existing thumbnails and ask the tool to have another go,
 
It would be nice to have an option when adding entries to the queue to override an existing thm, For example you might want to select a bunch of recording that have poor existing thumbnails and ask the tool to have another go,
That could be achieved by removing the existing .thms.
 
The queuing priority should probably be after Detectads since that will also give you an initial bookmark at start of program or have cropped off the preceding ads
It is, thumbnails registers with priority 100 - detectads is 200.
(spotted an issue in deq though, it doesn't sort the plugins before calling ::dequeued in each of them - doesn't actually affect this case since thumbnails go through the queue but still needs fixing).

Could the nts file be used to find the frame offset of an i-frame and start the image extract from that point?
That should be possible - what benefit does it give?
Thumbnails is not in the Sweeper Queue for actions list.
I would like to be able to create sweeper rules that run thumbnails with a longer offset for BBC programs that have not been ad detected than for those that have been cropped.
I'll add the sweeper hook.
It would be nice to have an option when adding entries to the queue to override an existing thm, For example you might want to select a bunch of recording that have poor existing thumbnails and ask the tool to have another go,
True - I'll add that too, thanks!
 
Thumbnails 1.0.3 now in beta repository.
  • Queue now available to Sweeper rules;
  • Option for forcing overwrite of existing thumbnail now available (-force option from sweeper).
It requires the latest beta web interface (1.4.0-17) due to changes in the browse screens to support queue actions with parameters.
 
A WebIF media browser OPT+ option to delete a .thm would be handy too.
Why? The thumbnail wouldn't stay deleted and would be regenerated by the tools backup scan or on viewing, it seems to me more straightforward to just have the overwrite option.
 
using a bookmark several minutes into a recording will be slow.
Could the nts file be used to find the frame offset of an i-frame and start the image extract from that point?
That should be possible - what benefit does it give?
None - whatsoever!
The idea was prompted by the idea that scanning a long way into a recording is slow but I am using ffmpeg 2.8 and it seems to be unbelievably fast at input scanning.
For a test I set the bookmark offset to 1 hr and it only took a couple of seconds to create the thumbnail
Code:
5000    05/03/2017 22:54:54 - Auto de-queue processed 2 items in 233.081 seconds.
4999    05/03/2017 22:54:54 -     OK - Done. -
4998    05/03/2017 22:54:51 - thumb:     THUMB: /mnt/hd2/My Video/Voice UK/Voice UK_20170305_1943 @ 3600
4997    05/03/2017 22:54:51 - thumb:     THUMB: /mnt/hd2/My Video/Voice UK/Voice UK_20170305_1943
4996    05/03/2017 22:54:51 - De-queuing 579 - thumb - /mnt/hd2/My Video/Voice UK/Voice UK_20170305_1943.ts
4995    05/03/2017 22:54:51 -  C:  579   100    thumb - /mnt/hd2/My Video/Voice UK/Voice UK_20170305_1943.ts
4994    05/03/2017 22:54:51 -   /mnt/hd2/My Video/Voice UK/Voice UK_20170305_1943 - Queued for thumb.
I haven't tried with the older ffmpeg but it might be a reason to consider upgrading the default version.
 
Why? The thumbnail wouldn't stay deleted and would be regenerated by the tools backup scan or on viewing, it seems to me more straightforward to just have the overwrite option.
Isn't that the same as re-queuing the thumbnail generator? I don't understand where you are coming from.

There is already an override function - if you want a better thumbnail than is auto-generated, go and pick a better one through the WebIF thumbnail utility.
 
Isn't that the same as re-queuing the thumbnail generator? I don't understand where you are coming from.

There is already an override function - if you want a better thumbnail than is auto-generated, go and pick a better one through the WebIF thumbnail utility.
I was trying to understand your suggestion for an additional OPT+ option for deleting thumbnails .

In what circumstances would it be handy? Before asking af123 to go to effort of creating an extra option we should understand why it would be valuable - at the moment I don't understand why you think it would be useful. The overwrite and manual thumbnail option meet my needs so I am curious why you would like the option (given that the effect would only be temporary)
 
I see it as an alternative implementation to your overwrite, easier to implement, and more useful in that it adds the possibility of not having a thumbnail at all (if somebody happened to want to do that for any reason, at the moment it requires FTP or SMB access).

Overwrite: force recording onto queue for thumbnails processing; thumbnails picks up task (and presumably ignores that there is an existing .thm), generates new thumbnail identical to previous one (unless you've changed the parameters in the mean time).

Delete: remove the .thm. Routine scan adds recording to queue for thumbnails processing, which reinstates the same thumbnail. If you just wanted to remove the thumbnail, delete is still an option if thumbnails isn't installed.

Manual: you get to choose the thumbnail.

It seems to me that Manual + Delete offers everything (and more) that Manual + Overwrite does.
 
Thumbnails 1.0.3 now in beta repository.
  • Queue now available to Sweeper rules;
  • Option for forcing overwrite of existing thumbnail now available (-force option from sweeper).
It requires the latest beta web interface (1.4.0-17) due to changes in the browse screens to support queue actions with parameters.
Thanks

AFAIK it is not possible to override the settings offset value via the sweeper args - one of the reasons for asking for the sweeper options was to be able to use different offsets for some recordings

Re-queueing a recording with the -force option does not work if there is an already a Completed entry on the queue, you have to delete the existing completed entry from the queue display first. There is no error indication at the time of submission, the Q action field is updated but the status remains as Completed - it doesn't go back to Pending.
Code:
586    06/03/2017 11:52:56    Voice UK/Voice UK_20170305_1943    thumb -force    COMPLETE    00:00:00    Already done    06/03/2017 11:53:02
 
I see it as an alternative implementation to your overwrite, easier to implement, and more useful in that it adds the possibility of not having a thumbnail at all (if somebody happened to want to do that for any reason, at the moment it requires FTP or SMB access).
Opt+ options are actually a bit of a PITA to implement requiring several additional files in the package including creating a new icon for the action.
It doesn't really add the option of not having a thumbnail at all since you cant prevent the Humax (or the package) recreating the thumbnail within 24hrs.
Overwrite: force recording onto queue for thumbnails processing; thumbnails picks up task (and presumably ignores that there is an existing .thm), generates new thumbnail identical to previous one (unless you've changed the parameters in the mean time).
Yes the thumbnail would be identical if the settings were unchanged but I envision it being most useful for regeneration of multiple thumbnails following a settings change. e.g. If you have a directory full of recording with default 1 second thumbnails and now want to rebuild them all with a 10 second thumbnail offset.
 
None - whatsoever!
The idea was prompted by the idea that scanning a long way into a recording is slow but I am using ffmpeg 2.8 and it seems to be unbelievably fast at input scanning.
For a test I set the bookmark offset to 1 hr and it only took a couple of seconds to create the thumbnail
Code:
5000    05/03/2017 22:54:54 - Auto de-queue processed 2 items in 233.081 seconds.
4999    05/03/2017 22:54:54 -     OK - Done. -
4998    05/03/2017 22:54:51 - thumb:     THUMB: /mnt/hd2/My Video/Voice UK/Voice UK_20170305_1943 @ 3600
4997    05/03/2017 22:54:51 - thumb:     THUMB: /mnt/hd2/My Video/Voice UK/Voice UK_20170305_1943
4996    05/03/2017 22:54:51 - De-queuing 579 - thumb - /mnt/hd2/My Video/Voice UK/Voice UK_20170305_1943.ts
4995    05/03/2017 22:54:51 -  C:  579   100    thumb - /mnt/hd2/My Video/Voice UK/Voice UK_20170305_1943.ts
4994    05/03/2017 22:54:51 -   /mnt/hd2/My Video/Voice UK/Voice UK_20170305_1943 - Queued for thumb.
I haven't tried with the older ffmpeg but it might be a reason to consider upgrading the default version.
The seek function in ffmpeg is slower if the command is placed after the input (e.g. 'ffmpeg -i File.ts -ss 300') as it scans through the frames to find the position. If placed before the input (e.g. 'ffmpeg -ss 300 -i File.ts') the seek is quick. With ffmpeg 0.10, seeking is only accurate with the former command, with ffmpeg 2.8, both are accurate. This may not matter for thumbnail generation, but I presume that using the quick seek option will give different results depending on the version of ffmpeg. I have been using ffmpeg 2.8 for quite a while now and it seems fine. Detectads works with both versions, for example. I have noticed that the Webif functionality which extracts audio tracks from recordings to give mp3 files (with mp3 or mp2/ aac audio) does not work with ffmpeg 2.8. It is fine from the command line though so I presume that Webif is calling for a specific ffmpeg version.
 
The thumbnail wouldn't stay deleted and would be regenerated by the tools backup scan or on viewing

That actually warrants further testing. There is a bit in the .hmt file which indicates the presence of a thumbnail file; it may be that this inhibits further automatic generation. Conversely, since the thumbnails package does not set this flag, it's possible that custom thumbnails are overwritten on shutdown.

AFAIK it is not possible to override the settings offset value via the sweeper args - one of the reasons for asking for the sweeper options was to be able to use different offsets for some recordings
I'll add that for the next version.

Re-queueing a recording with the -force option does not work if there is an already a Completed entry on the queue, you have to delete the existing completed entry from the queue display first. There is no error indication at the time of submission, the Q action field is updated but the status remains as Completed - it doesn't go back to Pending.
I'll fix that, thanks.

The idea was prompted by the idea that scanning a long way into a recording is slow but I am using ffmpeg 2.8 and it seems to be unbelievably fast at input scanning.
I have been using ffmpeg 2.8 for quite a while now and it seems fine.

Right, time to look at 2.8 then! Thanks both.
 
Conversely, since the thumbnails package does not set this flag, it's possible that custom thumbnails are overwritten on shutdown.
Looks like this is happening..

upload_2017-3-7_10-7-4.png

Code:
-rw-rw-rw- 1 root root 553M Mar  5 22:17 New_ Marvel's Agents of____20170305_2100.ts
-rw-rw-rw- 1 root root 1.9M Mar  5 22:17 New_ Marvel's Agents of____20170305_2100.nts
-rw-r--r-- 1 root root  43K Mar  5 22:25 New_ Marvel's Agents of____20170305_2100.thm
-rw-rw-rw- 1 root root 2.1K Mar  5 22:25 New_ Marvel's Agents of____20170305_2100.hmt

the next version will properly set the flag.
 
That actually warrants further testing. There is a bit in the .hmt file which indicates the presence of a thumbnail file; it may be that this inhibits further automatic generation. Conversely, since the thumbnails package does not set this flag, it's possible that custom thumbnails are overwritten on shutdown.
I recall that was discussed when the original thumbnail generator was added to WebIF. Surely the flag must be set properly there?
 
af123 - if you have time to compile a later version of ffmpeg I would be happy to test it. There are still some niggles in 2.8 which may or may not have been fixed. I do know that versions of ffmpeg later than December 2015 have an improved aac encoder which is no longer regarded as experimental. I think that 3.2.4 is the latest version of ffmpeg available for download.
 
Back
Top