|
OpenShot Library | libopenshot
0.5.0
|
Go to the documentation of this file.
93 *out << std::fixed << std::setprecision(2) << std::boolalpha;
94 *out <<
"----------------------------" << std::endl;
95 *out <<
"----- File Information -----" << std::endl;
96 *out <<
"----------------------------" << std::endl;
100 *out <<
"--> Duration: " <<
info.
duration <<
" Seconds" << std::endl;
101 *out <<
"--> File Size: " << double(
info.
file_size) / 1024 / 1024 <<
" MB" << std::endl;
102 *out <<
"----------------------------" << std::endl;
103 *out <<
"----- Video Attributes -----" << std::endl;
104 *out <<
"----------------------------" << std::endl;
105 *out <<
"--> Width: " <<
info.
width << std::endl;
106 *out <<
"--> Height: " <<
info.
height << std::endl;
112 *out <<
"--> Video Codec: " <<
info.
vcodec << std::endl;
113 *out <<
"--> Video Length: " <<
info.
video_length <<
" Frames" << std::endl;
118 *out <<
"----------------------------" << std::endl;
119 *out <<
"----- Audio Attributes -----" << std::endl;
120 *out <<
"----------------------------" << std::endl;
121 *out <<
"--> Audio Codec: " <<
info.
acodec << std::endl;
124 *out <<
"--> # of Channels: " <<
info.
channels << std::endl;
128 *out <<
"----------------------------" << std::endl;
147 std::stringstream filesize_stream;
149 root[
"file_size"] = filesize_stream.str();
153 root[
"fps"] = Json::Value(Json::objectValue);
157 root[
"pixel_ratio"] = Json::Value(Json::objectValue);
160 root[
"display_ratio"] = Json::Value(Json::objectValue);
164 std::stringstream video_length_stream;
166 root[
"video_length"] = video_length_stream.str();
168 root[
"video_timebase"] = Json::Value(Json::objectValue);
179 root[
"audio_timebase"] = Json::Value(Json::objectValue);
197 catch (
const std::exception& e)
200 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
208 if (!root[
"has_video"].isNull())
210 if (!root[
"has_audio"].isNull())
212 if (!root[
"has_single_image"].isNull())
214 if (!root[
"duration"].isNull())
216 if (!root[
"file_size"].isNull())
218 if (!root[
"height"].isNull())
220 if (!root[
"width"].isNull())
222 if (!root[
"pixel_format"].isNull())
224 if (!root[
"fps"].isNull() && root[
"fps"].isObject()) {
225 if (!root[
"fps"][
"num"].isNull())
227 if (!root[
"fps"][
"den"].isNull())
230 if (!root[
"video_bit_rate"].isNull())
232 if (!root[
"pixel_ratio"].isNull() && root[
"pixel_ratio"].isObject()) {
233 if (!root[
"pixel_ratio"][
"num"].isNull())
235 if (!root[
"pixel_ratio"][
"den"].isNull())
238 if (!root[
"display_ratio"].isNull() && root[
"display_ratio"].isObject()) {
239 if (!root[
"display_ratio"][
"num"].isNull())
241 if (!root[
"display_ratio"][
"den"].isNull())
244 if (!root[
"vcodec"].isNull())
246 if (!root[
"video_length"].isNull())
248 if (!root[
"video_stream_index"].isNull())
250 if (!root[
"video_timebase"].isNull() && root[
"video_timebase"].isObject()) {
251 if (!root[
"video_timebase"][
"num"].isNull())
253 if (!root[
"video_timebase"][
"den"].isNull())
256 if (!root[
"interlaced_frame"].isNull())
258 if (!root[
"top_field_first"].isNull())
260 if (!root[
"acodec"].isNull())
263 if (!root[
"audio_bit_rate"].isNull())
265 if (!root[
"sample_rate"].isNull())
267 if (!root[
"channels"].isNull())
269 if (!root[
"channel_layout"].isNull())
271 if (!root[
"audio_stream_index"].isNull())
273 if (!root[
"audio_timebase"].isNull() && root[
"audio_timebase"].isObject()) {
274 if (!root[
"audio_timebase"][
"num"].isNull())
276 if (!root[
"audio_timebase"][
"den"].isNull())
const Json::Value stringToJson(const std::string value)
bool has_single_image
Determines if this file only contains a single image.
int sample_rate
The number of audio samples per second (44100 is a common sample rate)
int64_t video_length
The number of frames in the video stream.
int video_bit_rate
The bit rate of the video stream (in bytes)
Header file for WriterBase class.
openshot::Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
Json::Value JsonValue() const
Generate Json::Value for this object.
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.
int audio_bit_rate
The bit rate of the audio stream (in bytes)
int channels
The number of audio channels used in the audio stream.
This class represents a fraction.
openshot::ReaderInfo info
Information about the current media file.
int audio_bit_rate
The bit rate of the audio stream (in bytes)
int video_stream_index
The index of the video stream.
float duration
Length of time (in seconds)
bool has_video
Determines if this file has a video stream.
std::string Json() const
Generate JSON string of this object.
int width
The width of the video (in pixesl)
int width
The width of the video (in pixels)
double ToDouble() const
Return this fraction as a double (i.e. 1/2 = 0.5)
std::string acodec
The name of the audio codec used to encode / decode the video stream.
openshot::Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
int64_t video_length
The number of frames in the video stream.
int height
The height of the video (in pixels)
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.
bool top_field_first
Which interlaced field should be displayed first.
int64_t file_size
Size of file (in bytes)
int den
Denominator for the fraction.
float duration
Length of time (in seconds)
bool has_audio
Determines if this file has an audio stream.
Exception for invalid JSON.
int64_t file_size
Size of file (in bytes)
openshot::ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
bool has_single_image
Determines if this file only contains a single image.
openshot::Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
openshot::Fraction audio_timebase
The audio timebase determines how long each audio packet should be played.
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
Header file for Frame class.
int audio_stream_index
The index of the audio stream.
openshot::Fraction audio_timebase
The audio timebase determines how long each audio packet should be played.
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
bool has_video
Determines if this file has a video stream.
std::string vcodec
The name of the video codec used to encode / decode the video stream.
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)
openshot::ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
void CopyReaderInfo(openshot::ReaderBase *reader)
This method copy's the info struct of a reader, and sets the writer with the same info.
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
int video_bit_rate
The bit rate of the video stream (in bytes)
This abstract class is the base class, used by all readers in libopenshot.
bool interlaced_frame
Are the contents of this frame interlaced.
std::string vcodec
The name of the video codec used to encode / decode the video stream.
int sample_rate
The number of audio samples per second (44100 is a common sample rate)
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround,...
openshot::Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
int video_stream_index
The index of the video stream.
int audio_stream_index
The index of the audio stream.
std::string acodec
The name of the audio codec used to encode / decode the video stream.
WriterInfo info
Information about the current media file.
openshot::Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
int channels
The number of audio channels used in the audio stream.
void SetJson(const std::string value)
Load JSON string into this object.
void DisplayInfo(std::ostream *out=&std::cout)
Display file information in the standard output stream (stdout)
Header file for all Exception classes.
WriterBase()
Constructor for WriterBase class, many things are initialized here.