Jump to content

Having trouble finding my error.


Recommended Posts

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.

Link to post
Share on other sites

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.
Link to post
Share on other sites
  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to post
Share on other sites

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 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

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.

Link to post
Share on other sites
  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to post
Share on other sites

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
Link to post
Share on other sites

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
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...