Jump to content
Sign in to follow this  
RapTure

Having trouble finding my error.

Recommended Posts

RapTure

This is one of my first times coding and definitely my first time using autoit. I keep getting this error whenever I try to test my script.

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Jeremiah\Documents\FFMpegEncoder.au3"

C:\Users\Jeremiah\Documents\FFMpegEncoder.au3 (9) : ==> Missing separator character after keyword.:

Global $encoder = divx

Global $encoder = divx^ ERROR

>Exit code: 1 Time: 0.212

Sometimes it will throw a different variable with the same error.

My script:

;# FFMpeg Encode Script v1
#RequireAdmin
;##### CONFIG STARTS HERE #####
Global $fps 60
Global $encoder divx
Global $threads 2
Global $audiobitrate 128k
Global $ffmpeg "ffmpeg.exe"
;##### CONFIG ENDS HERE #####
;-----------------------------------------------------------------------------
;----------------------------- DO NOT EDIT BELOW -----------------------------
;-----------------------------------------------------------------------------
Global $flvname
Global $videoout
Global $soundout
While 1
;Ask user for .flv file name
$flvname = InputBox(“FFMpeg Encoder”, “What is the name of the .flv that you wish to encode? Make sure it’s in the same directory as FFMpeg and the FFMpeg Encoder”)
;Ask for Video Output
$videoout = InputBox(“FFMpeg Encoder”, “What would you like the video file to be named?)
;Ask for Audio Output
$audioout = InputBox("FFMpeg Encoder", "What would you like your audio file to be named?")
;Build FFMpeg Video Params Line
Global $ffmpegparams =-i “ & $flvname &.flv -c:a libmp3lame -b:a “ & $audiobitrate &-sameq -r “ & $fps &-vtag “ & $encoder &-threads “ & $threads & ‘“‘ & $videoout & ‘“.avi"
;Start video encode
ShellExecute($ffmpeg, $ffmpegparams)
;Build FFMpeg Audio Params Line
Global $audioparams = "-i " & $flvname & ".flv -b:a " & $audiobitrate & " " & $soundout & ".mp3"
;Start audio encode
ShellExecute($ffmpeg, $audioparams)
;Close script (Exit)
Exit
WEnd

Again this is my first time coding autoit so I am sure it is a silly little basic error, however any help is greatly appreciated.

Share this post


Link to post
Share on other sites
jdelaney

must set the value of variables with an '='

Global $fps = 60
Global $encoder = "divx"
Global $threads = 2
Global $audiobitrate = "128k"
Global $ffmpeg = "ffmpeg.exe"
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Melba23

RapTure,

Welcome to the AutoIt forum. :)

A few syntax errors there. You need an "=" to assign values to a variable - and non-numeric values need to be enclosed in "". There were also some problems with the quotes in the $ffmpegparams line. See if this is any better - at least it does not error when I test. ;)

;# FFMpeg Encode Script v1
#RequireAdmin
;##### CONFIG STARTS HERE #####
Global $fps = 60
Global $encoder = "divx"
Global $threads = 2
Global $audiobitrate = "128k"
Global $ffmpeg = "ffmpeg.exe"
;##### CONFIG ENDS HERE #####
;-----------------------------------------------------------------------------
;----------------------------- DO NOT EDIT BELOW -----------------------------
;-----------------------------------------------------------------------------
Global $flvname
Global $videoout
Global $soundout
While 1
    ;Ask user for .flv file name
    $flvname = InputBox("FFMpeg Encoder", "What is the name of the .flv that you wish To encode? Make sure it’s In the same directory as FFMpeg And the FFMpeg Encoder")
    ;Ask for Video Output
    $videoout = InputBox("FFMpeg Encoder", "What would you like the video file To be named?")
    ;Ask for Audio Output
    $audioout = InputBox("FFMpeg Encoder", "What would you like your audio file to be named?")
    ;Build FFMpeg Video Params Line
    Global $ffmpegparams = " - i " & $flvname & ".flv - c:a libmp3lame - b:a " & $audiobitrate & " - sameq - r " & $fps & " - vtag " & $encoder & " - threads " & $threads & '"' & $videoout & ".avi"
    ;Start video encode
    ShellExecute($ffmpeg, $ffmpegparams)
    ;Build FFMpeg Audio Params Line
    Global $audioparams = "-i " & $flvname & ".flv -b:a " & $audiobitrate & " " & $soundout & ".mp3"
    ;Start audio encode
    ShellExecute($ffmpeg, $audioparams)
    ;Close script (Exit)
    Exit
WEnd

We may still have to work on the $ffmpegparams line to get the quotes correct. Do you code in SciTE? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
kylomas

Rapture,

You need an equal sign after the global declares, e.g. Global $fps = 60

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
water

The Global statements need an assign operator and quotes:

Global $fps = 60
Global $encoder = "divx"
Global $threads = 2
Global $audiobitrate = "128k"
Global $ffmpeg = "ffmpeg.exe"


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

Now you have a lot of answers to select from ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
RapTure

Thanks a lot guys. I put equal signs before but I got a different error so I guess that was my problem the whole time. thanks a lot.

Share this post


Link to post
Share on other sites
RapTure

RapTure,

Welcome to the AutoIt forum. :)

A few syntax errors there. You need an "=" to assign values to a variable - and non-numeric values need to be enclosed in "". There were also some problems with the quotes in the $ffmpegparams line. See if this is any better - at least it does not error when I test. ;)

;# FFMpeg Encode Script v1
#RequireAdmin
;##### CONFIG STARTS HERE #####
Global $fps = 60
Global $encoder = "divx"
Global $threads = 2
Global $audiobitrate = "128k"
Global $ffmpeg = "ffmpeg.exe"
;##### CONFIG ENDS HERE #####
;-----------------------------------------------------------------------------
;----------------------------- DO NOT EDIT BELOW -----------------------------
;-----------------------------------------------------------------------------
Global $flvname
Global $videoout
Global $soundout
While 1
;Ask user for .flv file name
$flvname = InputBox("FFMpeg Encoder", "What is the name of the .flv that you wish To encode? Make sure it’s In the same directory as FFMpeg And the FFMpeg Encoder")
;Ask for Video Output
$videoout = InputBox("FFMpeg Encoder", "What would you like the video file To be named?")
;Ask for Audio Output
$audioout = InputBox("FFMpeg Encoder", "What would you like your audio file to be named?")
;Build FFMpeg Video Params Line
Global $ffmpegparams = " - i " & $flvname & ".flv - c:a libmp3lame - b:a " & $audiobitrate & " - sameq - r " & $fps & " - vtag " & $encoder & " - threads " & $threads & '"' & $videoout & ".avi"
;Start video encode
ShellExecute($ffmpeg, $ffmpegparams)
;Build FFMpeg Audio Params Line
Global $audioparams = "-i " & $flvname & ".flv -b:a " & $audiobitrate & " " & $soundout & ".mp3"
;Start audio encode
ShellExecute($ffmpeg, $audioparams)
;Close script (Exit)
Exit
WEnd

We may still have to work on the $ffmpegparams line to get the quotes correct. Do you code in SciTE? :huh:

M23

Yeah I was coding in SciTE.

this script was able to compile for me but the program would only run $audioparams, not $ffmpegparams so I am getting my output audio file (no name for some reason though) and no video.

Share this post


Link to post
Share on other sites
Melba23

RapTure,

I thought the quotes might not be quite right. :(

Add this line immediately after "Global $ffmpegparams = ...." and see if what you get in the lower pane of SciTe is what you actually need:

ConsoleWrite($ffmpegparams & @CRLF)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
RapTure

RapTure,

I thought the quotes might not be quite right. :(

Add this line immediately after "Global $ffmpegparams = ...." and see if what you get in the lower pane of SciTe is what you actually need:

ConsoleWrite($ffmpegparams & @CRLF)

M23

I actually found my error. there was a space in "-i" so ffmpeg wasn't recognizing what the command was and was just opening and closing immediately. I am still getting blank file names though

Share this post


Link to post
Share on other sites
RapTure

Found my problem. Program is working perfectly now. Thank you everyone for you help. Also my error was that late last night I decided $audioout was just a weird looking name for the variable so I renamed it to $soundout, however when I did so I did it only in the $audioparams line instead of the rest of the code as well. New finished version if anyone would like it.

;# FFMpeg Encode Script v1

#RequireAdmin

;##### CONFIG STARTS HERE #####

Global $fps = 60

Global $encoder = "divx"

Global $threads = 2

Global $audiobitrate = "128k"

Global $ffmpeg = "ffmpeg.exe"

;##### CONFIG ENDS HERE #####


;-----------------------------------------------------------------------------
;----------------------------- DO NOT EDIT BELOW -----------------------------
;-----------------------------------------------------------------------------

Global $flvname
Global $videoout
Global $soundout

While 1
;Ask user for .flv file name
$flvname = InputBox("FFMpeg Encoder", "What is the name of the .flv that you wish To encode? Make sure it’s In the same directory as FFMpeg And the FFMpeg Encoder")
;Ask for Video Output
$videoout = InputBox("FFMpeg Encoder", "What would you like the video file To be named?")
;Ask for Audio Output
$soundout = InputBox("FFMpeg Encoder", "What would you like your audio file to be named?")
;Build FFMpeg Video Params Line
Global $ffmpegparams = "-i " & $flvname & ".flv -c:a libmp3lame -b:a " & $audiobitrate & " -sameq -r " & $fps & " -vtag " & $encoder & " -threads " & $threads & " " & $videoout & ".avi"
;Start video encode
ShellExecute($ffmpeg, $ffmpegparams)
;Build FFMpeg Audio Params Line
Global $audioparams = "-i " & $flvname & ".flv -b:a " & $audiobitrate & " " & $soundout & ".mp3"
;Start audio encode
ShellExecute($ffmpeg, $audioparams)
;Close script (Exit)
Exit
WEnd

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
Sign in to follow this  

×