ffmpeg und AutoIt

  • Hey,
    ich habe nun ein Skript vor mir liegen, welches, ein YouTube Video herunterlädt.
    Das Video wird dann im FLV Format bei mir auf dem Desktop gespeichert.
    Dann bekamm ich einen Hinweis, das ich doch mit ffmeg das Video erst in Avi konvertieren und dann auf dem Desktop speichern.
    Wie benutze ich ffmepg im Bezug auf Autoit?
    Sodass Skript-Intern konvertiert wird?


    Mfg
    Benne

  • Hallo PokerFace,

    wenn ich nach ffmpeg google bekomme ich über 2,8 Mio Treffer. Hab zwar nicht jeden einzelnen gesichtet würde dir aber trotzdem diesen empfehlen

    WinFF

    Edit: Link geändert

    mfg (Auto)Bert

    Einmal editiert, zuletzt von AutoBert (4. April 2009 um 21:31)

  • Hi

    Ist etwas grob zusammengezimmert:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <inet.au3>
    #include <Date.au3>

    GUICreate("You Tube Video-Downloader", 273, 105, 193, 115, -1)
    $DwnInput = GUICtrlCreateInput("Hier YouTube Link Rein !", 8, 24, 257, 21)
    GUICtrlCreateLabel("www.youtube.com Download Link:", 8, 8, 268, 15)
    $start = GUICtrlCreateButton("&Start", 8, 48, 128, 25, 0)
    $Progress = GUICtrlCreateProgress(8, 80, 257, 16)
    $abb = GUICtrlCreateButton("A&bbruch", 137, 48, 128, 25, 0)
    GUISetState(@SW_SHOW)

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $start
    GUICtrlSetState($start,$GUI_DISABLE)
    $dwnlink = GUICtrlRead($DwnInput)
    $sCode=_INetGetSource ($dwnlink)
    $s_t=StringRegExp($sCode, "&t=(.*?)&", 3)
    $s_v=stringmid($dwnlink,stringinstr($dwnlink,"v=")+2)
    $save = FileSaveDialog("Speichere FLV","","Flash Video(*.flv)",-1,$s_v)
    If StringRight($save,4) <> ".swf" Then $save&=".flv"
    _Download("http://youtube.com/get_video?video_id=" & $s_v & "&t=" & $s_t[0],$save,$Progress)
    GUIDelete()
    MsgBox(0,"","Fertig!")
    Exit
    EndSwitch
    WEnd

    Func _Download($site,$punkt,$prog=0)
    $orisize = InetGetSize($site)
    InetGet($site,$punkt,1,1)
    If $prog = 0 Then ProgressOn("Download","")
    Do
    $msg = GUIGetMsg()
    If $msg = $abb Then
    If MsgBox(4,"","Abbruch?") = 6 Then Exit
    EndIf
    $size1 = FileGetSize($punkt)
    $MBsize1 = FileGetSize($punkt)
    $inetget = @InetGetBytesRead
    $Prozent = (100 * $inetget ) / $orisize
    $decimalplace = Round ($Prozent)
    $decimalplaceMBsize1 = Round (@InetGetBytesRead / 1024)
    If $prog = 0 Then
    ProgressSet ($Prozent, $decimalplace & "% " & "(" & $decimalplaceMBsize1 & ") Kb sind bereits gedownloadet.")
    Else
    GUICtrlSetData($prog,$Prozent)
    EndIf
    Until @InetGetActive = 0
    If $prog = 0 Then ProgressOff ()
    Local $sFFmpeg="", $hFFmpeg
    $hFFmpeg=Run(@ScriptDir & '\ffmpeg.exe -i "' & $punkt & '" -y "' & StringTrimRight($punkt,3) & 'avi"',@ScriptDir,@SW_HIDE,0x4)
    While 1
    $sFFmpeg &= StderrRead($hFFmpeg)
    If @error Or StringInStr($sFFmpeg,"Duration") Then ExitLoop
    WEnd
    $sFFmpeg = StringLeft(StringTrimLeft($sFFmpeg, StringInStr($sFFmpeg, "Duration:") + 9), 8)
    $iTicks = _TimeToTicks(StringLeft($sFFmpeg, 2), StringMid($sFFmpeg, 4, 2), StringMid($sFFmpeg, 7, 2))
    While 1
    $sFFmpeg = StderrRead($hFFmpeg)
    If @error Then ExitLoop
    If StringInStr($sFFmpeg,"time=") Then
    $sFFmpeg=StringTrimLeft($sFFmpeg, StringInStr($sFFmpeg, "time=") + 4)
    GUICtrlSetData($prog,(StringLeft($sFFmpeg, StringInStr($sFFmpeg, ".")-1) *100000)/$iTicks)
    EndIf
    WEnd
    Return $punkt
    EndFunc

    [/autoit]

    Das konvertierte Video ist noch kein "reines" Avi, sondern ein mp4-Codec
    Du kannst noch mit -vcodec einen anderen Videocodec auswählen...
    Infos hierzu: ffmpeg.exe -h bzw. ffmpeg.exe -formats

    ffmpeg.exe gibts hier:
    http://www.videohelp.com/download/ffmpeg-0.5.7z

    lgE

  • Code
    set /p Name=Type in the name of the flv(without .flv): 
    ffmpeg -i %Name%.flv -ar 44100 -ac 2 -ab 256k %Name%.mp3

    Ich weiß nicht, was ich damit anfangen soll :D
    An Alina.
    Also, wo sollte das denn ins Skript? =O

    Sorry ^^

    Ich bin etwas Dumm in AutoIt.

    mfg
    Benne

  • Code
    set /p Name=Type in the name of the flv(without .flv): 
    ffmpeg -i %Name%.flv -ar 44100 -ac 2 -ab 256k %Name%.avi

    Ja also so xD
    Ich hoffe es geht so :D

    Aber, wo muss das hin? xD