2013-09-12 23:41:49 -05:00
|
|
|
/**
|
|
|
|
|
* @file
|
2015-02-07 16:48:43 -06:00
|
|
|
* @brief Source file for Example Executable (example app for libopenshot)
|
2013-09-12 23:41:49 -05:00
|
|
|
* @author Jonathan Thomas <jonathan@openshot.org>
|
|
|
|
|
*
|
|
|
|
|
* @section LICENSE
|
|
|
|
|
*
|
2014-03-29 18:49:22 -05:00
|
|
|
* Copyright (c) 2008-2014 OpenShot Studios, LLC
|
|
|
|
|
* <http://www.openshotstudios.com/>. This file is part of
|
|
|
|
|
* OpenShot Library (libopenshot), an open-source project dedicated to
|
|
|
|
|
* delivering high quality video editing and animation solutions to the
|
|
|
|
|
* world. For more information visit <http://www.openshot.org/>.
|
2013-09-12 23:41:49 -05:00
|
|
|
*
|
2014-03-29 18:49:22 -05:00
|
|
|
* OpenShot Library (libopenshot) is free software: you can redistribute it
|
2014-07-11 16:52:14 -05:00
|
|
|
* and/or modify it under the terms of the GNU Lesser General Public License
|
2014-03-29 18:49:22 -05:00
|
|
|
* as published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
2013-09-12 23:41:49 -05:00
|
|
|
*
|
2014-03-29 18:49:22 -05:00
|
|
|
* OpenShot Library (libopenshot) is distributed in the hope that it will be
|
|
|
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2014-07-11 16:52:14 -05:00
|
|
|
* GNU Lesser General Public License for more details.
|
2013-09-12 23:41:49 -05:00
|
|
|
*
|
2014-07-11 16:52:14 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2014-03-29 18:49:22 -05:00
|
|
|
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
2013-09-12 23:41:49 -05:00
|
|
|
*/
|
2011-10-11 08:44:27 -05:00
|
|
|
|
2012-07-19 15:03:55 -05:00
|
|
|
#include <fstream>
|
2011-10-11 08:44:27 -05:00
|
|
|
#include <iostream>
|
2012-10-14 03:43:52 -05:00
|
|
|
#include <tr1/memory>
|
2015-02-07 16:48:43 -06:00
|
|
|
#include "../../include/OpenShot.h"
|
2013-11-17 15:12:08 -06:00
|
|
|
|
2011-10-11 08:44:27 -05:00
|
|
|
using namespace openshot;
|
2012-10-14 03:43:52 -05:00
|
|
|
using namespace tr1;
|
2011-10-11 08:44:27 -05:00
|
|
|
|
2015-06-01 00:20:14 -07:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
|
FFmpegReader rTest("/home/jonathan/Videos/sintel_trailer-720p.mp4");
|
|
|
|
|
rTest.Open();
|
2016-02-23 00:27:03 -06:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
/* WRITER ---------------- */
|
|
|
|
|
FFmpegWriter w("/home/jonathan/output%05d.jpg");
|
2016-02-23 00:27:03 -06:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
// Set options
|
|
|
|
|
w.SetVideoOptions(true, "mjpeg", Fraction(24, 1), 1280, 720, Fraction(1, 1), false, false, 3000000);
|
2016-02-23 00:27:03 -06:00
|
|
|
|
2015-09-28 22:05:50 -05:00
|
|
|
// w.SetOption(VIDEO_STREAM, "qmin", "2" );
|
|
|
|
|
// w.SetOption(VIDEO_STREAM, "qmax", "30" );
|
|
|
|
|
// w.SetOption(VIDEO_STREAM, "crf", "10" );
|
|
|
|
|
// w.SetOption(VIDEO_STREAM, "rc_min_rate", "2000000" );
|
|
|
|
|
// w.SetOption(VIDEO_STREAM, "rc_max_rate", "4000000" );
|
2017-08-01 01:19:07 -05:00
|
|
|
// w.SetOption(VIDEO_STREAM, "max_b_frames", "0" );
|
|
|
|
|
// w.SetOption(VIDEO_STREAM, "b_frames", "0" );
|
2015-09-28 22:05:50 -05:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
// Open writer
|
|
|
|
|
w.Open();
|
2015-09-28 22:05:50 -05:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
// Prepare Streams
|
|
|
|
|
w.PrepareStreams();
|
2015-06-01 00:20:14 -07:00
|
|
|
|
2015-02-19 01:03:22 -06:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
// Write header
|
|
|
|
|
w.WriteHeader();
|
2015-02-05 00:06:07 -06:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
// Write some frames
|
|
|
|
|
w.WriteFrame(&rTest, 500, 505);
|
2015-02-05 00:06:07 -06:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
// Close writer & reader
|
|
|
|
|
w.Close();
|
|
|
|
|
rTest.Close();
|
2015-02-05 00:06:07 -06:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
return 0;
|
|
|
|
|
}
|