Thumbnails - any configuration?

I tried 160x91x3 on a test .thm and didn't get anything recognisable:

View attachment 474

Unfortunate distraction from what I'm supposed to be doing though! : (
If it's any help, the Foxsat HDR generates eight thumbnails per recording at intevals (duration / 8).
Each one is 28200 bytes in size and is made up of a sequence of 4 byte values comprising
byte 1 - always zero
byte 2 - red
byte 3 - green
byte 4 - blue
Bitmap size is 94 x 75, so top line is first 94 bytes, and so on.
 
Having a quick look at the ffmpeg docs, it seems you can output a frame to a bitmap (not just jpeg) and resize the frame. So that should get us close to producing a true thm file now we know the file format.
Ideally I wanted this to happen automatically, but I don't know how it would work with the default thumbnails. Perhaps they could be generated before the default thumbnail (in which case I guess the default process wouldn't overwrite it). Another option may be to set some sort of attribute on the file so we can tell which is a default thumbnail and which is a custom one.
It is my expectation that a custom frame could replace the standard frame after it has been generated.
 
I have replaced a Humax generated THM file with an edited replacement file and the Humax will then display the new file
 
I have added a standard bitmap header (38 bytes) to a thm file and could view it as a bitmap, but it was rotated 180.

So I think it should be possible to do this by a shell script;

1. Use ffmpeg to extract a key frame after the given time interval. Rotate the key frame using vflip hflip and save the outputted frame to 140x78 bitmap.
2. Strip the bitmap header from the file (would need to check the size it may not be 38 bytes using ffmpeg)

@Black Hole. The problem is not overwriting a standard thumbnail. It is to know which thumbnails to generate. We don't want to process every recording every time a "custom thumbnail" package runs.
 
@Black Hole. The problem is not overwriting a standard thumbnail. It is to know which thumbnails to generate. We don't want to process every recording every time a "custom thumbnail" package runs.
I think you misunderstand the scheme I am trying to chair. I can't see a way to run this as an automated process, it would have to be a manual one:
  1. For a recording you intend to keep in the longer term (and is therefore worth processing), play the recording and use the "add bookmark" button to mark the point you wish to use as a thumbnail frame.
  2. In the WebIF, browse to the recording in question and select "replace thumbnail" from the OPT+ menu.
How else would you do it? What point could you use in the video that would be appropriate for every recording?

Is ffmpeg capable of producing a bitmap still image? I rather fancy it will only produce a .jpg with the same dimensions as the original frame. We will need a process to take the .jpg and expand it as a bitmap (is there enough memory?), and then reduce its resolution to the size required. Update: see next post.

I suppose there would be some mileage in replacing all auto-thumbnails with a stock frame as an automatic process, but that would be easy based on creation date.

By the way, I am grateful for the team piling in to experiment and suggest how to put the steps in place. I was going to have a play with the .thm file, but you beat me to it. The other matters I may not be able to help with (other than as team leader).
 
I've been playing with ffmpeg on the Humax (over Telnet) and initial results are encouraging but throwing up some new issues.
The command I'm using is;

Code:
ffmpeg -ss 240 -i SomeRecording.ts -frames 1 -vf hflip,vflip -s 140x78 TestOutput.bmp

240 is the number of seconds since the start to use as a thumbnail.

The two issues I have with this are;

1. ffmpeg only seems to work on decrpyted files. Is that right?
2. The output bitmap is 24 bit and not 32 bit.

I'm still investigating but thought it might be worth pointing out my progress and challenges.
 
I'm still investigating but thought it might be worth pointing out my progress and challenges.
Well done.

1. ffmpeg only seems to work on decrpyted files. Is that right?
Absolutely. Decryption will be a pre-requisite.

2. The output bitmap is 24 bit and not 32 bit.
I believe .bmp cannot include alpha data. It will be simple to write a post-processor to insert the fourth byte. You could try outputting to .png, but I am not sure if .pngs are compressed.
Code:
Rem: input = bmp, output = thm

While not EOF do {
   read byte
   write byte
   read byte
   write byte
   read byte
   write byte
   write 255
}
 
Got a viable thumbnail output now (I haven't tested in place yet, but I can decode it to a bmp as per my previous test)

Code:
ffmpeg -ss 240 -i SomeRecording.ts -frames 1 -pix_fmt argb -vf vflip -s 140x78 TestOutput.bmp
 
dd bs=54 skip=1 if=TestOutput.bmp of=TestOutput.thm

The second command splits of the first 54 bytes (ffmpegs bmp header)
 
So can we get in this in the interface or a package somewhere?

I would like to see an option on decrypt to create a new thumbnail when a file has been decrypted (with a configurable number of seconds - I guess I would set it to about 6 or 7 minutes in).
I want to have better thumbnails automatically and it depends on the files being decrypted. If I turn on auto-decrypt then that would be a good place to do it.

@Black Hole was keen on a finer control via bookmarks and the Web-IF for individual files.
That way you could select a thumbnail image by setting a bookmark for files you wanted to keep.

Does any one know about how difficult/likely such changes would be?
Are there specific maintainers that we should ask?
 
For the manual version, all we need now is to pull the position of the bookmark out of the .nts file (or is it the .hmt file?) and use that as a parameter into the ffmpeg command line - this has been done before in the crop operation, so no great difficulty.

Over to you af123! Some thoughts would be welcome on the prospect of auto thumbnails too.
 
Easy enough to add either version.. Bookmarks are stored in terms of a number of seconds in so they're a logical choice for marking an approximate image for generation via OPT+.

Has anyone seen if the .hmt file changes once a .thm has been generated (i.e. if there is a flag)?
If you remove a .thm, is one recreated overnight?

I'll test this myself too!
 
Personally I don't really care about an auto-thumbnail at a fixed data point, I think it will be almost as useless as time=0. However, don't let that stand in anybody's way.

Being able to choose a frame will replicate the functionality of my Liteon analogue PVR, which set the thumbnail to frame 0 and then gave the user the option to choose another. I look forward to applying this to my collection of "The Owl".
 
If you remove a .thm, is one recreated overnight?
It appears to be recreated on the next boot.

That means that there doesn't appear to be an easy way to tell if a thumbnail has been created automatically or manually.

There may be an option for deliberately settings the last 0xff byte to something different for manually generated .thm files so they can be identified. That would pave the way for the automatic replacement.
 
Perhaps something like this...
Code:
#!/bin/sh

rec=${1%.*}
if [ ! -f "${rec}.ts" ]; then
  echo "Unable to find transport stream file"
  exit 1
fi
if hmt "${rec}.hmt" | grep -q "^Raw file is encrypted on disk"; then
  echo "Encrypted file - unable to create thumbnail"
  exit 1
fi
bm=$(hmt -bookmarks "${rec}.hmt")
if echo $bm | grep -q "^[0-9]\+$"; then
  ffmpeg -ss $bm -i "${rec}.ts" -frames 1 -pix_fmt argb -vf vflip -s 140x78 "${rec}.bmp"
  dd if="${rec}.bmp" of="${rec}.thm" bs=54 skip=1
  rm "${rec}.bmp"
else
  echo "Unable to find bookmark"
fi
 
Something like that : )
hmt supports the -bookmarks flag to just display bookmarks which may simplify things

Code:
humax# hmt -bookmarks Bon\ Jovi/Bon\ Jovi\ Live_20130124_2000-1359243399.hmt
76 350 633 875 1132 1395 1679 1974 2314 2574 3013 3329 3593 3940 4103 4386

and maybe remove the .bmp afterwards.
 
Back
Top