Jump to content

launch ffplay with user-agent option


marclachance
 Share

Recommended Posts

Hello !

I'm trying to launch ffplay.exe from an autoit script in a thanks to the notepad GUI demo.

The ffplay command to launch is this one : 

C:\ffplay.exe  -headers="User-agent:Videotester" http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8

 

Here is the basic line :  

 Run("C:\ffplay.exe  -headers="User-agent:VIdeotester " http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8")

I can't do this via autoit because i think of quoting issues. i Have tried many combination but without success...

Any help will be appreciated !

 

Thanks

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

Hi marclachance, what type of program is FFplay?

FFplay is a command line video player

Hello !

I'm trying to launch ffplay.exe from an autoit script in a thanks to the notepad GUI demo.

The ffplay command to launch is this one : 

C:\ffplay.exe  -headers="User-agent:Videotester" http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8

 

Here is the basic line :  

 Run("C:\ffplay.exe  -headers="User-agent:VIdeotester " http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8")

I can't do this via autoit because i think of quoting issues. i Have tried many combination but without success...

Any help will be appreciated !

 

Thanks

It can be used like this

#include <Constants.au3>

;~ https://ffmpeg.org/ffplay.html#toc-Main-options
$sM3U8Url = 'http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8'
$sM3U8Url = 'http://www.streambox.fr/playlists/test_001/stream.m3u8'
$sM3U8Url = 'http://download.oracle.com/otndocs/products/javafx/JavaRap/prog_index.m3u8'

Local $iPid = Run ( '"' & @ScriptDir & '\ffplay.exe" -headers "User-Agent: Videotester"' & @CRLF & ' -x 480 -y 270 -window_title "ffplay Example" -loop 1 -infbuf "' & $sM3U8Url & '"', '', @SW_HIDE, $STDERR_CHILD )
Local $sStderrRead = '', $iDuration, $aRet, $iOffSet, $hTimerInit = TimerInit(), $hWnd = WinWait ( 'ffplay Example', '', 10 )

While 1
    $sStderrRead = StderrRead ( $iPid )
    If @error Then ExitLoop
    If $sStderrRead <> '' Then
        If Not $iDuration Then
            If StringInStr ( $sStderrRead, 'Duration:' ) Then
                $aRet = StringRegExp ( $sStderrRead, '(?s)(?i)Duration: (.*?), ', 3 )
                If Not @error Then $iDuration = _String2Sec ( $aRet[0] )
            EndIf
        Else
            $aRet = StringRegExp ( $sStderrRead, '(?s)(?i)  \r(.*?) A-V: ', 3 )
            If Not @error Then
                $iTime = StringReplace ( $aRet[0], '.', ',' )
                If $iTime Then
                    If Not $iOffSet Then $iOffSet = Floor ( $iTime - TimerDiff ( $hTimerInit )/1000 )
                    If $hWnd Then WinSetTitle ( $hWnd, '', 'ffplay Progress ' & Floor ( 100*( ( $iTime - $iOffSet )/$iDuration ) ) & '%' )
                EndIf
            EndIf
        EndIf
        ConsoleWrite ( '! STDERR read : ' & $sStderrRead & @Crlf )
    EndIf
    Sleep ( 10 )
Wend

Exit

Func _String2Sec ( $sString )
    Local $a = StringSplit ( $sString, ':' ), $iRet
    If Not @error Then
        For $i = UBound ( $a ) -1 To 1 Step -1
            $iRet += $a[$i]* ( 60^ ( UBound ( $a ) -1 -$i ) )
        Next
    EndIf
    Return $iRet
EndFunc ;==> _String2Sec()

Progress must be adapted from FFPlay version and from videos.

Some of them do not return duration or FFPlay is not able to get it.

May be you have tried FFPlay.exe and some libraries are missing...

 

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • 1 month later...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...