12345678910111213141516171819202122232425262728 |
- 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("./tt.jpg")
- clip = openshot.Clip(text_title)
- t.AddClip(clip)
- w = video_writer_init("./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()
|