FFmpeg.workflow

flashi

Alkmene
Registriert
11.01.19
Beiträge
32
HI Leute,

Ich hatte keine Lust mehr jedes mal die Video Dateien im Terminal mit ffmpeg umzuwandeln darum habe ich mit Automator ein Einfaches Script geschrieben um es einen zu vereinfachen.

Man Markiert im Finder mehre Video Dateien oder eben nur eine und wählt dann mit ein Rechtsklick den Reiter ffmpeg aus und startet es. Jetzt muss man noch die Output File Options setzten und dann auf OK klicken und jetzt kann man noch das
Output Format setzen und klickt dann auf OK. Wenn das gemacht wurde werden jetzt die Video Dateien Umgewandelt. Sie werden im gleichen Ordner angelegt wo die Input Video Dateien enthalten sind.

Es wird auch geprüft ob ffmpeg installiert ist und wird in /usr/local/bin erwartet. Wie man ffmpeg Installiert kann man ihr nachlesen. Ich habe das auch so gemacht. Die Installation von ffmpeg ist sehr einfach.

Wenn man ein Fehler in den Output File Options macht wird ein Fehler ausgegeben und ffmpeg wird nicht gestartet.

Beim Erfolgreichen Umwandeln wird eine Notification mit ein Ton kurz eingeblendet.

Mit ein Doppelklick auf FFmpeg.workflow wird die Datei installiert. Wenn man FFmpeg.workflow wieder Deinstallieren will geht das ganz einfach. Öffnet die Einstellungen und geht dann auf Erweiterungen. Dann unter Finder FFmpeg Rechtsanklicken und Löschen. Es wird dann die FFmpeg.workflow Datei in den Papierkorb gelegt.

PS. Für Verbesserung's Vorschläge bin ich gern zu haben.

Code:
on run {input, parameters}
    try
        set ffmpegPath to do shell script "export PATH=$PATH:/usr/local/bin; which ffmpeg"
    on error
        beep 1
        display dialog "Please install \"ffmpeg\" on /usr/local/bin/ and try again." with title "Could not find \"ffmpeg\"!" buttons {"OK"} default button 1
        return
    end try
    set fcount to 0
    try
        set output_file_options to "-threads 1 -preset fast -c:a aac -b:a 128k -c:v libx264 -vf scale=854:480"
        set output_format to "mp4"
        set {text returned:output_file_options} to (display dialog "Output File Options" default answer output_file_options buttons {"Abbrechen", "OK"} default button "OK" with title "ffmpeg")
        set {text returned:output_format} to (display dialog "Output Format?" default answer output_format buttons {"Abbrechen", "OK"} default button "OK" with title "ffmpeg")
        repeat with i in input
            set fname to POSIX path of i
            set o to text 1 thru -5 of fname
            do shell script ffmpegPath & " -i " & quoted form of fname & " " & output_file_options & " " & quoted form of (o & ".") & output_format
            set fcount to fcount + 1
        end repeat
        #display dialog "Number of files converted: " & fcount buttons {"OK"} default button 1 with title "ffmpeg" with hidden answer
        display notification "Number of files converted: " & fcount with title "ffmpeg"
    on error errorMessage
        beep 1
        display dialog errorMessage buttons {"OK"} with title "ffmpeg"
    end try
    return fcount
end run
 

Anhänge

  • Bildschirmfoto 2019-02-06 um 22.39.57.png
    Bildschirmfoto 2019-02-06 um 22.39.57.png
    421,1 KB · Aufrufe: 24
  • Bildschirmfoto 2019-02-06 um 22.42.27.png
    Bildschirmfoto 2019-02-06 um 22.42.27.png
    109,4 KB · Aufrufe: 24
  • Bildschirmfoto 2019-02-06 um 22.43.15.png
    Bildschirmfoto 2019-02-06 um 22.43.15.png
    102,5 KB · Aufrufe: 24
  • FFmpeg.workflow.zip
    152,8 KB · Aufrufe: 0
  • Bildschirmfoto 2019-02-06 um 23.00.08.png
    Bildschirmfoto 2019-02-06 um 23.00.08.png
    78 KB · Aufrufe: 24

flashi

Alkmene
Registriert
11.01.19
Beiträge
32
Ich habe mal das Script verbessert/verändert.

Die Output Optionen werden jetzt aus einer Text Datei ausgelesen. Das gleiche gilt für das Output Format. Die Text Dateien müssen nach Dokumente.

Die Error Logs werden jetzt auch in eine Log Datei gespeichert. Es werden jetzt auch der Erfolg in eine Log Datei gespeichert. Die Log Dateien werden in Dokumente erstellt.

Es wird jetzt gefragt ob das Script ausgeführt werden soll.


ffmpeg_output_file_options.txt
Code:
-threads 1 -preset fast -c:a aac -b:a 128k -c:v libx264 -vf scale=854:480

ffmpeg_output_format.txt
Code:
mp4

ffmpeg.workflow
Code:
on run {input, parameters}

try

set ffmpegPath to do shell script "export PATH=$PATH:/usr/local/bin; which ffmpeg"

on error

beep 1

display dialog "Please install \"ffmpeg\" on /usr/local/bin/ and try again." with title "Could not find \"ffmpeg\"!" buttons {"OK"} default button 1


return

end try

set fcount to 0

display dialog "Should the script be executed?" buttons {"Yes", "No"} with title "ffmpeg"

set DlogResult to result

if button returned of result = "Yes" then

try

set file_path_output_file_options to ((path to documents folder) & "ffmpeg_output_file_options.txt") as string

read file file_path_output_file_options

set output_file_options to result

set file_path_output_format to ((path to documents folder) & "ffmpeg_output_format.txt") as string

read file file_path_output_format

set output_format to result

repeat with i in input

set fname to POSIX path of i

set o to text 1 thru -5 of fname

do shell script ffmpegPath & " -i " & quoted form of fname & " " & output_file_options & " " & quoted form of (o & ".") & output_format

set fcount to fcount + 1

set logPath to (path to documents folder as string) & "ffmpeg_video_ created.log"

try

set logFile to open for access file logPath with write permission

write (date string of (current date) & " " & time string of (current date) & " -- " & ffmpegPath & " -i " & quoted form of fname & " " & output_file_options & " " & quoted form of (o & ".") & output_format & return) to logFile starting at eof

close access logFile

try

close access logFile

end try

end try

end repeat

display notification "Number of files converted: " & fcount with title "ffmpeg"

on error errorMessage

set logPath to (path to documents folder as string) & "ffmpeg_errors.log"

try

set logFile to open for access file logPath with write permission

write (errorMessage & return) to logFile starting at eof

beep 2

display dialog "An error has occurred! More is in the log file!" & logPath buttons {"OK"} with title "ffmpeg" default button 1

close access logFile

on error

try

close access logFile

end try

end try

end try

else

beep 3

end if

return fcount

end run

EDIT
Es war ein Fehler im Code. Ist gefixt.
 

Anhänge

  • ffmpeg.zip
    233,7 KB · Aufrufe: 1
Zuletzt bearbeitet:
  • Like
Reaktionen: kelevra und Freddy K.

Keef

Gestreifter Böhmischer Borsdorfer
Registriert
17.07.09
Beiträge
3.420
Für die, denen das Verständnis für Automator oder AppleScript fehlt (metoo:D ), gibt es ein gutes Programm.
 
  • Like
Reaktionen: kelevra

flashi

Alkmene
Registriert
11.01.19
Beiträge
32
Da gebe ich dir recht mit Automator und AppleScript ist es nicht einfach. Ich bin Anfänger und es macht mir einfach spass und wenn es dann noch klappt ist es noch besser.

Hier noch ein kleines update.

FFmpeg Script Installer.app

  • Es wird FFmpeg Edit.app in Programme installiert
  • Es wird FFmpeg.workflow in Services Installiert
  • Es wird ffmpeg_output_file_options.txt in Dokumente installiert
  • Es wird ffmpeg_output_format.txt in Dokumente installiert
main.scpt von FFmpeg Script Installer.app
Code:
set theicon to alias ((path to me as text) & "Contents:Resources:applet.icns")
set the_path to "/usr/local/bin/ffmpeg"
try
    POSIX file (the_path) as alias
    set file_exists to true
    display dialog "Should the FFmpeg script be installed?" buttons {"Yes", "No"} with title "ffmpeg" with icon theicon
    set DlogResult to result
    if button returned of result = "Yes" then
        set theFileFFmpegWorkflow to alias ((path to me as text) & "Contents:Resources:Stuff:FFmpeg.workflow")
        set theFileFFmpegOutputFormatTxt to alias ((path to me as text) & "Contents:Resources:Stuff:ffmpeg_output_format.txt")
        set theFileFFmpegOutputFileOptionsTxt to alias ((path to me as text) & "Contents:Resources:Stuff:ffmpeg_output_file_options.txt")
        set theFileFFmpegEditapp to alias ((path to me as text) & "Contents:Resources:Stuff:FFmpeg Edit.app")
        set theNewFolderServices to (path to services folder)
        set theNewFolderDocuments to (path to documents folder)
        set theNewFolderApplications to (path to applications folder)
        tell application "Finder"
            activate
            duplicate theFileFFmpegWorkflow to theNewFolderServices with replacing
            duplicate theFileFFmpegOutputFormatTxt to theNewFolderDocuments with replacing
            duplicate theFileFFmpegOutputFileOptionsTxt to theNewFolderDocuments with replacing
            duplicate theFileFFmpegEditapp to theNewFolderApplications with replacing
        end tell
    end if
on error
    set file_exists to false
    beep 3
    display dialog "Please install \"ffmpeg\" on /usr/local/bin/ and try again." with title "Could not find \"ffmpeg\"!" with icon theicon buttons {"OK"} default button 1
    return
end try


FFmpeg Edit.app

  • Man kann die ffmpeg_output_file_options.txt bearbeiten
  • Man kann die ffmpeg_output_format.txt bearbeiten

main.scpt von FFmpeg Edit.app

Code:
set theicon to alias ((path to me as text) & "Contents:Resources:applet.icns")
set the_path to "/usr/local/bin/ffmpeg"
try
    POSIX file (the_path) as alias
    set file_exists to true
    set theicon to alias ((path to me as text) & "Contents:Resources:applet.icns")
    set output_file_options to ""
    set theFileRead to (path to documents folder as string) & "ffmpeg_output_file_options.txt"
    try
        open for access theFileRead
        set output_file_options to (read file theFileRead as «class utf8»)
        close access theFileRead
    end try
    set output_format to ""
    set theFileRead1 to (path to documents folder as string) & "ffmpeg_output_format.txt"
    try
        open for access theFileRead1
        set output_format to (read file theFileRead1 as «class utf8»)
        close access theFileRead1
    end try
    set {text returned:output_file_options} to (display dialog "Output File Options" default answer output_file_options buttons {"Abort", "Save"} with title "FFmpeg Edit" with icon theicon)
    set DlogResult to result
    if button returned of result = "Save" then
        set theFileWrite_output_file_options to (path to documents folder as string) & "ffmpeg_output_file_options.txt"
        try
            set theFileWrite to open for access file theFileWrite_output_file_options with write permission
            set eof of theFileWrite to 0
            write (output_file_options) to theFileWrite
            close access theFileWrite
        end try
        set {text returned:output_format} to (display dialog "Output Format" default answer output_format buttons {"Abort", "Save"} with title "FFmpeg Edit" with icon theicon)
        set theFileWrite_output_format to (path to documents folder as string) & "ffmpeg_output_format.txt"
        try
            set theFileWrite1 to open for access file theFileWrite_output_format with write permission
            set eof of theFileWrite1 to 0
            write (output_format) to theFileWrite1
            close access theFileWrite1
        end try
    end if
on error
    set file_exists to false
    beep 3
    display dialog "Please install \"ffmpeg\" on /usr/local/bin/ and try again." with title "Could not find \"ffmpeg\"!" with icon theicon buttons {"OK"} default button 1
    return
end try


FFmpeg.workflow

  • Check ob ffmpeg installiert ist
  • Es werden die Errors in einer ffmpeg_errors.log geschrieben und in Dokumente abgelegt.
  • Bei erfolgreichen Erstellen der Video Datei wird eine ffmpeg_video_created.log in Dokumente erstellt
Code:
on run {input, parameters}
    set ffmpegPath to "/usr/local/bin/ffmpeg"
    try
        POSIX file (ffmpegPath) as alias
        set file_exists to true
        set file_path_output_file_options to ((path to documents folder) & "ffmpeg_output_file_options.txt") as string
        set file_path_output_format to ((path to documents folder) & "ffmpeg_output_format.txt") as string
        set logPath_ffmpeg_video_created to (path to documents folder as string) & "ffmpeg_video_created.log"
        set logPath_ffmpeg_errors to (path to documents folder as string) & "ffmpeg_errors.log"
        set fcount to 0
        display dialog "Should the script be executed?" buttons {"Yes", "No"} with title "ffmpeg"
        set DlogResult to result
        if button returned of result = "Yes" then
            try
                read file file_path_output_file_options
                set output_file_options to result
                read file file_path_output_format
                set output_format to result
                repeat with i in input
                    set fname to POSIX path of i
                    set o to text 1 thru -5 of fname
                    do shell script ffmpegPath & " -i " & quoted form of fname & " " & output_file_options & " " & quoted form of (o & ".") & output_format
                    set fcount to fcount + 1
                    try
                        set logFile to open for access file logPath_ffmpeg_video_created with write permission
                        write (date string of (current date) & " " & time string of (current date) & " -- " & ffmpegPath & " -i " & quoted form of fname & " " & output_file_options & " " & quoted form of (o & ".") & output_format & return) to logFile starting at eof
                        close access logFile
                        try
                            close access logFile
                        end try
                    end try
                end repeat
                display notification "Number of files converted: " & fcount with title "ffmpeg"
            on error errorMessage
                try
                    set logFile to open for access file logPath_ffmpeg_errors with write permission
                    write (errorMessage & return) to logFile starting at eof
                    beep 3
                    tell application "Console"
                        activate
                        open logPath_ffmpeg_errors
                    end tell
                    close access logFile
                on error
                    try
                        close access logFile
                    end try
                end try
            end try
        else
            beep 3
        end if
        return fcount
    on error
        set file_exists to false
        beep 3
        display dialog "Please install \"ffmpeg\" on /usr/local/bin/ and try again." with title "Could not find \"ffmpeg\"!" buttons {"OK"} default button 1
        return
    end try
end run

PS. Es gibt noch ein kleinen Schönheit's Fehler. Bei ein Fehler soll ja die ffmpeg_errors.log mit der Konsole.app angezeigt werden. Das geht auch soweit aber es wird dann auch noch ein 2 Konsolen Fenster Angezeigt was nicht gewollt ist. Ihr der Code dazu. Wo ist da der Fehler?

Code:
set logPath_ffmpeg_errors to (path to documents folder as string) & "ffmpeg_errors.log"

Code:
            on error errorMessage
                try
                    set logFile to open for access file logPath_ffmpeg_errors with write permission
                    write (errorMessage & return) to logFile starting at eof
                    beep 3
                    tell application "Console"
                        activate
                        open logPath_ffmpeg_errors
                    end tell
                    close access logFile
                on error
                    try
                        close access logFile
                    end try
                end try
            end try

Im Bild zu sehen, Links. Die Mitteilungen sollen natürlich nicht Angezeigt werden. Wie bekomme ich das hin?

121827-e5c80119a38cec316c4ee8b75709cdb7.jpg
 

Anhänge

  • FFmpeg Script Installer.app.zip
    822,8 KB · Aufrufe: 2
  • Bildschirmfoto 2019-02-14 um 15.59.47.png
    Bildschirmfoto 2019-02-14 um 15.59.47.png
    1,4 MB · Aufrufe: 7
  • Like
Reaktionen: kelevra

flashi

Alkmene
Registriert
11.01.19
Beiträge
32
Den Schönheit's Fehler habe ich selbst Korrigiert. Jetzt wird bei ein Fehler nur die Datei ffmpeg_errors.log geöffnet und bei Erfolg nur die Datei ffmpeg_video_created.log geöffnet

Alter Code für ffmpeg_errors.log
Code:
           on error errorMessage
               try
                   set logFile to open for access file logPath_ffmpeg_errors with write permission
                   write (errorMessage & return) to logFile starting at eof
                   beep 3
                   tell application "Console"
                       activate
                       open logPath_ffmpeg_errors
                   end tell
                   close access logFile
               on error
                   try
                       close access logFile
                   end try
               end try

Neuer Code für ffmpeg_errors.log
Code:
            on error errorMessage
                try
                    set logFile to open for access file logPath_ffmpeg_errors with write permission
                    write (errorMessage & return) to logFile starting at eof
                    beep 3
                    set hiddenscriptpath to logPath_ffmpeg_errors
                    set hiddenscriptpath to POSIX path of hiddenscriptpath
                    set qtdhiddenscriptpath to quoted form of hiddenscriptpath
                    try
                        set command to "open " & qtdhiddenscriptpath
                        do shell script command
                    end try
                    close access logFile
                on error
                    try
                        close access logFile
                    end try
                end try
            end try


Neuer Code für ffmpeg_video_created.log
Code:
display notification "Number of files converted: " & fcount with title "ffmpeg"

set hiddenscriptpath to logPath_ffmpeg_video_created

set hiddenscriptpath to POSIX path of hiddenscriptpath

set qtdhiddenscriptpath to quoted form of hiddenscriptpath

try

set command to "open " & qtdhiddenscriptpath

do shell script command

end try
 

flashi

Alkmene
Registriert
11.01.19
Beiträge
32
Es hat sich eine menge getan. Es wird jetzt alles beim User Installiert. Die Log Funktion ist jetzt viel besser. Die Convert Time wird in der Log gespeichert Pro Datei. Es wird die Sitze für Input und Output in der Log gespeichert. Die Log Datei ist Übersichtlicher geworden. Die Scripte sind öffentlich und können bearbeitet werden. Wenn man die FFmpeg.workflow über die Status Leiste vor dem beenden des konvertieren der Videos beendet läuft das konvertieren weiter bis das Video oder die Videos Fertig konvertiert sind oder man beendet vorher ffmpeg Manuell. Das ist kein Fehler.

FFmpeg Script Installer.app (verbessert)
  • Es wird FFmpeg Edit.app in User Programme installiert
  • Es wird FFmpeg.workflow in User Services Installiert
  • Es wird ffmpeg_global_options.cfg in User Dokumente installiert
  • Es wird ffmpeg_input_options.cfg in User Dokumente installiert
  • Es wird ffmpeg_output_format.cfg in User Dokumente installiert
  • Es wird ffmpeg_output_options.cfg in User Dokumente installiert
Code:
-- ==================================================================

-- FFmpeg Installer.app v1.1

-- ==================================================================

on hiddenScriptPath(unixPath)

set foo to unixPath

set foo to POSIX path of foo

set qtdfoo to quoted form of foo

try

set command to "open " & qtdfoo

do shell script command

end try

end hiddenScriptPath

on writeFile(this_data, target_file, append_data)

try

set the target_file to the target_file as string

set the open_target_file to open for access file target_file with write permission

if append_data is false then set eof of the open_target_file to 0

write this_data to the open_target_file starting at eof

close access the open_target_file

return true

on error

try

close access file target_file

end try

return false

end try

end writeFile

set theicon to alias ((path to me as text) & "Contents:Resources:applet.icns")

set logPathFFmpegInstaller to (path to documents folder as string) & "FFmpeg_Installer.log"

set theFileFFmpegWorkflow to alias ((path to me as text) & "Contents:Resources:.Stuff:FFmpeg.workflow")

set theFileFFmpegGlobalFormatCfg to alias ((path to me as text) & "Contents:Resources:.Stuff:ffmpeg_global_options.cfg")

set theFileFFmpegOutputFormatCfg to alias ((path to me as text) & "Contents:Resources:.Stuff:ffmpeg_output_format.cfg")

set theFileFFmpegOutputOptionsCfg to alias ((path to me as text) & "Contents:Resources:.Stuff:ffmpeg_output_options.cfg")

set theFileFFmpegInputOptionsCfg to alias ((path to me as text) & "Contents:Resources:.Stuff:ffmpeg_input_options.cfg")

set theFileFFmpegEditapp to alias ((path to me as text) & "Contents:Resources:.Stuff:FFmpeg Edit.app")

set theNewFolderServices to (path to services folder)

set theNewFolderDocuments to (path to documents folder)

set theNewFolderApplications to (path to applications folder from user domain)

display dialog "Should the FFmpeg be installed?" buttons {"Yes", "No"} with title "ffmpeg" with icon theicon

set DlogResult to result

if button returned of result = "Yes" then

tell application "Finder"

try

try

set theNewFolderApplicationsCheck to (path to applications folder from user domain as text) & "FFmpeg Edit.app" as alias

duplicate theFileFFmpegEditapp to theNewFolderApplications with replacing

set output1 to date string of (current date) & " " & time string of (current date) & " -- \"FFmpeg Edit.app\" has been overwritten in " & theNewFolderApplications & return

on error

duplicate theFileFFmpegEditapp to theNewFolderApplications

set output1 to date string of (current date) & " " & time string of (current date) & " -- \"FFmpeg Edit.app\" has been copied to " & theNewFolderApplications & return

end try

try

set theNewFolderServicesCheck to (path to services folder as text) & "FFmpeg.workflow" as alias

duplicate theFileFFmpegWorkflow to theNewFolderServices with replacing

set output2 to date string of (current date) & " " & time string of (current date) & " -- \"FFmpeg.workflow\" has been overwritten in " & theNewFolderServices & return

on error

duplicate theFileFFmpegWorkflow to theNewFolderServices

set output2 to date string of (current date) & " " & time string of (current date) & " -- \"FFmpeg.workflow\" has been copied to " & theNewFolderServices & return

end try

try

set theNewFolderDocumentsCheck to (path to documents folder as text) & "ffmpeg_global_options.cfg" as alias

duplicate theFileFFmpegGlobalFormatCfg to theNewFolderDocuments with replacing

set output3 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_global_options.cfg\" has been overwritten in " & theNewFolderDocuments & return

on error

duplicate theFileFFmpegGlobalFormatCfg to theNewFolderDocuments

set output3 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_global_options.cfg\" has been copied to " & theNewFolderDocuments & return

end try

try

set theNewFolderDocumentsCheck to (path to documents folder as text) & "ffmpeg_input_options.cfg" as alias

duplicate theFileFFmpegInputOptionsCfg to theNewFolderDocuments with replacing

set output4 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_input_options.cfg\" has been overwritten in " & theNewFolderDocuments & return

on error

duplicate theFileFFmpegInputOptionsCfg to theNewFolderDocuments

set output4 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_input_options.cfg\" has been copied to " & theNewFolderDocuments & return

end try

try

set theNewFolderDocumentsCheck to (path to documents folder as text) & "ffmpeg_output_options.cfg" as alias

duplicate theFileFFmpegOutputOptionsCfg to theNewFolderDocuments with replacing

set output5 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_output_options.cfg\" has been overwritten in " & theNewFolderDocuments & return

on error

duplicate theFileFFmpegOutputOptionsCfg to theNewFolderDocuments

set output5 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_output_options.cfg\" has been copied to " & theNewFolderDocuments & return

end try

try

set theNewFolderDocumentsCheck to (path to documents folder as text) & "ffmpeg_output_format.cfg" as alias

duplicate theFileFFmpegOutputFormatCfg to theNewFolderDocuments with replacing

set output6 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_output_format.cfg\" has been overwritten in " & theNewFolderDocuments & return

on error

duplicate theFileFFmpegOutputFormatCfg to theNewFolderDocuments

set output6 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_output_format.cfg\" has been copied to " & theNewFolderDocuments & return

end try

end try

end tell

writeFile(output1 & output2 & output3 & output4 & output5 & output6, logPathFFmpegInstaller, false)

hiddenScriptPath(logPathFFmpegInstaller)

end if

FFmpeg Uninstaller.app (neu)
  • Man kann jetzt FFmpeg Edit.app Deinstallieren
  • Man kann jetzt FFmpeg.workflow Deinstallieren
  • Man kann jetzt ffmpeg_global_options.cfg Deinstallieren
  • Man kann jetzt ffmpeg_input_options.cfg Deinstallieren
  • Man kann jetzt ffmpeg_output_format.cfg Deinstallieren
  • Man kann jetzt ffmpeg_output_options.cfg Deinstallieren
Code:
-- ==================================================================

-- FFmpeg Uninstaller.app v1.1

-- ==================================================================

on hiddenScriptPath(unixPath)

set foo to unixPath

set foo to POSIX path of foo

set qtdfoo to quoted form of foo

try

set command to "open " & qtdfoo

do shell script command

end try

end hiddenScriptPath

on writeFile(this_data, target_file, append_data)

try

set the target_file to the target_file as string

set the open_target_file to open for access file target_file with write permission

if append_data is false then set eof of the open_target_file to 0

write this_data to the open_target_file starting at eof

close access the open_target_file

return true

on error

try

close access file target_file

end try

return false

end try

end writeFile

set theicon to alias ((path to me as text) & "Contents:Resources:applet.icns")

set logPathFFmpegUninstall to (path to documents folder as string) & "FFmpeg_Uninstall.log"

set theFileFFmpegEditapp to (path to applications folder from user domain as text) & "FFmpeg Edit.app"

set theFileFFmpegWorkflow to (path to services folder as text) & "FFmpeg.workflow"

set theFileFFmpegGlobalOptionsCfg to (path to documents folder as text) & "ffmpeg_global_options.cfg"

set theFileFFmpegInputOptionsCfg to (path to documents folder as text) & "ffmpeg_input_options.cfg"

set theFileFFmpegOutputOptionsCfg to (path to documents folder as text) & "ffmpeg_output_options.cfg"

set theFileFFmpegOutputFormatCfg to (path to documents folder as text) & "ffmpeg_output_format.cfg"

set theNewFolderServices to (path to services folder)

set theNewFolderDocuments to (path to documents folder)

set theNewFolderApplications to (path to applications folder from user domain)

display dialog "Should the FFmpeg be Uninstall?" buttons {"Yes", "No"} with title "ffmpeg" with icon theicon

set DlogResult to result

if button returned of result = "Yes" then

tell application "Finder"

try

try

theFileFFmpegEditapp as alias

delete file theFileFFmpegEditapp

set output1 to date string of (current date) & " " & time string of (current date) & " -- \"FFmpeg Edit.app\" has been deleted in " & theNewFolderApplications & return

on error

set output1 to date string of (current date) & " " & time string of (current date) & " -- \"FFmpeg Edit.app\" was not found in " & theNewFolderApplications & return

end try

try

theFileFFmpegWorkflow as alias

delete file theFileFFmpegWorkflow

set output2 to date string of (current date) & " " & time string of (current date) & " -- \"FFmpeg.workflow\" has been deleted in " & theNewFolderServices & return

on error

set output2 to date string of (current date) & " " & time string of (current date) & " -- \"FFmpeg.workflow\" was not found in " & theNewFolderServices & return

end try

try

theFileFFmpegGlobalOptionsCfg as alias

delete file theFileFFmpegGlobalOptionsCfg

set output3 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_global_options.cfg\" has been deleted in " & theNewFolderDocuments & return

on error

set output3 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_global_options.cfg\" was not found in " & theNewFolderDocuments & return

end try

try

theFileFFmpegInputOptionsCfg as alias

delete file theFileFFmpegInputOptionsCfg

set output4 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_input_options.cfg\" has been deleted in " & theNewFolderDocuments & return

on error

set output4 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_input_options.cfg\" was not found in " & theNewFolderDocuments & return

end try

try

theFileFFmpegOutputOptionsCfg as alias

delete file theFileFFmpegOutputOptionsCfg

set output5 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_output_options.cfg\" has been deleted in " & theNewFolderDocuments & return

on error

set output5 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_output_options.cfg\" was not found in " & theNewFolderDocuments & return

end try

try

theFileFFmpegOutputFormatCfg as alias

delete file theFileFFmpegOutputFormatCfg

set output6 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_output_format.cfg\" has been deleted in " & theNewFolderDocuments & return

on error

set output6 to date string of (current date) & " " & time string of (current date) & " -- \"ffmpeg_output_format.cfg\" was not found in " & theNewFolderDocuments & return

end try

set warns before emptying of trash to false

empty trash

end try

end tell

writeFile(output1 & output2 & output3 & output4 & output5 & output6, logPathFFmpegUninstall, false)

hiddenScriptPath(logPathFFmpegUninstall)

end if

FFmpeg Edit.app (verbessert)

  • Edit ffmpeg_global_options.cfg
  • Edit ffmpeg_input_options.cfg
  • Edit ffmpeg_output_format.cfg
  • Edit ffmpeg_output_options.cfg
Code:
-- ==================================================================

-- FFmpeg Edit.app v1.1

-- ==================================================================

set theicon to alias ((path to me as text) & "Contents:Resources:applet.icns")

on readFile(unixPath)

set foo to (open for access (unixPath))

set txt to (read foo for (get eof foo) as «class utf8»)

close access foo

return txt

end readFile

on writeFile(this_data, target_file, append_data)

try

set the target_file to the target_file as string

set the open_target_file to open for access file target_file with write permission

if append_data is false then set eof of the open_target_file to 0

write this_data to the open_target_file starting at eof

close access the open_target_file

return true

on error

try

close access file target_file

end try

return false

end try

end writeFile

set global_options to readFile((path to documents folder as string) & "ffmpeg_global_options.cfg")

set {text returned:global_options} to (display dialog "Global Options:" default answer global_options buttons {"Abort", "Save"} with title "FFmpeg Edit" with icon theicon)

if the button returned of the result is "Save" then

writeFile(global_options, (path to documents folder as string) & "ffmpeg_global_options.cfg", false)

end if

set input_options to readFile((path to documents folder as string) & "ffmpeg_input_options.cfg")

set {text returned:input_options} to (display dialog "Input Options:" default answer input_options buttons {"Abort", "Save"} with title "FFmpeg Edit" with icon theicon)

if the button returned of the result is "Save" then

writeFile(input_options, (path to documents folder as string) & "ffmpeg_input_options.cfg", false)

end if

set output_options to readFile((path to documents folder as string) & "ffmpeg_output_options.cfg")

set {text returned:output_options} to (display dialog "Output Options:" default answer output_options buttons {"Abort", "Save"} with title "FFmpeg Edit" with icon theicon)

if the button returned of the result is "Save" then

writeFile(output_options, (path to documents folder as string) & "ffmpeg_output_options.cfg", false)

end if

set output_format to readFile((path to documents folder as string) & "ffmpeg_output_format.cfg")

set {text returned:output_format} to (display dialog "Output Format:" default answer output_format buttons {"Abort", "Save"} with title "FFmpeg Edit" with icon theicon)

if the button returned of the result is "Save" then

writeFile(output_format, (path to documents folder as string) & "ffmpeg_output_format.cfg", false)

end if

FFmpeg.workflow (verbessert)

  • Log Funktion verbessert

Code:
-- ==================================================================

-- FFmpeg.workflow v1.5

-- ==================================================================

on TimeToText(TheTime)

if (class of TheTime) as text is "integer" then

set TimeString to 1000000 + 10000 * (TheTime mod days div hours)

set TimeString to TimeString + 100 * (TheTime mod hours div minutes)

set TimeString to (TimeString + (TheTime mod minutes)) as text

tell TimeString to set TheTime to (text -6 thru -5) & ":" & (text -4 thru -3) & ":" & (text -2 thru -1)

end if

return TheTime

end TimeToText

on readFile(unixPath)

set foo to (open for access (unixPath))

set txt to (read foo for (get eof foo) as «class utf8»)

close access foo

return txt

end readFile

on hiddenscriptpath(unixPath)

set foo to unixPath

set foo to POSIX path of foo

set qtdfoo to quoted form of foo

try

set command to "open " & qtdfoo

do shell script command

end try

end hiddenscriptpath

on write_to_file(this_data, target_file, append_data)

try

set the target_file to the target_file as string

set the open_target_file to open for access file target_file with write permission

if append_data is false then set eof of the open_target_file to 10

write this_data to the open_target_file starting at eof as «class utf8»

close access the open_target_file

return true

on error

try

close access file target_file

end try

return false

end try

end write_to_file

on readBytes(unixPath)

set izmers_all to 0

set izmers to size of (info for (POSIX path of unixPath))

set izmers_all to izmers_all + izmers

set u to izmers_all / (1000 ^ 3)

set a to (round (100 * u)) / 100

set y to izmers_all / (1000 ^ 2)

set z to (round (100 * y)) / 100

set alerts to "" & y & " Bytes " & "( " & z & " MB )" & "(" & a & " GB)"

return alerts

end readBytes

on sedLogFormatFFmpegVideoCreated(row1, row2, row3, row4, row5, row6, row7, row8, row9, row10)

row1 & return & row2 & return & row3 & return & row4 & return & row5 & return & row6 & return & row7 & return & row8 & return & row9 & return & row10 & return & return

end sedLogFormatFFmpegVideoCreated

on goTimeFormatforLogFFmpeg()

set d to current date

set goDay to text -2 thru -1 of ("0" & d's day)

set goMonth to text -2 thru -1 of ("0" & ((month of d) * 1))

set goJear to ((year of d) as text)

set goClock to time string of (current date)

set TimeFormat to "===========================================================================================" & return & "|------------———————----—> Log FFmpeg from " & goDay & "." & goMonth & "." & goJear & " at " & goClock & " <---———----—---———-----—|" & return & "==========================================================================================="

end goTimeFormatforLogFFmpeg

on run {input, parameters}

set ffmpegPath to "/usr/local/bin/ffmpeg"

try

POSIX file (ffmpegPath) as alias

set file_exists to true

set global_options to readFile((path to documents folder as string) & "ffmpeg_global_options.cfg")

set input_options to readFile((path to documents folder as string) & "ffmpeg_input_options.cfg")

set output_options to readFile((path to documents folder as string) & "ffmpeg_output_options.cfg")

set output_format to readFile((path to documents folder as string) & "ffmpeg_output_format.cfg")

set logPath_ffmpeg_video_created to (path to documents folder as string) & "ffmpeg_video_created.log"

set logPath_ffmpeg_errors to (path to documents folder as string) & "ffmpeg_errors.log"

set fcount to 0

display dialog "Should the script be executed?" buttons {"Yes", "No"} with title "ffmpeg"

set DlogResult to result

if button returned of result = "Yes" then

try

repeat with i in input

set fname to POSIX path of i

set o to text 1 thru -5 of fname

set startTime to (current date)

do shell script ffmpegPath & " " & global_options & " " & input_options & " " & quoted form of fname & " " & output_options & " " & (quoted form of o & ".") & output_format

set EndTime to (current date)

set fcount to fcount + 1

set inputSize to readBytes(fname)

set outputSize to readBytes((o & ".") & output_format)

set TimeFormatforLogFFmpeg to goTimeFormatforLogFFmpeg()

set x to TimeToText(EndTime - startTime)

set output to sedLogFormatFFmpegVideoCreated(TimeFormatforLogFFmpeg, "Global Options: " & global_options, "Input Options: " & input_options, "Output Options: " & output_options, "Movie Input: " & fname, "Sitze Input: " & inputSize, "Movie Output: " & (o & ".") & output_format, "Sitze Output: " & outputSize, "Convert Time: " & x, TimeFormatforLogFFmpeg)

write_to_file(output, logPath_ffmpeg_video_created, true)

end repeat

display notification "Number of files converted: " & fcount with title "ffmpeg" sound name "default"

hiddenscriptpath(logPath_ffmpeg_video_created)

on error errorMessage

write_to_file((errorMessage) & return, logPath_ffmpeg_errors, false)

beep 3

hiddenscriptpath(logPath_ffmpeg_errors)

end try

else

beep 3

end if

return fcount

on error

set file_exists to false

display notification "Please install \"ffmpeg\" on /usr/local/bin/ and try again." with title "Could not find \"ffmpeg\"!" sound name "Glass"

return

end try

end run

ffmpeg_video_created.log (Beispiel)

Code:
===========================================================================================
|------------———————----—> Log FFmpeg from 26.02.2019 at 15:40:06 <---———----—---———-----—|
===========================================================================================
Global Options: -y
Input Options: -i
Output Options: -threads 1 -preset fast -c:a aac -b:a 192k -c:v libx264 -vf scale=854:480
Movie Input: /Users/flashi/Movies/Test/Killing.Eve.S01E01.mkv
Sitze Input: 1447,83759 Bytes ( 1447,84 MB )(1,45 GB)
Movie Output: /Users/flashi/Movies/Test/Killing.Eve.S01E01.mp4
Sitze Output: 213,609062 Bytes ( 213,61 MB )(0,21 GB)
Convert Time: 00:34:14
===========================================================================================
|------------———————----—> Log FFmpeg from 26.02.2019 at 15:40:06 <---———----—---———-----—|
===========================================================================================
 

Anhänge

  • FFmpeg Gui v1.1.dmg.zip
    1,8 MB · Aufrufe: 1
  • Like
Reaktionen: staettler

Benutzer 190524

Gast
hallo flashi ich bin noch nicht ganz sicher worin deine intensionen liegen ...
ea gobt do so vile guis dafür.. hmm
ich bspw gehe in der regel über handbrake um wie in meinem Fall x264 oder x265 auszugeben..