Recording thumbnails - resolved! :-D (1 Viewer)

glenn 1990

Portal Pro
July 1, 2010
247
36
Home Country
Belgium Belgium
And do you have thumbs for the HD recordings in windows explorer?
If not, I can't do anything about it.

On what OS is your nas running?
 

pilehave

Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    I just checked, no thumbs visible in explorer for the MPEG4 recordings :(

    I'll try and run one of them through ts-doctor and see if that helps.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    No, no luck. TS-Doctor told me that everything was fine but I ran it anyway and saved as a new file. Still Explorer refuses to create a thumb...

    What I don't understand is, that if I copy one of the ts-files to my "Videos" folders (configured in MediaPortal), there IS created a thumbnail. Instantly, when I start MediaPortal end opens the "Videos" folder from there. And from BOTH the ts-doctor cleaned file AND the original one.

    So, couldn't we just steal the code from there? Seems to be working fine:
    bamse_ramasjang.png
     

    glenn 1990

    Portal Pro
    July 1, 2010
    247
    36
    Home Country
    Belgium Belgium
    But the video plugin uses mtn.exe, if I'm right.
    So then we are back to off.

    Which codecs do you have installed?, windows uses these for the thumb creation.
    (I've saf 6)

    Edit: Mediaortal seems to use a fallback when mtn.exe fails for video thumbs, but not for recording thumbs?
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    It's very curious why pilehave's thumbs are generated in My Videos but not in Recorded TV. Both should use same methods for generating thumbs... Would be interesting to know what the fallback is and why it succeeds.


    As a side note, I have been looking into ffmpeg thumbnail creation few months ago (to replace outdated MTN). But I've no time for everything ;)

    Should be fairly simple in the code, replace mtn.exe with ffmpeg.exe and tweak the parameters sent to MTN to ffmpeg syntax.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    I did some testing with ffmpeg and replaced it with mtn.exe. Seems to be a working solution, but work is needed to be able to created the "tiled" screenshots that mtn could do.

    So far I just hardcoded the width and height of the screenshot, but this should ofc be read from the video-file:
    Code:
    string ExtractorArgs = string.Format(" -itsoffset -5 -i \"{0}\" -vframes 1 -s 320x240 \"{1}\"", aVideoPath, aThumbPath);

    If you want to play around, remember to replace mtn.exe with ffmpeg.exe in line 36 as well ;)
     

    Jay_UK

    Test Group
  • Team MediaPortal
  • October 6, 2009
    1,781
    283
    Derby
    Home Country
    United Kingdom United Kingdom
    Hi there,

    I initially had problems with mtn (for generating thumbs of my MOV videos) - so I switched to VLC (as I already had it installed).

    Instead of recompiling MePo to run VLC, I built a little wrapper (called mtn.exe) which took the parameters that MePo pass and made them into the correct format for VLC - bit of a bodge and not the most effeicient. I dont run this anymore as MePo seems to be far better for me now. :D

    J
     

    glenn 1990

    Portal Pro
    July 1, 2010
    247
    36
    Home Country
    Belgium Belgium
    It's very curious why pilehave's thumbs are generated in My Videos but not in Recorded TV. Both should use same methods for generating thumbs... Would be interesting to know what the fallback is and why it succeeds.


    As a side note, I have been looking into ffmpeg thumbnail creation few months ago (to replace outdated MTN). But I've no time for everything ;)

    Should be fairly simple in the code, replace mtn.exe with ffmpeg.exe and tweak the parameters sent to MTN to ffmpeg syntax.

    About the fallback,

    This is the code to get recording thumbs:
    Code:
    bool  succes = VideoThumbCreator.CreateVideoThumb(recFileName, thumbNail, true, true)

    And this for video thumbs: (fallback code in red)
    Code:
            bool success = VideoThumbCreator.CreateVideoThumb(path, strThumb, true, false);
     [COLOR="Red"]       if (!success)
            {
              //Failed due to incompatible format or no write permissions on folder. Try querying Explorer for thumb.
              Log.Warn("Failed to extract thumb for {0}, trying another method.", path);
              if (OSInfo.OSInfo.VistaOrLater())
              {
                thumb = VistaToolbelt.Shell.ThumbnailGenerator.GenerateThumbnail(path); //only works for Vista/7
              }
              else
              {
                using (ThumbnailExtractor extractor = new ThumbnailExtractor())
                {
                  thumb = extractor.GetThumbnail(path); //works on XP but not too well threaded
                }[/COLOR]
              }

    So, why a fallback for videos and not for recordings??

    And this is the code to get the thums from windows explorer (easy to replace mtn.exe)
    Code:
                      try
                      {
                          using (ShellObject Item = ShellObject.FromParsingName(recording))
                          {
                              Item.Thumbnail.RetrievalOption = ShellThumbnailRetrievalOption.Default;
                              Item.Thumbnail.FormatOption = ShellThumbnailFormatOption.ThumbnailOnly;
                              Bitmap _bitmap;
                              _bitmap = Item.Thumbnail.LargeBitmap;
                              if (_bitmap != null)
                              {
                                  _bitmap.Save(thumbNail, System.Drawing.Imaging.ImageFormat.Jpeg);
                                  Log.Info("RecordedTV: Thumbnail successfully created for -- {0}", recording);
                              }
                          }
                      }
                      catch
                      {
                          Log.Info("RecordedTV: No thumbnail created for -- {0}", recording);
                      }


    Maybe we should start another thread about it.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    It seems like ffmpeg doesn't care which files I throw at it, it has created thumbs from all of my recordings. I did have to rearrange the code a little, but so far it looks promising. Even with the old fallback method I had some MPEG4 recordings that resulted in 0-byte files.

    I'm talking about CreateVideoThumb() in VideoThumbCreator.cs.

    I'' do some more work & test :)
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    Yes I know pilehave! I've been doing various tests few months back and ffmpeg is far more better and reliable than anything other. I was actually gonna replace MTN and MediaInfo with ffmpeg ;) But MediaInfo replace would require much more code shuffling and some breaking changes but with added benefit of being able to get media info from streams.

    As for the My Videos thumb fallback, it clearly uses Windows routines which might be better but still not 100% :) Maybe this fallback should be removed from My Videos, moved in CreateVideoThumb() method in VideoThumbCreator.cs. That way it'll work for everything.
     

    Users who are viewing this thread

    Top Bottom