|
@@ -0,0 +1,28 @@
|
|
|
+import openshot
|
|
|
+
|
|
|
+def video_writer_init(path):
|
|
|
+ w = openshot.FFmpegWriter(path)
|
|
|
+ w.SetAudioOptions(True, "aac", 44100, 2, openshot.LAYOUT_STEREO, 3000000)
|
|
|
+ w.SetVideoOptions(True, "libx264", openshot.Fraction(30000, 1000), 1280, 720,
|
|
|
+ openshot.Fraction(1, 1), False, False, 3000000)
|
|
|
+ return w
|
|
|
+
|
|
|
+
|
|
|
+t = openshot.Timeline(1280, 720, openshot.Fraction(30000, 1000), 44100, 2, openshot.LAYOUT_STEREO)
|
|
|
+t.Open()
|
|
|
+text_title = openshot.QtImageReader("/app/tt.jpg")
|
|
|
+clip = openshot.Clip(text_title)
|
|
|
+t.AddClip(clip)
|
|
|
+
|
|
|
+w = video_writer_init("/app/test.mp4")
|
|
|
+w.Open()
|
|
|
+
|
|
|
+frames = t.info.fps.ToInt ()*3
|
|
|
+for n in range(frames):
|
|
|
+ f=t.GetFrame(n)
|
|
|
+ w.WriteFrame(f)
|
|
|
+
|
|
|
+t.Close()
|
|
|
+w.Close()
|
|
|
+
|
|
|
+
|