28 #include "../include/ReaderBase.h" 65 cout << fixed << setprecision(2) << boolalpha;
66 cout <<
"----------------------------" << endl;
67 cout <<
"----- File Information -----" << endl;
68 cout <<
"----------------------------" << endl;
72 cout <<
"--> Duration: " <<
info.
duration <<
" Seconds" << endl;
73 cout <<
"--> File Size: " << double(
info.
file_size) / 1024 / 1024 <<
" MB" << endl;
74 cout <<
"----------------------------" << endl;
75 cout <<
"----- Video Attributes -----" << endl;
76 cout <<
"----------------------------" << endl;
77 cout <<
"--> Width: " <<
info.
width << endl;
84 cout <<
"--> Video Codec: " <<
info.
vcodec << endl;
90 cout <<
"----------------------------" << endl;
91 cout <<
"----- Audio Attributes -----" << endl;
92 cout <<
"----------------------------" << endl;
93 cout <<
"--> Audio Codec: " <<
info.
acodec << endl;
100 cout <<
"----------------------------" << endl;
112 stringstream filesize_stream;
114 root[
"file_size"] = filesize_stream.str();
118 root[
"fps"] = Json::Value(Json::objectValue);
122 root[
"pixel_ratio"] = Json::Value(Json::objectValue);
125 root[
"display_ratio"] = Json::Value(Json::objectValue);
129 stringstream video_length_stream;
131 root[
"video_length"] = video_length_stream.str();
133 root[
"video_timebase"] = Json::Value(Json::objectValue);
144 root[
"audio_timebase"] = Json::Value(Json::objectValue);
156 if (!root[
"has_video"].isNull())
158 if (!root[
"has_audio"].isNull())
160 if (!root[
"has_single_image"].isNull())
162 if (!root[
"duration"].isNull())
164 if (!root[
"file_size"].isNull())
165 info.
file_size = atoll(root[
"file_size"].asString().c_str());
166 if (!root[
"height"].isNull())
168 if (!root[
"width"].isNull())
170 if (!root[
"pixel_format"].isNull())
172 if (!root[
"fps"].isNull() && root[
"fps"].isObject()) {
173 if (!root[
"fps"][
"num"].isNull())
175 if (!root[
"fps"][
"den"].isNull())
178 if (!root[
"video_bit_rate"].isNull())
180 if (!root[
"pixel_ratio"].isNull() && root[
"pixel_ratio"].isObject()) {
181 if (!root[
"pixel_ratio"][
"num"].isNull())
183 if (!root[
"pixel_ratio"][
"den"].isNull())
186 if (!root[
"display_ratio"].isNull() && root[
"display_ratio"].isObject()) {
187 if (!root[
"display_ratio"][
"num"].isNull())
189 if (!root[
"display_ratio"][
"den"].isNull())
192 if (!root[
"vcodec"].isNull())
194 if (!root[
"video_length"].isNull())
196 if (!root[
"video_stream_index"].isNull())
198 if (!root[
"video_timebase"].isNull() && root[
"video_timebase"].isObject()) {
199 if (!root[
"video_timebase"][
"num"].isNull())
201 if (!root[
"video_timebase"][
"den"].isNull())
204 if (!root[
"interlaced_frame"].isNull())
206 if (!root[
"top_field_first"].isNull())
208 if (!root[
"acodec"].isNull())
211 if (!root[
"audio_bit_rate"].isNull())
213 if (!root[
"sample_rate"].isNull())
215 if (!root[
"channels"].isNull())
217 if (!root[
"channel_layout"].isNull())
219 if (!root[
"audio_stream_index"].isNull())
221 if (!root[
"audio_timebase"].isNull() && root[
"audio_timebase"].isObject()) {
222 if (!root[
"audio_timebase"][
"num"].isNull())
224 if (!root[
"audio_timebase"][
"den"].isNull())
233 QGraphicsScene *scene =
reinterpret_cast<QGraphicsScene*
>(_graphics_scene_address);
234 QGraphicsPixmapItem *item =
new QGraphicsPixmapItem(QPixmap(QString(path.c_str())));
235 scene->addItem(item);
long long file_size
Size of file (in bytes)
int num
Numerator for the fraction.
void DrawFrameOnScene(string path, long _graphics_scene_address)
Test method to draw a bitmap on a Qt QGraphicsScene.
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) ...
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.
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.
long int video_length
The number of frames in the video stream.
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)