OpenShot Library | libopenshot
0.3.3
|
Go to the documentation of this file.
14 #ifdef USE_IMAGEMAGICK
28 path(
path), cache_size(8), write_video_count(0), image_quality(75), number_of_loops(1),
29 combine_frames(true), is_open(false)
37 std::string format,
Fraction fps,
int width,
int height,
38 int quality,
int loops,
bool combine)
44 image_quality = quality;
45 number_of_loops = loops;
46 combine_frames = combine;
69 "ImageWriter::SetVideoOptions (" + format +
")",
90 "The ImageWriter is closed. "
91 "Call Open() before calling this method.", path);
95 auto qimage = frame->GetImage();
98 frame_image->backgroundColor(Magick::Color(
"none"));
100 frame_image->quality(image_quality);
102 frame_image->animationIterations(number_of_loops);
105 int new_height =
info.
height * frame->GetPixelRatio().Reciprocal().ToDouble();
108 Magick::Geometry new_size(
info.
width, new_height);
109 new_size.aspect(
true);
110 frame_image->resize(new_size);
114 frames.push_back(*frame_image.get());
124 "ImageWriter::WriteFrame (from Reader)",
129 for (int64_t number = start; number <= length; number++)
132 std::shared_ptr<Frame> f = reader->
GetFrame(number);
143 Magick::writeImages(frames.begin(), frames.end(), path, combine_frames);
147 write_video_count = 0;
153 #endif //USE_IMAGEMAGICK
float ToFloat()
Return this fraction as a float (i.e. 1/2 = 0.5)
int video_bit_rate
The bit rate of the video stream (in bytes)
openshot::Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
Exception when a writer is closed, and a frame is requested.
virtual std::shared_ptr< openshot::Frame > GetFrame(int64_t number)=0
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
This namespace is the default namespace for all code in the openshot library.
This class represents a fraction.
void WriteFrame(std::shared_ptr< Frame > frame)
Add a frame to the stack waiting to be encoded.
Header file for QtUtilities (compatibiity overlay)
int width
The width of the video (in pixels)
openshot::Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
openshot::Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
int num
Numerator for the fraction.
Header file for ZeroMQ-based Logger class.
int den
Denominator for the fraction.
void Reduce()
Reduce this fraction (i.e. 640/480 = 4/3)
Fraction Reciprocal() const
Return the reciprocal as a Fraction.
std::shared_ptr< Magick::Image > QImage2Magick(std::shared_ptr< QImage >)
Convert QImage to Magick::Image.
Header file for Frame class.
static ZmqLogger * Instance()
Create or get an instance of this logger singleton (invoke the class with this method)
#define MAGICK_IMAGE_ALPHA(im, a)
void AppendDebugMethod(std::string method_name, std::string arg1_name="", float arg1_value=-1.0, std::string arg2_name="", float arg2_value=-1.0, std::string arg3_name="", float arg3_value=-1.0, std::string arg4_name="", float arg4_value=-1.0, std::string arg5_name="", float arg5_value=-1.0, std::string arg6_name="", float arg6_value=-1.0)
Append debug information.
bool has_video
Determines if this file has a video stream.
void Close()
Close the writer and encode/output final image to the disk. This is a requirement of ImageMagick,...
bool has_audio
Determines if this file has an audio stream.
Header file for ReaderBase class.
int height
The height of the video (in pixels)
void SetVideoOptions(std::string format, Fraction fps, int width, int height, int quality, int loops, bool combine)
Set the video export options.
Header file for MagickUtilities (IM6/IM7 compatibility overlay)
This abstract class is the base class, used by all readers in libopenshot.
std::string vcodec
The name of the video codec used to encode / decode the video stream.
Header file for ImageWriter class.
WriterInfo info
Information about the current media file.
ImageWriter(std::string path)
Constructor for ImageWriter. Throws one of the following exceptions.
Header file for all Exception classes.