64 *out << std::fixed << std::setprecision(2) << std::boolalpha;
65 *out <<
"----------------------------" << std::endl;
66 *out <<
"----- File Information -----" << std::endl;
67 *out <<
"----------------------------" << std::endl;
71 *out <<
"--> Duration: " <<
info.
duration <<
" Seconds" << std::endl;
72 *out <<
"--> File Size: " << double(
info.
file_size) / 1024 / 1024 <<
" MB" << std::endl;
73 *out <<
"----------------------------" << std::endl;
74 *out <<
"----- Video Attributes -----" << std::endl;
75 *out <<
"----------------------------" << std::endl;
76 *out <<
"--> Width: " <<
info.
width << std::endl;
77 *out <<
"--> Height: " <<
info.
height << std::endl;
83 *out <<
"--> Video Codec: " <<
info.
vcodec << std::endl;
89 *out <<
"----------------------------" << std::endl;
90 *out <<
"----- Audio Attributes -----" << std::endl;
91 *out <<
"----------------------------" << std::endl;
92 *out <<
"--> Audio Codec: " <<
info.
acodec << std::endl;
95 *out <<
"--> # of Channels: " <<
info.
channels << std::endl;
99 *out <<
"----------------------------" << std::endl;
100 *out <<
"--------- Metadata ---------" << std::endl;
101 *out <<
"----------------------------" << std::endl;
105 *out <<
"--> " << it.first <<
": " << it.second << std::endl;
117 root[
"file_size"] =
static_cast<Json::Value::Int64
>(
info.
file_size);
121 root[
"fps"] = Json::Value(Json::objectValue);
125 root[
"pixel_ratio"] = Json::Value(Json::objectValue);
128 root[
"display_ratio"] = Json::Value(Json::objectValue);
134 root[
"video_timebase"] = Json::Value(Json::objectValue);
145 root[
"audio_timebase"] = Json::Value(Json::objectValue);
150 root[
"metadata"] = Json::Value(Json::objectValue);
153 root[
"metadata"][it.first] = it.second;
163 if (!root[
"has_video"].isNull())
165 if (!root[
"has_audio"].isNull())
167 if (!root[
"has_single_image"].isNull())
169 if (!root[
"duration"].isNull())
171 if (!root[
"file_size"].isNull())
173 if (!root[
"height"].isNull())
175 if (!root[
"width"].isNull())
177 if (!root[
"pixel_format"].isNull())
179 if (!root[
"fps"].isNull() && root[
"fps"].isObject()) {
180 if (!root[
"fps"][
"num"].isNull())
182 if (!root[
"fps"][
"den"].isNull())
185 if (!root[
"video_bit_rate"].isNull())
187 if (!root[
"pixel_ratio"].isNull() && root[
"pixel_ratio"].isObject()) {
188 if (!root[
"pixel_ratio"][
"num"].isNull())
190 if (!root[
"pixel_ratio"][
"den"].isNull())
193 if (!root[
"display_ratio"].isNull() && root[
"display_ratio"].isObject()) {
194 if (!root[
"display_ratio"][
"num"].isNull())
196 if (!root[
"display_ratio"][
"den"].isNull())
199 if (!root[
"vcodec"].isNull())
201 if (!root[
"video_length"].isNull())
203 if (!root[
"video_stream_index"].isNull())
205 if (!root[
"video_timebase"].isNull() && root[
"video_timebase"].isObject()) {
206 if (!root[
"video_timebase"][
"num"].isNull())
208 if (!root[
"video_timebase"][
"den"].isNull())
211 if (!root[
"interlaced_frame"].isNull())
213 if (!root[
"top_field_first"].isNull())
215 if (!root[
"acodec"].isNull())
218 if (!root[
"audio_bit_rate"].isNull())
220 if (!root[
"sample_rate"].isNull())
222 if (!root[
"channels"].isNull())
224 if (!root[
"channel_layout"].isNull())
226 if (!root[
"audio_stream_index"].isNull())
228 if (!root[
"audio_timebase"].isNull() && root[
"audio_timebase"].isObject()) {
229 if (!root[
"audio_timebase"][
"num"].isNull())
231 if (!root[
"audio_timebase"][
"den"].isNull())
234 if (!root[
"metadata"].isNull() && root[
"metadata"].isObject()) {
235 for( Json::Value::const_iterator itr = root[
"metadata"].begin() ; itr != root[
"metadata"].end() ; itr++ ) {
236 std::string key = itr.key().asString();
Header file for ClipBase class.
Header file for Frame class.
Header file for JSON class.
Header file for ReaderBase class.
This abstract class is the base class, used by all clips in libopenshot.
This class represents a fraction.
int num
Numerator for the fraction.
double ToDouble() const
Return this fraction as a double (i.e. 1/2 = 0.5)
int den
Denominator for the fraction.
int max_decode_height
Optional maximum decoded frame height (0 disables the limit)
openshot::ReaderInfo info
Information about the current media file.
void SetMaxDecodeSize(int width, int height)
Set an optional maximum decoded frame size. Use 0,0 to disable the limit.
int max_decode_width
Optional maximum decoded frame width (0 disables the limit)
int MaxDecodeWidth() const
Return the current maximum decoded frame width (0 when unlimited).
virtual void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
virtual Json::Value JsonValue() const =0
Generate Json::Value for this object.
int MaxDecodeHeight() const
Return the current maximum decoded frame height (0 when unlimited).
void DisplayInfo(std::ostream *out=&std::cout)
Display file information in the standard output stream (stdout)
bool HasMaxDecodeSize() const
Return true when a maximum decoded frame size is active.
openshot::ClipBase * clip
Pointer to the parent clip instance (if any)
openshot::ClipBase * ParentClip()
Parent clip object of this reader (which can be unparented and NULL)
ReaderBase()
Constructor for the base reader, where many things are initialized.
This namespace is the default namespace for all code in the openshot library.
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround,...
int audio_bit_rate
The bit rate of the audio stream (in bytes)
int video_bit_rate
The bit rate of the video stream (in bytes)
bool has_single_image
Determines if this file only contains a single image.
float duration
Length of time (in seconds)
openshot::Fraction audio_timebase
The audio timebase determines how long each audio packet should be played.
int width
The width of the video (in pixesl)
int channels
The number of audio channels used in the audio stream.
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
openshot::Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
int height
The height of the video (in pixels)
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
int64_t video_length
The number of frames in the video stream.
std::string acodec
The name of the audio codec used to encode / decode the video stream.
std::map< std::string, std::string > metadata
An optional map/dictionary of metadata for this reader.
std::string vcodec
The name of the video codec used to encode / decode the video stream.
openshot::Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
openshot::ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
bool has_video
Determines if this file has a video stream.
bool has_audio
Determines if this file has an audio stream.
openshot::Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
int video_stream_index
The index of the video stream.
int sample_rate
The number of audio samples per second (44100 is a common sample rate)
int audio_stream_index
The index of the audio stream.
int64_t file_size
Size of file (in bytes)