How to open a exported file directly from Python to Shotcut (VS Code, Free version)?

I have been learning coding some while ago, I now know how to cut some videos and join them and export a final render from python directly, but how do I open the final exported video only from python to shotcut? Here’s is my original code (with file name replaced with “clip1.mp4, clip2.mp4, …”, “audio.mp3, audio2.mp3, …”)

import moviepy.editor

clip_1 = moviepy.editor.VideoFileClip("clip1.mp4")
clip_1 = clip_1.subclip(0, 7)
clip_2 = moviepy.editor.VideoFileClip("clip2.mp4")
clip_2 = clip_2.subclip(0, 13)
clip_3 = moviepy.editor.VideoFileClip("clip3.mp4")
clip_3 = clip_1.subclip(0, 3)
audio_clip = moviepy.editor.CompositeAudioFileClip("audio.mp3")
new_audioclip = moviepy.editor.CompositeAudioClip([audio_clip])
final_output = moviepy.editor.concatenate_videoclips([clip_1, clip_2, clip_3])
final_output.audio = new_audioclip

final_output.write_videofile("importtosc.mp4", codec='libx264', audio_codec='aac', 
                              remove_temp=True, temp_audiofile='temp-audio.m4a')

So as you see the video that was made exported through python was importtosc.mp4, and after writing the output code, I want to write a code that makes it directly open into shotcut, so for this, what do I need to do now.

Thanks for any help!

https://docs.python.org/3/library/subprocess.html#subprocess.run
https://shotcut.org/notes/command-line-options/

this should do the trick

import subprocess
subprocess.run('path/to/shortcut', 'path/to/file.mp4')
2 Likes

Thanks dude.

This topic was automatically closed after 90 days. New replies are no longer allowed.