You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Added an example, trying write a timeline to the FFmpegWriter. Not quite working yet though.
This commit is contained in:
70
src/Main.cpp
70
src/Main.cpp
@@ -15,18 +15,52 @@ void FrameReady(int number)
|
||||
int main()
|
||||
{
|
||||
// Create timeline
|
||||
Framerate fps(30000,1000);
|
||||
Timeline t(640, 480, fps);
|
||||
Framerate fps(24,1);
|
||||
Timeline t(640, 360, fps);
|
||||
|
||||
// Add some clips
|
||||
Clip c1("../../src/examples/test.mp4");
|
||||
c1.Layer(2);
|
||||
Clip c1("/home/jonathan/Videos/sintel-1024-stereo.mp4");
|
||||
c1.Position(0.0);
|
||||
c1.rotation.AddPoint(60, 360);
|
||||
//c1.time.AddPoint(800, 300);
|
||||
//c1.time.AddPoint(1600, 1);
|
||||
|
||||
// Add clips
|
||||
t.AddClip(&c1);
|
||||
|
||||
|
||||
// Create a writer
|
||||
FFmpegWriter w("/home/jonathan/output.webm");
|
||||
w.DisplayInfo();
|
||||
|
||||
// Set options
|
||||
w.SetAudioOptions(true, "libvorbis", 44100, 2, 128000, false);
|
||||
w.SetVideoOptions(true, "libvpx", Fraction(24, 1), 640, 360, Fraction(1,1), false, false, 2000000);
|
||||
|
||||
// Prepare Streams
|
||||
w.PrepareStreams();
|
||||
|
||||
// Write header
|
||||
w.WriteHeader();
|
||||
|
||||
// Output stream info
|
||||
w.OutputStreamInfo();
|
||||
|
||||
for (int frame = 1; frame <= 1600; frame++)
|
||||
{
|
||||
Frame *f = t.GetFrame(frame);
|
||||
|
||||
// Write frame
|
||||
cout << "queue frame " << frame << endl;
|
||||
w.WriteFrame(f);
|
||||
}
|
||||
|
||||
// Write Footer
|
||||
w.WriteTrailer();
|
||||
|
||||
// Close writer & reader
|
||||
w.Close();
|
||||
|
||||
|
||||
// Request frames
|
||||
for (int x=1; x<=100; x++)
|
||||
t.GetFrame(x);
|
||||
@@ -39,6 +73,32 @@ int main()
|
||||
|
||||
|
||||
|
||||
|
||||
// Create timeline
|
||||
// Framerate fps(30000,1000);
|
||||
// Timeline t(640, 480, fps);
|
||||
//
|
||||
// // Add some clips
|
||||
// Clip c1("../../src/examples/test.mp4");
|
||||
// c1.Layer(2);
|
||||
// c1.Position(0.0);
|
||||
// c1.rotation.AddPoint(60, 360);
|
||||
//
|
||||
// // Add clips
|
||||
// t.AddClip(&c1);
|
||||
//
|
||||
// // Request frames
|
||||
// for (int x=1; x<=100; x++)
|
||||
// t.GetFrame(x);
|
||||
//
|
||||
// // Close timeline
|
||||
// t.Close();
|
||||
//
|
||||
// cout << "Successfully Finished Timeline DEMO" << endl;
|
||||
// return 0;
|
||||
|
||||
|
||||
|
||||
//openshot::ImageReader i("/home/jonathan/Apps/videcho_site/media/logos/watermark3.png");
|
||||
//openshot::Frame* overlay = i.GetFrame(1);
|
||||
//i.DisplayInfo();
|
||||
|
||||
Reference in New Issue
Block a user