Jump to content

1.) speed up script, 2.) "merge" JPG files to a movie?


Recommended Posts

Hello,

It's now working quite nice.

See this post in the UDF forum

 

Screenshot-Solar-JPGs.jpg.af84299ac1c9b1

 

Regards, Rudi.

 

------------ no need to read all the other lines -----------

 

this is  a first script, to get NASA solar pictures to my local disk. Works quite okay, but it is very slow.

 

1.) Possibly there is a chance to speed it up?

 

#include <Inet.au3>
#include <Date.au3>


$url = "http://sdo.gsfc.nasa.gov/assets/img/browse/"
$Start = "2016/01/01"
$NextDate = $Start

$RegExJpgName = '(.*?<a href=")([\d_]+?_1024_0193\.jpg)(">.*)' ; $2 returns the JPG file name. Size 1024x1024, Picture colouring type 0193 (whatsoever that exactly means ;-)

$SolarFolder = @TempDir & "\SolarJPGs\"
DirCreate($SolarFolder)
ShellExecute($SolarFolder)

HttpSetProxy(1) ; direct access


While (_DateDiff("D", $NextDate, _NowCalcDate()) > -1)
    $NextFolder = $url & $NextDate & "/"
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') :     $NextFolder = ' & $NextFolder & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    GetJPGs($NextFolder)
    $NextDate = _DateAdd("D", 1, $NextDate)
WEnd




Func GetJPGs($_URL)
    $page = _INetGetSource($_URL)
    $aPage = StringSplit($page, "<tr>", 1)
    For $a = 1 To $aPage[0]
        If StringRegExp($aPage[$a], $RegExJpgName) Then
            $_JPG = StringStripWS(StringRegExpReplace($aPage[$a], $RegExJpgName, "$2"), 1 + 2)
            $_NextURL = $_URL & $_JPG
            $_NextJPG = $SolarFolder & $_JPG
            If FileExists($_NextJPG) Then ContinueLoop ; that file has been downloaded before ALREADY
            ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $_NextJPG = ' & $_NextJPG & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
            $result = InetGet($_NextURL, $_NextJPG, 1 + 2, 1)
        EndIf
    Next
EndFunc   ;==>GetJPGs

2.) When I open the first picture with Irfan View, I can use the "right" arrow to "movie" through that series of JPG files. What is the easiest way to "merge" those pics to a movie? (format doesn't matter, one that's good for androids would be nice. No experience with all that so far. I found how to split movies to one pic per frame using Irfan, but not how to merge JPGs to a movie)

 

Any suggestions appreciated, propably there are ready-to-use tools out there I just missed, because I didn't know what to search for exactly.

 

Or there is an easy solution to "play" the images as a movie within an Autoit GUI?

 

 

Comment:
Interesting points of time I've found so far are e.g.:

  • 2016-01-06@12:41:30 the focus on the sun was almost lost
  • 2016-01-13@13:55:18 it's obviously a satelite cam, starting a 360° rotation at this point of time

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

45 minutes ago, rudi said:

2.) When I open the first picture with Irfan View, I can use the "right" arrow to "movie" through that series of JPG files. What is the easiest way to "merge" those pics to a movie? (format doesn't matter, one that's good for androids would be nice. No experience with all that so far. I found how to split movies to one pic per frame using Irfan, but not how to merge JPGs to a movie)

Have a look here: https://autoit.de/index.php/Thread/84289-AVI-Compose-Video-UDF/

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Hi again.

As I was watching the "irfan movie", I was wondering, if it might be possible, to get a somewhat 3D sensation, when I would present "older" JPGs to to the left eye relative to that one for the right eye. I found, that a delta of three PICs is giving me a quite nice experience:

script modified 2016-05-20@21'29:

Now you can use the UP and DOWN cursor key to expand / shrink the GUI. By that it's much easier, to increase the size without loosing the "split focus" (left eye left picture, right eye right picture)

 

Have fun!

 

 

#include <Inet.au3>
#include <Date.au3>


$url = "http://sdo.gsfc.nasa.gov/assets/img/browse/"
$Start = "2015/01/01"
$NextDate = $Start

$RegExJpgName = '(.*?<a href=")([\d_]+?_1024_0193\.jpg)(">.*)' ; $2 returns the JPG file name. Size 1024x1024, Picture colouring type 0193 (whatsoever that exactly means ;-)

$SolarFolder = @ScriptDir & "\SolarJPGs\"
DirCreate($SolarFolder)
ShellExecute($SolarFolder)

HttpSetProxy(1) ; direct access


While (_DateDiff("D", $NextDate, _NowCalcDate()) > -1)
    $NextFolder = $url & $NextDate & "/"
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') :     $NextFolder = ' & $NextFolder & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    GetJPGs($NextFolder)
    $NextDate = _DateAdd("D", 1, $NextDate)
WEnd




Func GetJPGs($_URL)
    $page = _INetGetSource($_URL)
    $aPage = StringSplit($page, "<tr>", 1)
    if @error then Exit
    For $a = 1 To $aPage[0]
        If StringRegExp($aPage[$a], $RegExJpgName) Then
            $_JPG = StringStripWS(StringRegExpReplace($aPage[$a], $RegExJpgName, "$2"), 1 + 2)
            $_NextURL = $_URL & $_JPG
            $_NextJPG = $SolarFolder & $_JPG
            If FileExists($_NextJPG) Then ContinueLoop ; that file has been downloaded before ALREADY
            ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $_NextJPG = ' & $_NextJPG & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
            $result = InetGet($_NextURL, $_NextJPG, 1 + 2, 1)
        EndIf
    Next
EndFunc   ;==>GetJPGs

 

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <Misc.au3>

$SolarFolder = @ScriptDir & "\SolarJPGs\"

$s = FileFindFirstFile($SolarFolder & "*.jpg")
If $s = -1 Then
    FileClose($s)
    MsgBox(0, "Empty", "No JPGs found in path" & @CRLF & $SolarFolder)
    Exit
EndIf


$next = FileFindNextFile($s)
$L = $SolarFolder & $next
$next = FileFindNextFile($s)
$R = $SolarFolder & $next
$shift1 = $R
$shift2 = $R
$shift3 = $R
$LastDate=StringLeft($next,4) & "-" & StringMid($next,5,2) & "-" & StringMid($next,7,2)

Local $hDLL = DllOpen("user32.dll")
AdlibRegister("ReadMsg")

$h = 300
$w = $h * 2


$GuiTitle="solar movie, " &$h & " px, "

$Gui = GUICreate($GuiTitle & $LastDate, $w, $h)
$Left = GUICtrlCreatePic($L, 5, 5, $w / 2 - 10, $h - 10)
$Right = GUICtrlCreatePic($R, $w / 2 + 5, 5, $w / 2 - 10, $h - 10)
GUISetState()





While 1
    $shift3 = $shift2
    $shift2 = $shift1
    $shift1 = $R
    $L = $shift3
    $next = FileFindNextFile($s)
    If @error Then
        FileClose($s)
        MsgBox(0, "", "The End")
        Exit
    Else
        $NextDate=StringLeft($next,4) & "-" & StringMid($next,5,2) & "-" & StringMid($next,7,2)
        if $NextDate <> $LastDate Then
            $LastDate=$NextDate
            WinSetTitle($gui,"",$GuiTitle & $LastDate)
        EndIf
        $R = $SolarFolder & $next
        GUICtrlSetImage($Left, $L)
        GUICtrlSetImage($Right, $R)
    EndIf
WEnd


Func ReadMsg()
    If WinActive($Gui) Then
        $aPos=WinGetPos($Gui)
        If _IsPressed("26", $hDLL) Then ; up arrow key
            $h += 2
            $w = $h * 2
            WinMove($Gui,"",$aPos[0]-1,$aPos[1]-1,$w,$h) ; symmetrically expand one pixel in each direction
            $GuiTitle="solar movie, " &$h & " px, "
            WinSetTitle($gui,"",$GuiTitle & $LastDate)
            GUICtrlDelete($Left)
            GUICtrlDelete($Right)
            $Left = GUICtrlCreatePic($L, 5, 5, $w / 2 - 10, $h - 10)
            $Right = GUICtrlCreatePic($R, $w / 2 + 5, 5, $w / 2 - 10, $h - 10)
        EndIf
        If _IsPressed("28", $hDLL) Then ; up arrow key
            $h -= 2
            $w = $h * 2
            WinMove($Gui, "", $aPos[0]+1,$aPos[1]+1,$w,$h) ; symmetrically shrink one pixel in each direction
            WinSetTitle($gui,"","solar movie, " &$h & " px, " & $LastDate)
            GUICtrlDelete($Left)
            GUICtrlDelete($Right)
            $Left = GUICtrlCreatePic($L, 5, 5, $w / 2 - 10, $h - 10)
            $Right = GUICtrlCreatePic($R, $w / 2 + 5, 5, $w / 2 - 10, $h - 10)
        EndIf

    EndIf
EndFunc   ;==>ReadMsg

Regards, Rudi.

 

<edit: Typos, & Start Date set to 2015/01/01>

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

  • 4 years later...
  • Developers
16 minutes ago, JockoDundee said:

What you need is an MJPEG player.

?  What @Reginald needs to do is ask a real question. That first post is a statement.... curious what the next post will be.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

55 minutes ago, Jos said:

?  What @Reginald needs to do is ask a real question. That first post is a statement.... curious what the next post will be.

Bait and switch.  I came in to this discussion after being lured by the promise of a Hot! 6 reply thread.  I didn’t take the time to notice that the only thing new was just a stone cold  necro-post.  Apologies.

DE6B822E-3AE4-4BCD-9117-68F7871C7448.thumb.jpeg.13fae10b23e4c5e01d3775d0a7e42518.jpeg

Code hard, but don’t hard code...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...