Thumbnail generation - design problem: thumbnails are almost same and not very informative. (1 Viewer)

Sebastiii

Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    I must use this :

    Code:
    		  for (i = 0; i < (PreviewColumns * PreviewRows); i++)
    		  {
    			TimeOffset = preGapSec + i * TimeBetweenThumbs;
     
    			ffmpegArgs = string.Format("select=isnan(prev_selected_t)+gte(t-prev_selected_t" + "\\" + ",{0}),yadif=0:-1:0,scale=600:337,setsar=1:1,tile={1}x{2}", 1, 1, 1);
    			ExtractorArgs = string.Format("-loglevel quiet -ss {0} -i \"{1}\" -vf {2} -vframes 1 -vsync 0 -an \"{3}_{4}.jpg\"", TimeOffset, aVideoPath, ffmpegArgs, strFilenamewithoutExtension, i);
    			Success = Utils.StartProcess(ExtractorPath, ExtractorArgs, TempPath, 120000, true, GetMtnConditions());
    			Log.Debug("VideoThumbCreator: thumb creation {0}", ExtractorArgs);
    			if (!Success)
    			{
    			  Log.Debug("VideoThumbCreator: failed, try to fallback {0}", strFilenamewithoutExtension);
    			  break;
    			}
    			else
    			{
    			  pictureList.Add(string.Format("{0}_{1}.jpg", strFilenamewithoutExtension, i));			 
    			}		   
    		  }
     
    		  if (i == PreviewColumns * PreviewRows)
    		  {
    			if (Util.Utils.CreateVideoThumbV2(pictureList, string.Format("{0}.jpg", strFilenamewithoutExtension), PreviewColumns, PreviewRows))
    			{
    			  Log.Debug("VideoThumbCreator: thumb creation success {0}", strFilenamewithoutExtension);
    			}
    			else
    			{
    			  Log.Debug("VideoThumbCreator: failed, try to fallback {0}", strFilenamewithoutExtension);
    			}
     
    		  }

    But regroup 4 files something failed for me here.
     

    regeszter

    Retired Team Member
  • Premium Supporter
  • October 29, 2005
    5,335
    4,954
    Home Country
    Hungary Hungary
    It seems each thumbs (2X2) (so 4 pictures) stay in video folder.

    Debugging thingy and i see what happen so the code is not 100% ok (it seems)
    I can reproduce low quality thumb (like Homey) if 'CreateVideoThumbV2' is used (and file should be created correctly.

    It failed to go on 'CreateVideoThumbV2' because of : 'if (i == PreviewColumns * PreviewRows - 1)' (don't know why but will try to see).

    So i can get Good Thumb because MP use : 'Success = Utils.StartProcess(ExtractorPath, ExtractorFallbackArgs, TempPath, 120000, true, GetMtnConditions());'

    I found the error. Sorry. :cry:

    Pls test if stay in video folder and thumb quality are ok or not.

    Thx!
     

    Attachments

    • MP_1.4.0_thumb_patchV3e.zip
      2.8 MB
    • MP_1.4.0_thumb_patchV3e source.zip
      34.7 KB
    Last edited:

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Ok, i have force pushed the branch, so you should force update on your own.

    It seems working nicely, but i have a concern about : (public static void SetThumbnails(ref GUIListItem item) with 'ThreadPool.QueueUserWorkItem(GetVideoThumb, item);')
    It use the method to generate thumb video (in a worker thread) so i don't know if it will work because this 'VideoThumbCreator.CreateVideoThumb' method will be acceded multiple time (if i'm not wrong) and so i fear about 'List<string> pictureList = new List<string>();' the pictureList will be reset ?

    What do you think ? :)
     

    regeszter

    Retired Team Member
  • Premium Supporter
  • October 29, 2005
    5,335
    4,954
    Home Country
    Hungary Hungary
    Ok, i have force pushed the branch, so you should force update on your own.

    It seems working nicely, but i have a concern about : (public static void SetThumbnails(ref GUIListItem item) with 'ThreadPool.QueueUserWorkItem(GetVideoThumb, item);')
    It use the method to generate thumb video (in a worker thread) so i don't know if it will work because this 'VideoThumbCreator.CreateVideoThumb' method will be acceded multiple time (if i'm not wrong) and so i fear about 'List<string> pictureList = new List<string>();' the pictureList will be reset ?

    What do you think ? :)

    After sync to branch, the generation is now work. :(

    [2013-07-21 08:19:27,256] [Log ] [MPMain ] [DEBUG] - M:\NAS\Videók\Made.In.Hungaria.2009.720p.mkv duration is 6556.
    [2013-07-21 08:19:27,256] [Log ] [MPMain ] [DEBUG] - VideoThumbCreator: No thumb in share M:\NAS\Videók\Made.In.Hungaria.2009.720p.mkv - trying to create.
    [2013-07-21 08:19:27,877] [Log ] [MPMain ] [WARN ] - Util: Error executing C:\Program Files\Team MediaPortal\MediaPortal\MovieThumbnailer\ffmpeg.exe: return code 254
    [2013-07-21 08:19:27,877] [Log ] [MPMain ] [DEBUG] - VideoThumbCreator: thumb creation -loglevel quiet -ss 153 -i "M:\NAS\Videók\Made.In.Hungaria.2009.720p.mkv" -vf select=isnan(prev_selected_t)+gte(t-prev_selected_t\,1),yadif=0:-1:0,scale=600:337,setsar=1:1,tile=1x1 -vframes 1 -vsync 0 -an "M:\NAS\Videók\Made.In.Hungaria.2009.720p_0.jpg"
    [2013-07-21 08:19:27,877] [Log ] [MPMain ] [DEBUG] - VideoThumbCreator: failed, try to fallback M:\NAS\Videók\Made.In.Hungaria.2009.720p
    [2013-07-21 08:19:29,730] [Log ] [MPMain ] [WARN ] - Util: Error executing C:\Program Files\Team MediaPortal\MediaPortal\MovieThumbnailer\ffmpeg.exe: return code 254
    [2013-07-21 08:19:29,730] [Log ] [MPMain ] [INFO ] - VideoThumbCreator: ffmpeg.exe has not been executed successfully with arguments: -loglevel quiet -ss 5 -i "M:\NAS\Videók\Made.In.Hungaria.2009.720p.mkv" -vf select=isnan(prev_selected_t)+gte(t-prev_selected_t\,5),yadif=0:-1:0,scale=600:337,setsar=1:1,tile=2x2 -vframes 1 -vsync 0 -an "M:\NAS\Videók\Made.In.Hungaria.2009.720p.jpg"

    With my latest code:


    [2013-07-21 08:55:44,544] [Log ] [MPMain ] [DEBUG] - M:\NAS\Videók\Made.In.Hungaria.2009.720p.mkv duration is 6556.
    [2013-07-21 08:55:44,544] [Log ] [MPMain ] [DEBUG] - VideoThumbCreator: No thumb in share M:\NAS\Videók\Made.In.Hungaria.2009.720p.mkv - trying to create.
    [2013-07-21 08:55:45,150] [Log ] [MPMain ] [DEBUG] - VideoThumbCreator: thumb creation -loglevel quiet -ss 134 -i "M:\NAS\Videók\Made.In.Hungaria.2009.720p.mkv" -vf select=isnan(prev_selected_t)+gte(t-prev_selected_t\,1),yadif=0:-1:0,scale=600:337,setsar=1:1,tile=1x1 -vframes 1 -vsync 0 -an "M:\NAS\Videók\Made.In.Hungaria.2009.720p_0.jpg"
    [2013-07-21 08:55:45,632] [Log ] [MPMain ] [DEBUG] - VideoThumbCreator: thumb creation -loglevel quiet -ss 1739 -i "M:\NAS\Videók\Made.In.Hungaria.2009.720p.mkv" -vf select=isnan(prev_selected_t)+gte(t-prev_selected_t\,1),yadif=0:-1:0,scale=600:337,setsar=1:1,tile=1x1 -vframes 1 -vsync 0 -an "M:\NAS\Videók\Made.In.Hungaria.2009.720p_1.jpg"
    [2013-07-21 08:55:46,082] [Log ] [MPMain ] [DEBUG] - VideoThumbCreator: thumb creation -loglevel quiet -ss 3344 -i "M:\NAS\Videók\Made.In.Hungaria.2009.720p.mkv" -vf select=isnan(prev_selected_t)+gte(t-prev_selected_t\,1),yadif=0:-1:0,scale=600:337,setsar=1:1,tile=1x1 -vframes 1 -vsync 0 -an "M:\NAS\Videók\Made.In.Hungaria.2009.720p_2.jpg"
    [2013-07-21 08:55:46,463] [Log ] [MPMain ] [DEBUG] - VideoThumbCreator: thumb creation -loglevel quiet -ss 4949 -i "M:\NAS\Videók\Made.In.Hungaria.2009.720p.mkv" -vf select=isnan(prev_selected_t)+gte(t-prev_selected_t\,1),yadif=0:-1:0,scale=600:337,setsar=1:1,tile=1x1 -vframes 1 -vsync 0 -an "M:\NAS\Videók\Made.In.Hungaria.2009.720p_3.jpg"
    [2013-07-21 08:55:46,607] [Log ] [MPMain ] [DEBUG] - CreateVideoThumbV2: Saving thumb!
    [2013-07-21 08:55:46,989] [Log ] [MPMain ] [DEBUG] - VideoThumbCreator: thumb creation success M:\NAS\Videók\Made.In.Hungaria.2009.720p.jpg
     
    Last edited:

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    It's working here :(

    Do you know on what line of code it failed ?
    Thanks.
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    I copy files from branch in case of something is broken :)
     

    Attachments

    • Thumb_Branch.zip
      36.4 KB

    regeszter

    Retired Team Member
  • Premium Supporter
  • October 29, 2005
    5,335
    4,954
    Home Country
    Hungary Hungary
    This is a working version.

    I can't sync my local branch with read only remote one. I have to revert my changes and sync. Is there a better solution for this?
     

    Attachments

    • VideoThumbCreator.zip
      4.3 KB

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Ok i see the change, i add that part because if sometimes something failed, the picture list item stay in record folder.
    Maybe we should use temp folder (for the picture list item instead of local video folder) ?
     

    Users who are viewing this thread

    Top Bottom