marclachance

launch ffplay with user-agent option

5 posts in this topic

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

Share this post


Link to post
Share on other sites



Hi marclachance, what type of program is FFplay?


C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

is there a way to skin the player?  the pop window it uses nos is plain and a bit ugly  

 

Share this post


Link to post
Share on other sites

I have never found a way to embed or skin ffplay.

His window handle can only be found once ffplay is launched and visible, so it limit the possibilities to work on his appearance.

You can set width and height but not his coordinates.


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

Share this post


Link to post
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