I made a Python code based on command-line VideoSubFinder
https://github.com/eritpchy/videosubfinder-cli
This is an excerpt from the code.
All I need to do is add the this code:Code:`video_file = testvideo.mp4 output_file = "C:/myprogram/output" command = [ videosubfinder_path, "-c", "-r", "-i", video_file, "-o" , output_file, ]`
inCode:`video_file.rsplit(".", 1)[0] + "_output" `
It keeps a folder file in a special folder + with the same video name.Code:output_file = "C:/myprogram/output/" (video_file.rsplit(".", 1)[0] + "_output")
Code:C:/myprogram/output/testvideo_output
+ Reply to Thread
Results 1 to 3 of 3
-
-
try this:
Code:from pathlib import Path # make Path objects from string paths video_file = Path("testvideo.mp4") output_file = Path(r"C:/myprogram/output") # get directory path output_file = output_file / f"{video_file.stem}_output" # create directory if it doesn't exist output_file.mkdir(parents=True, exist_ok=True) # use strings for paths again instead of Path objects in command line # also enveloping like that in quotes you make sure there can be spaces in paths command = [f"{videosubfinder_path}", "-c", "-r", "-i", f"{video_file}", "-o", f"{output_file}", ]
But when using those paths again in app, it needs to be switched back to strings, most apps do not accept Path objects, just path strings.
You can use str(path_object) or using f string formatting as used in example, because paths need to be enveloped by quotes, to be safe, if there are spaces in path strings and it is much more readable with those f strings. -
Thanks for the reply. I tried to add a path but it gives me errors. I will send you the full code in a private message.
Similar Threads
-
Python Script to download AES encrypted hls video
By GirlsGill in forum ProgrammingReplies: 6Last Post: 14th Aug 2024, 07:40 -
help needed compress a dvd folder audio.ts &video.ts folder to 8gb files
By barry25 in forum Authoring (DVD)Replies: 4Last Post: 13th Jul 2024, 15:25 -
Need Video contact sheet creator e.g first frame + filename only
By 75er in forum Newbie / General discussionsReplies: 0Last Post: 10th Sep 2022, 14:28 -
Need a Python Specialist for m3u8 file editing
By steven123 in forum ProgrammingReplies: 3Last Post: 28th May 2021, 17:57 -
Create video of image files, add a filename?
By jim3 in forum EditingReplies: 16Last Post: 3rd Jun 2020, 18:59