Post by cineman on May 26, 2023 1:58:11 GMT -5
Hi I’m a novis basic programmer, been programming in basic over the years, but need to do something i have not encountered before, and that is modify the data in a text string by ixerting charators specific places, its containing the path to a file in a subfolder acquired from a filedialog command. The program I’m writing is a GUI for a special application of the popular video editing codec ffmpeg. and in particular the string I want to modify is the data in the subtitle subname$ I'm using Liberty Basic to produce a command line to start ffmpeg and make it do what I want it to do. The liberty basic code i created is this:-
run "ffmpeg -i "+filename$+" -vf subtitles="+subname$+" -f image2 d:\png\%08d.png"
with the paths coming from two filedialog inputs one for the location of the input file in this case called sample.mkv and the subtitle file called sample.srt which produces the following:-
ffmpeg -i D:\dennervision\sample.mkv -vf subtitles=D:\dennervision\sample.srt -f image2 d:\png\%08d.png
If the two files were resident in the ffmpeg folder and this command line is run :-
ffmpeg -i sample.mkv -vf subtitles=sample.srt -f image2 d:\png\%08d.png"
it works just fine but due to a quirk in ffmpeg the portion of the command line relating to the srt file path causes it to crash and burn. in order for it to work the value in the subname$ needs to be changed from subtitles=D:\dennervision\sample.srt to subtitles='D\:\\dennervision\\sample.srt' complete with inverted commas ' and extra back slashes \ the completed working command line needs to look like this
ffmpeg -i D:\dennervision\sample.mkv -vf subtitles='d\:\\dennervision\\sample.srt' -f image2 d:\png\%08d.png"
But I’m not sure how to go about inserting the extra characters into the text string, ti would need to work with any path regardless of how deep in the file structure the srt file was located so just inserting ' \ at set locations wouldn't work. Can any one tell me how i to go about this please., thanks Mike
run "ffmpeg -i "+filename$+" -vf subtitles="+subname$+" -f image2 d:\png\%08d.png"
with the paths coming from two filedialog inputs one for the location of the input file in this case called sample.mkv and the subtitle file called sample.srt which produces the following:-
ffmpeg -i D:\dennervision\sample.mkv -vf subtitles=D:\dennervision\sample.srt -f image2 d:\png\%08d.png
If the two files were resident in the ffmpeg folder and this command line is run :-
ffmpeg -i sample.mkv -vf subtitles=sample.srt -f image2 d:\png\%08d.png"
it works just fine but due to a quirk in ffmpeg the portion of the command line relating to the srt file path causes it to crash and burn. in order for it to work the value in the subname$ needs to be changed from subtitles=D:\dennervision\sample.srt to subtitles='D\:\\dennervision\\sample.srt' complete with inverted commas ' and extra back slashes \ the completed working command line needs to look like this
ffmpeg -i D:\dennervision\sample.mkv -vf subtitles='d\:\\dennervision\\sample.srt' -f image2 d:\png\%08d.png"
But I’m not sure how to go about inserting the extra characters into the text string, ti would need to work with any path regardless of how deep in the file structure the srt file was located so just inserting ' \ at set locations wouldn't work. Can any one tell me how i to go about this please., thanks Mike