Files
libopenshot/src/Main.cpp

82 lines
2.3 KiB
C++
Raw Normal View History

2011-10-11 08:44:27 -05:00
#include <fstream>
2011-10-11 08:44:27 -05:00
#include <iostream>
#include <map>
#include <queue>
#include "../include/OpenShot.h"
using namespace openshot;
void FrameReady(int number)
{
cout << "Frame #: " << number << " is ready!" << endl;
}
int main()
{
// openshot::FFmpegReader r("../../src/examples/test.mp4");
// openshot::FFmpegReader r("../../src/examples/test1.mp4");
// openshot::FFmpegReader r("../../src/examples/piano.wav");
openshot::FFmpegReader r("/home/jonathan/Videos/sintel-1024-stereo.mp4");
// openshot::FFmpegReader r("/home/jonathan/Videos/00001.mts");
// openshot::FFmpegReader r("/home/jonathan/Videos/sintel_trailer-720p.mp4");
// openshot::FFmpegReader r("/home/jonathan/Aptana Studio Workspace/OpenShotLibrary/src/examples/piano.wav");
// openshot::FFmpegReader r("/home/jonathan/Music/Army of Lovers/Crucified/Army of Lovers - Crucified [Single Version].mp3");
// openshot::FFmpegReader r("/home/jonathan/Documents/OpenShot Art/test.jpeg");
// openshot::FFmpegReader r("/home/jonathan/Videos/60fps.mp4");
2011-10-11 08:44:27 -05:00
// openshot::FFmpegReader r("/home/jonathan/Aptana Studio Workspace/OpenShotLibrary/src/examples/asdf.wdf");
// Display debug info
r.DisplayInfo();
// Create a writer
FFmpegWriter w("/home/jonathan/output.webm");
w.DisplayInfo();
// Set options
w.SetVideoOptions(true, "libvpx", Fraction(24, 1), 640, 360, Fraction(1,1), false, false, 384000);
w.SetAudioOptions(true, "libvorbis", 44100, 2, 128000);
// Prepare Streams
w.PrepareStreams();
// Set Options
2012-08-11 03:39:00 -05:00
//w.SetOption(VIDEO_STREAM, "quality", "good");
w.SetOption(VIDEO_STREAM, "g", "120");
w.SetOption(VIDEO_STREAM, "qmin", "10");
w.SetOption(VIDEO_STREAM, "qmax", "42");
2012-08-11 03:39:00 -05:00
w.SetOption(VIDEO_STREAM, "profile", "0");
w.SetOption(VIDEO_STREAM, "level", "216");
w.SetOption(VIDEO_STREAM, "rc_lookahead", "16");
//w.SetOption(VIDEO_STREAM, "max_b_frames", "2");
//w.SetOption(VIDEO_STREAM, "mb_decision", "2");
// Write header
w.WriteHeader();
// Output stream info
w.OutputStreamInfo();
for (int frame = 1; frame <= 500; frame++)
{
Frame f = r.GetFrame(frame);
// Write frame
cout << "Write frame " << f.number << endl;
w.WriteFrame(&f);
2011-10-25 00:20:26 -05:00
}
// Write Footer
w.WriteTrailer();
2011-10-11 08:44:27 -05:00
// Close writer & reader
w.Close();
2011-10-11 08:44:27 -05:00
r.Close();
cout << "Successfully executed Main.cpp!" << endl;
2011-10-11 08:44:27 -05:00
return 0;
}