28 #include "../include/ReaderBase.h" 67 cout << fixed << setprecision(2) << boolalpha;
68 cout <<
"----------------------------" << endl;
69 cout <<
"----- File Information -----" << endl;
70 cout <<
"----------------------------" << endl;
74 cout <<
"--> Duration: " <<
info.
duration <<
" Seconds" << endl;
75 cout <<
"--> File Size: " << double(
info.
file_size) / 1024 / 1024 <<
" MB" << endl;
76 cout <<
"----------------------------" << endl;
77 cout <<
"----- Video Attributes -----" << endl;
78 cout <<
"----------------------------" << endl;
79 cout <<
"--> Width: " <<
info.
width << endl;
86 cout <<
"--> Video Codec: " <<
info.
vcodec << endl;
92 cout <<
"----------------------------" << endl;
93 cout <<
"----- Audio Attributes -----" << endl;
94 cout <<
"----------------------------" << endl;
95 cout <<
"--> Audio Codec: " <<
info.
acodec << endl;
102 cout <<
"----------------------------" << endl;
114 stringstream filesize_stream;
116 root[
"file_size"] = filesize_stream.str();
120 root[
"fps"] = Json::Value(Json::objectValue);
124 root[
"pixel_ratio"] = Json::Value(Json::objectValue);
127 root[
"display_ratio"] = Json::Value(Json::objectValue);
131 stringstream video_length_stream;
133 root[
"video_length"] = video_length_stream.str();
135 root[
"video_timebase"] = Json::Value(Json::objectValue);
146 root[
"audio_timebase"] = Json::Value(Json::objectValue);
158 if (!root[
"has_video"].isNull())
160 if (!root[
"has_audio"].isNull())
162 if (!root[
"has_single_image"].isNull())
164 if (!root[
"duration"].isNull())
166 if (!root[
"file_size"].isNull())
167 info.
file_size = atoll(root[
"file_size"].asString().c_str());
168 if (!root[
"height"].isNull())
170 if (!root[
"width"].isNull())
172 if (!root[
"pixel_format"].isNull())
174 if (!root[
"fps"].isNull() && root[
"fps"].isObject()) {
175 if (!root[
"fps"][
"num"].isNull())
177 if (!root[
"fps"][
"den"].isNull())
180 if (!root[
"video_bit_rate"].isNull())
182 if (!root[
"pixel_ratio"].isNull() && root[
"pixel_ratio"].isObject()) {
183 if (!root[
"pixel_ratio"][
"num"].isNull())
185 if (!root[
"pixel_ratio"][
"den"].isNull())
188 if (!root[
"display_ratio"].isNull() && root[
"display_ratio"].isObject()) {
189 if (!root[
"display_ratio"][
"num"].isNull())
191 if (!root[
"display_ratio"][
"den"].isNull())
194 if (!root[
"vcodec"].isNull())
196 if (!root[
"video_length"].isNull())
198 if (!root[
"video_stream_index"].isNull())
200 if (!root[
"video_timebase"].isNull() && root[
"video_timebase"].isObject()) {
201 if (!root[
"video_timebase"][
"num"].isNull())
203 if (!root[
"video_timebase"][
"den"].isNull())
206 if (!root[
"interlaced_frame"].isNull())
208 if (!root[
"top_field_first"].isNull())
210 if (!root[
"acodec"].isNull())
213 if (!root[
"audio_bit_rate"].isNull())
215 if (!root[
"sample_rate"].isNull())
217 if (!root[
"channels"].isNull())
219 if (!root[
"channel_layout"].isNull())
221 if (!root[
"audio_stream_index"].isNull())
223 if (!root[
"audio_timebase"].isNull() && root[
"audio_timebase"].isObject()) {
224 if (!root[
"audio_timebase"][
"num"].isNull())
226 if (!root[
"audio_timebase"][
"den"].isNull())
int max_height
The maximium image height needed by this clip (used for optimizations)
int num
Numerator for the fraction.
ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
int width
The width of the video (in pixesl)
ReaderBase()
Constructor for the base reader, where many things are initialized.
float duration
Length of time (in seconds)
string acodec
The name of the audio codec used to encode / decode the video stream.
bool has_video
Determines if this file has a video stream.
Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3) ...
int64_t file_size
Size of file (in bytes)
int audio_bit_rate
The bit rate of the audio stream (in bytes)
bool has_audio
Determines if this file has an audio stream.
int audio_stream_index
The index of the audio stream.
int64_t video_length
The number of frames in the video stream.
int height
The height of the video (in pixels)
This class represents a fraction.
bool has_single_image
Determines if this file only contains a single image.
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround...
virtual Json::Value JsonValue()=0
Generate Json::JsonValue for this object.
virtual void SetJsonValue(Json::Value root)=0
Load Json::JsonValue into this object.
ReaderInfo info
Information about the current media file.
Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square) ...
This namespace is the default namespace for all code in the openshot library.
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
int video_bit_rate
The bit rate of the video stream (in bytes)
Fraction audio_timebase
The audio timebase determines how long each audio packet should be played.
string vcodec
The name of the video codec used to encode / decode the video stream.
void DisplayInfo()
Display file information in the standard output stream (stdout)
int den
Denominator for the fraction.
int channels
The number of audio channels used in the audio stream.
int video_stream_index
The index of the video stream.
int max_width
The maximum image width needed by this clip (used for optimizations)
double ToDouble()
Return this fraction as a double (i.e. 1/2 = 0.5)
int sample_rate
The number of audio samples per second (44100 is a common sample rate)