home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Recording thumbnails - resolved! :-D
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="pilehave" data-source="post: 789406" data-attributes="member: 71550"><p>I tweaked the code a bit more. This is what I have so far, a cleanup is needed <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink ;)" loading="lazy" data-shortname=";)" /></p><p></p><p>[CODE]</p><p>Index: VideoThumbCreator.cs</p><p>===================================================================</p><p>--- VideoThumbCreator.cs (revision 28214)</p><p>+++ VideoThumbCreator.cs (working copy)</p><p>@@ -33,7 +33,7 @@</p><p> {</p><p> public class VideoThumbCreator</p><p> {</p><p>- private static string ExtractApp = "mtn.exe";</p><p>+ private static string ExtractApp = "ffmpeg.exe";</p><p> private static string ExtractorPath = Config.GetFile(Config.Dir.Base, "MovieThumbnailer", ExtractApp);</p><p> private static int PreviewColumns = 2;</p><p> private static int PreviewRows = 2;</p><p>@@ -112,7 +112,7 @@</p><p> // Params for mplayer (outputs 00000001.jpg in video resolution into working dir) -vf scale=600:-3</p><p> //string ExtractorArgs = string.Format(" -noconsolecontrols -nosound -vo jpeg:quality=90 -vf scale -frames 1 -ss {0} \"{1}\"", "501", aVideoPath);</p><p> </p><p>- // Params for mtm (http://moviethumbnail.sourceforge.net/usage.en.html)</p><p>+ // Params for mtn (http://moviethumbnail.sourceforge.net/usage.en.html)</p><p> // -D 8 : edge detection; 0:off >0:on; higher detects more; try -D4 -D6 or -D8</p><p> // -B 420/E 600 : omit this seconds from the beginning / ending TODO: use pre- / postrecording values</p><p> // -c 2 / r 2 : # of column / # of rows</p><p>@@ -136,13 +136,7 @@</p><p> postGapSec = 600;</p><p> }</p><p> bool Success = false;</p><p>- string ExtractorArgs = string.Format(" -D 6 -B {0} -E {1} -c {2} -r {3} -b {4} -t -i -w {5} -n -P \"{6}\"",</p><p>- preGapSec, postGapSec, PreviewColumns, PreviewRows, blank, 0, aVideoPath);</p><p>- string ExtractorFallbackArgs = string.Format(</p><p>- " -D 8 -B {0} -E {1} -c {2} -r {3} -b {4} -t -i -w {5} -n -P \"{6}\"", 0, 0, PreviewColumns, PreviewRows, blank,</p><p>- 0, aVideoPath);</p><p>- // Honour we are using a unix app</p><p>- ExtractorArgs = ExtractorArgs.Replace('\\', '/');</p><p>+</p><p> try</p><p> {</p><p> // Use this for the working dir to be on the safe side</p><p>@@ -150,16 +144,19 @@</p><p> string OutputThumb = string.Format("{0}_s{1}", Path.ChangeExtension(aVideoPath, null), ".jpg");</p><p> string ShareThumb = OutputThumb.Replace("_s.jpg", ".jpg");</p><p> </p><p>+ string ExtractorArgs = string.Format(" -ss {0} -itsoffset -5 -i \"{1}\" -vframes 1 \"{2}\"", preGapSec, aVideoPath, OutputThumb);</p><p>+ string ExtractorFallbackArgs = string.Format(" -ss 60 -itsoffset -5 -i \"{1}\" -vframes 1 \"{2}\"", preGapSec, aVideoPath, OutputThumb);</p><p>+</p><p> if ((LeaveShareThumb && !Util.Utils.FileExistsInCache(ShareThumb))</p><p> // No thumb in share although it should be there</p><p> || (!LeaveShareThumb && !Util.Utils.FileExistsInCache(aThumbPath)))</p><p> // No thumb cached and no chance to find it in share</p><p> {</p><p>- //Log.Debug("VideoThumbCreator: No thumb in share {0} - trying to create one with arguments: {1}", ShareThumb, ExtractorArgs);</p><p>+ Log.Debug("VideoThumbCreator: No thumb in share {0} - trying to create one with arguments: {1}", ShareThumb, ExtractorArgs);</p><p> Success = Utils.StartProcess(ExtractorPath, ExtractorArgs, TempPath, 15000, true, GetMtnConditions());</p><p> if (!Success)</p><p> {</p><p>- // Maybe the pre-gap was too large or not enough sharp & light scenes could be caught</p><p>+ // Maybe it takes more than 15 seconds to create the thumbnail, try fallback arguments</p><p> Thread.Sleep(100);</p><p> Success = Utils.StartProcess(ExtractorPath, ExtractorFallbackArgs, TempPath, 30000, true, GetMtnConditions());</p><p> if (!Success)</p><p>@@ -172,7 +169,7 @@</p><p> Utils.KillProcess(Path.ChangeExtension(ExtractApp, null));</p><p> try</p><p> {</p><p>- // remove the _s which mdn appends to its files</p><p>+ // remove the _s which mtn appends to its files</p><p> File.Move(OutputThumb, ShareThumb);</p><p> }</p><p> catch (FileNotFoundException)</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="pilehave, post: 789406, member: 71550"] I tweaked the code a bit more. This is what I have so far, a cleanup is needed ;) [CODE] Index: VideoThumbCreator.cs =================================================================== --- VideoThumbCreator.cs (revision 28214) +++ VideoThumbCreator.cs (working copy) @@ -33,7 +33,7 @@ { public class VideoThumbCreator { - private static string ExtractApp = "mtn.exe"; + private static string ExtractApp = "ffmpeg.exe"; private static string ExtractorPath = Config.GetFile(Config.Dir.Base, "MovieThumbnailer", ExtractApp); private static int PreviewColumns = 2; private static int PreviewRows = 2; @@ -112,7 +112,7 @@ // Params for mplayer (outputs 00000001.jpg in video resolution into working dir) -vf scale=600:-3 //string ExtractorArgs = string.Format(" -noconsolecontrols -nosound -vo jpeg:quality=90 -vf scale -frames 1 -ss {0} \"{1}\"", "501", aVideoPath); - // Params for mtm (http://moviethumbnail.sourceforge.net/usage.en.html) + // Params for mtn (http://moviethumbnail.sourceforge.net/usage.en.html) // -D 8 : edge detection; 0:off >0:on; higher detects more; try -D4 -D6 or -D8 // -B 420/E 600 : omit this seconds from the beginning / ending TODO: use pre- / postrecording values // -c 2 / r 2 : # of column / # of rows @@ -136,13 +136,7 @@ postGapSec = 600; } bool Success = false; - string ExtractorArgs = string.Format(" -D 6 -B {0} -E {1} -c {2} -r {3} -b {4} -t -i -w {5} -n -P \"{6}\"", - preGapSec, postGapSec, PreviewColumns, PreviewRows, blank, 0, aVideoPath); - string ExtractorFallbackArgs = string.Format( - " -D 8 -B {0} -E {1} -c {2} -r {3} -b {4} -t -i -w {5} -n -P \"{6}\"", 0, 0, PreviewColumns, PreviewRows, blank, - 0, aVideoPath); - // Honour we are using a unix app - ExtractorArgs = ExtractorArgs.Replace('\\', '/'); + try { // Use this for the working dir to be on the safe side @@ -150,16 +144,19 @@ string OutputThumb = string.Format("{0}_s{1}", Path.ChangeExtension(aVideoPath, null), ".jpg"); string ShareThumb = OutputThumb.Replace("_s.jpg", ".jpg"); + string ExtractorArgs = string.Format(" -ss {0} -itsoffset -5 -i \"{1}\" -vframes 1 \"{2}\"", preGapSec, aVideoPath, OutputThumb); + string ExtractorFallbackArgs = string.Format(" -ss 60 -itsoffset -5 -i \"{1}\" -vframes 1 \"{2}\"", preGapSec, aVideoPath, OutputThumb); + if ((LeaveShareThumb && !Util.Utils.FileExistsInCache(ShareThumb)) // No thumb in share although it should be there || (!LeaveShareThumb && !Util.Utils.FileExistsInCache(aThumbPath))) // No thumb cached and no chance to find it in share { - //Log.Debug("VideoThumbCreator: No thumb in share {0} - trying to create one with arguments: {1}", ShareThumb, ExtractorArgs); + Log.Debug("VideoThumbCreator: No thumb in share {0} - trying to create one with arguments: {1}", ShareThumb, ExtractorArgs); Success = Utils.StartProcess(ExtractorPath, ExtractorArgs, TempPath, 15000, true, GetMtnConditions()); if (!Success) { - // Maybe the pre-gap was too large or not enough sharp & light scenes could be caught + // Maybe it takes more than 15 seconds to create the thumbnail, try fallback arguments Thread.Sleep(100); Success = Utils.StartProcess(ExtractorPath, ExtractorFallbackArgs, TempPath, 30000, true, GetMtnConditions()); if (!Success) @@ -172,7 +169,7 @@ Utils.KillProcess(Path.ChangeExtension(ExtractApp, null)); try { - // remove the _s which mdn appends to its files + // remove the _s which mtn appends to its files File.Move(OutputThumb, ShareThumb); } catch (FileNotFoundException) [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Recording thumbnails - resolved! :-D
Contact us
RSS
Top
Bottom