Page 1 of 1

Teil eines Strings als VAR

Posted: 01 Jan 2022, 00:29
by nacken012
Hallo, wünsche ein Frohes neues Jahr.

Ich habe mir einen Video Converter für meinen Technisat Receiver geschrieben, das funktioniert auch alles perfekt.

Nun möchte es den erweitern um die Option, automatisch die schwarzen Balken eines Videos zu entfernen.

Habe es hinbekommen das ich die Schnitt Daten in einer txt Datei speicher, aber nun zu der Frage:

Wie kann man nur einen bestimmten Teil als VAR speichern ?

Hier die Ausgabe die ich bekomme:

[Parsed_cropdetect_0 @ 000001e3c4b8ccc0] x1:0 x2:719 y1:60 y2:516 w:720 h:448 x:0 y:64 pts:108000 t:1.200000 crop=720:448:0:64

Die Zeile kann immer anders aussehen, ich brauchte also das was hinter dem "crop=" steht als VAR


Wie mache ich so etwas ?

lg Horst

Re: Teil eines Strings als VAR

Posted: 01 Jan 2022, 03:05
by Rohwedder
Hallo,
z.B:

Code: Select all

Zeile = [Parsed_cropdetect_0 @ 000001e3c4b8ccc0] x1:0 x2:719 y1:60 y2:516 w:720 h:448 x:0 y:64 pts:108000 t:1.200000 crop=720:448:0:64
Var := StrSplit(Zeile, "crop=").2
MsgBox,% Var

Re: Teil eines Strings als VAR

Posted: 01 Jan 2022, 03:58
by nacken012
Vielen vielen Dank, perfekt :-)

Re: Teil eines Strings als VAR

Posted: 01 Jan 2022, 04:48
by nacken012
Das ist jetzt draus geworden

Code: Select all

GuiDropFiles:
Gui, Submit, nohide
SplitPath, A_GuiEvent, Dateiname, Verzeichnis, Erweiterung, NameOhneErw, Laufwerk
Sleep, 500
runwait,%comspec% /c bin\ffmpeg.exe -skip_frame nokey -y -hide_banner -loglevel 32 -stats -i "%A_GuiEvent%" -vf cropdetect -an -f null - 2>autocrop.txt

Sleep, 100
FileReadLine, line, autocrop.txt, 21

Zeile = %line%
Var := StrSplit(Zeile, "crop=").2

runwait,%comspec% /c bin\ffmpeg.exe -y -i "%A_GuiEvent%" -filter:v "crop="%Var% -f dvd -b:v 2800k -r 25 -ar 48000 -b:a 128k "%Verzeichnis%\%NameOhneErw%.mpg"

Re: Teil eines Strings als VAR

Posted: 01 Jan 2022, 05:54
by Rohwedder
Statt:

Code: Select all

Zeile = %line%
Var := StrSplit(Zeile, "crop=").2
geht auch:

Code: Select all

Var := StrSplit(line, "crop=").2