OpenShot Library | libopenshot  0.1.3
Example.cpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Source file for Example Executable (example app for libopenshot)
4  * @author Jonathan Thomas <jonathan@openshot.org>
5  *
6  * @section LICENSE
7  *
8  * Copyright (c) 2008-2014 OpenShot Studios, LLC
9  * <http://www.openshotstudios.com/>. This file is part of
10  * OpenShot Library (libopenshot), an open-source project dedicated to
11  * delivering high quality video editing and animation solutions to the
12  * world. For more information visit <http://www.openshot.org/>.
13  *
14  * OpenShot Library (libopenshot) is free software: you can redistribute it
15  * and/or modify it under the terms of the GNU Lesser General Public License
16  * as published by the Free Software Foundation, either version 3 of the
17  * License, or (at your option) any later version.
18  *
19  * OpenShot Library (libopenshot) is distributed in the hope that it will be
20  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
26  */
27 
28 #include <fstream>
29 #include <iostream>
30 #include <tr1/memory>
31 #include "../../include/OpenShot.h"
32 
33 using namespace openshot;
34 using namespace tr1;
35 
36 
37 int main(int argc, char* argv[])
38 {
39  FFmpegReader rTest("/home/jonathan/Videos/sintel_trailer-720p.mp4");
40  rTest.Open();
41  rTest.GetFrame(300)->Thumbnail("frame1.png", 300, 100, "/home/jonathan/apps/openshot-qt-git/src/images/mask.png", "/home/jonathan/apps/openshot-qt-git/src/images/overlay.png", "#001100", false);
42  rTest.GetFrame(310)->Thumbnail("frame2.png", 100, 300, "/home/jonathan/apps/openshot-qt-git/src/images/mask.png", "/home/jonathan/apps/openshot-qt-git/src/images/overlay.png", "Red", false);
43  rTest.GetFrame(320)->Thumbnail("frame3.png", 50, 100, "/home/jonathan/apps/openshot-qt-git/src/images/mask.png", "/home/jonathan/apps/openshot-qt-git/src/images/overlay.png", "#000000", false);
44  rTest.GetFrame(330)->Thumbnail("frame4.png", 1920, 1080, "/home/jonathan/apps/openshot-qt-git/src/images/mask.png", "/home/jonathan/apps/openshot-qt-git/src/images/overlay.png", "#ffffff", false);
45  return 0;
46 
47 
48 
49 
50  Timeline r9(640, 480, Fraction(30, 1), 44100, 2, LAYOUT_STEREO);
51 
52  int frame_count = 1;
53  while (true) {
54  // Create a timeline
55  Timeline r10(640, 480, Fraction(30, 1), 44100, 2, LAYOUT_STEREO);
56  r10.SetJson("{\"tick_pixels\": 100, \"effects\": [{\"reader\": {\"file_size\": \"1658880\", \"width\": 720, \"video_length\": \"2592000\", \"pixel_format\": -1, \"video_bit_rate\": 0, \"fps\": {\"den\": 1, \"num\": 30}, \"has_single_image\": true, \"channel_layout\": 4, \"audio_stream_index\": -1, \"vcodec\": \"\", \"has_video\": true, \"channels\": 0, \"video_timebase\": {\"den\": 30, \"num\": 1}, \"duration\": 86400.0, \"audio_timebase\": {\"den\": 1, \"num\": 1}, \"path\": \"/Users/jonathan/apps/openshot-qt-git/src/transitions/common/circle_out_to_in.svg\", \"interlaced_frame\": false, \"display_ratio\": {\"den\": 4, \"num\": 5}, \"type\": \"QtImageReader\", \"video_stream_index\": -1, \"acodec\": \"\", \"height\": 576, \"audio_bit_rate\": 0, \"pixel_ratio\": {\"den\": 1, \"num\": 1}, \"has_audio\": false, \"top_field_first\": true, \"sample_rate\": 0}, \"contrast\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1, \"Y\": 3}}]}, \"position\": 0, \"title\": \"Transition\", \"start\": 0, \"layer\": 4, \"type\": \"Mask\", \"replace_image\": false, \"id\": \"Y1SJ85D8HV\", \"brightness\": {\"Points\": [{\"handle_type\": 0, \"interpolation\": 0, \"handle_right\": {\"X\": 96.5999984741211, \"Y\": 1}, \"handle_left\": {\"X\": 1, \"Y\": 1}, \"co\": {\"X\": 1, \"Y\": 1}}, {\"handle_type\": 0, \"interpolation\": 0, \"handle_right\": {\"X\": 240, \"Y\": -1}, \"handle_left\": {\"X\": 144.3999938964844, \"Y\": -1}, \"co\": {\"X\": 1249.92, \"Y\": -1}}]}, \"end\": 52.08}], \"duration\": 300, \"version\": {\"openshot-qt\": \"2.0.5\", \"libopenshot\": \"0.0.9\"}, \"markers\": [], \"export_path\": \"\", \"clips\": [{\"reader\": {\"file_size\": \"7608204\", \"width\": 1280, \"video_length\": \"1253\", \"pixel_format\": 0, \"video_bit_rate\": 1165807, \"fps\": {\"den\": 1, \"num\": 24}, \"has_single_image\": false, \"channel_layout\": 3, \"audio_stream_index\": 1, \"vcodec\": \"h264\", \"has_video\": true, \"channels\": 2, \"video_timebase\": {\"den\": 24, \"num\": 1}, \"duration\": 51.9466667175293, \"audio_timebase\": {\"den\": 48000, \"num\": 1}, \"path\": \"/Users/jonathan/Movies/sintel_trailer-720p.mp4\", \"interlaced_frame\": false, \"display_ratio\": {\"den\": 9, \"num\": 16}, \"type\": \"FFmpegReader\", \"video_stream_index\": 0, \"acodec\": \"aac\", \"height\": 720, \"audio_bit_rate\": 126694, \"pixel_ratio\": {\"den\": 1, \"num\": 1}, \"has_audio\": true, \"top_field_first\": true, \"sample_rate\": 48000}, \"rotation\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"perspective_c2_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"perspective_c2_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"shear_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"shear_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"effects\": [], \"anchor\": 0, \"perspective_c4_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"location_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"location_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"crop_width\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"scale_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 1.0}}]}, \"position\": 0, \"gravity\": 4, \"crop_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"crop_height\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"layer\": 4, \"duration\": 51.9466667175293, \"perspective_c3_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"perspective_c3_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"title\": \"sintel_trailer-720p.mp4\", \"file_id\": \"J6VK47X5IS\", \"perspective_c4_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"perspective_c1_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"perspective_c1_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"time\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"scale_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 1.0}}]}, \"id\": \"QLJJ0D354R\", \"crop_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"image\": \".openshot_qt/thumbnail/J6VK47X5IS.png\", \"alpha\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 1.0}}]}, \"start\": 0, \"scale\": 1, \"waveform\": false, \"wave_color\": {\"red\": {\"Points\": [{\"handle_type\": 0, \"interpolation\": 0, \"handle_left\": {\"X\": 1.0, \"Y\": 0.0}, \"handle_right\": {\"X\": 1.0, \"Y\": 0.0}, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"alpha\": {\"Points\": [{\"handle_type\": 0, \"interpolation\": 0, \"handle_left\": {\"X\": 1.0, \"Y\": 255.0}, \"handle_right\": {\"X\": 1.0, \"Y\": 255.0}, \"co\": {\"X\": 1.0, \"Y\": 255.0}}]}, \"blue\": {\"Points\": [{\"handle_type\": 0, \"interpolation\": 0, \"handle_left\": {\"X\": 1.0, \"Y\": 255.0}, \"handle_right\": {\"X\": 1.0, \"Y\": 255.0}, \"co\": {\"X\": 1.0, \"Y\": 255.0}}]}, \"green\": {\"Points\": [{\"handle_type\": 0, \"interpolation\": 0, \"handle_left\": {\"X\": 1.0, \"Y\": 123.0}, \"handle_right\": {\"X\": 1.0, \"Y\": 123.0}, \"co\": {\"X\": 1.0, \"Y\": 123.0}}]}}, \"volume\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 1.0}}]}, \"end\": 51.9466667175293}], \"settings\": {}, \"fps\": {\"den\": 1, \"num\": 24}, \"id\": \"T0\", \"channel_layout\": 3, \"playhead_position\": 0, \"layers\": [{\"number\": 0, \"y\": 0, \"label\": \"\", \"id\": \"L0\"}, {\"number\": 1, \"y\": 0, \"label\": \"\", \"id\": \"L1\"}, {\"number\": 2, \"y\": 0, \"label\": \"\", \"id\": \"L2\"}, {\"number\": 3, \"y\": 0, \"label\": \"\", \"id\": \"L3\"}, {\"number\": 4, \"y\": 0, \"label\": \"\", \"id\": \"L4\"}], \"height\": 720, \"progress\": [], \"width\": 1280, \"channels\": 2, \"profile\": \"HDV 720 24p\", \"scale\": 16, \"files\": [{\"file_size\": \"7608204\", \"width\": 1280, \"video_length\": \"1253\", \"pixel_format\": 0, \"video_bit_rate\": 1165807, \"fps\": {\"den\": 1, \"num\": 24}, \"has_single_image\": false, \"channel_layout\": 3, \"audio_stream_index\": 1, \"vcodec\": \"h264\", \"has_video\": true, \"channels\": 2, \"video_timebase\": {\"den\": 24, \"num\": 1}, \"duration\": 51.9466667175293, \"audio_timebase\": {\"den\": 48000, \"num\": 1}, \"path\": \"/Users/jonathan/Movies/sintel_trailer-720p.mp4\", \"interlaced_frame\": false, \"media_type\": \"video\", \"display_ratio\": {\"den\": 9, \"num\": 16}, \"type\": \"FFmpegReader\", \"video_stream_index\": 0, \"id\": \"J6VK47X5IS\", \"acodec\": \"aac\", \"height\": 720, \"audio_bit_rate\": 126694, \"pixel_ratio\": {\"den\": 1, \"num\": 1}, \"has_audio\": true, \"top_field_first\": true, \"sample_rate\": 48000}], \"sample_rate\": 44100}");
57 
58  // Open Timeline
59  r10.Open();
60 
61  int frame_number = (rand() % 500) + 1;
62  cout << frame_count << ": reading frame " << frame_number << endl;
63  r10.GetFrame(frame_number);
64 
65  r10.Close();
66 
67  frame_count++;
68 // if (frame_count == 500)
69 // return 0;
70  }
71 
72 
73  cout << " --> 1" << endl;
74  r9.GetFrame(1)->Save("pic1.png", 1.0);
75  cout << " --> 500" << endl;
76  r9.GetFrame(500);
77  cout << "1034" << endl;
78  r9.GetFrame(1034);
79  cout << "1" << endl;
80  r9.GetFrame(1);
81  cout << "1200" << endl;
82  r9.GetFrame(1200)->Save("pic2.png", 1.0);
83 
84 
85  /* WRITER ---------------- */
86  FFmpegWriter w("output1.webm");
87 
88  // Set options
89  w.SetAudioOptions(true, "libvorbis", 44100, 2, LAYOUT_STEREO, 188000);
90  w.SetVideoOptions(true, "libvpx", Fraction(24,1), 1280, 720, Fraction(1,1), false, false, 3000000);
91 
92  // Open writer
93  w.Open();
94 
95  // Prepare Streams
96 // w.PrepareStreams();
97 //
98 // w.SetOption(VIDEO_STREAM, "qmin", "2" );
99 // w.SetOption(VIDEO_STREAM, "qmax", "30" );
100 // w.SetOption(VIDEO_STREAM, "crf", "10" );
101 // w.SetOption(VIDEO_STREAM, "rc_min_rate", "2000000" );
102 // w.SetOption(VIDEO_STREAM, "rc_max_rate", "4000000" );
103 // w.SetOption(VIDEO_STREAM, "max_b_frames", "10" );
104 //
105 // // Write header
106 // w.WriteHeader();
107 
108  // Write some frames
109  w.WriteFrame(&r9, 24, 50);
110 
111  // Close writer & reader
112  w.Close();
113 
114  return 0;
115 //
116 // FFmpegReader r110("/home/jonathan/Videos/PlaysTV/Team Fortress 2/2015_07_06_22_43_16-ses.mp4");
117 // r110.Open();
118 //// r110.DisplayInfo();
119 //// FrameMapper m110(&r110, Fraction(24,1), PULLDOWN_NONE, 48000, 2, LAYOUT_STEREO);
120 //
121 // Timeline t110(1280, 720, Fraction(24,1), 48000, 2, LAYOUT_STEREO);
122 // Clip c110("/home/jonathan/Videos/PlaysTV/Team Fortress 2/2015_07_06_22_43_16-ses.mp4");
123 // c110.Position(1.0);
124 // t110.AddClip(&c110);
125 // t110.Open();
126 //
127 //// m110.GetFrame(100);
128 //// m110.GetFrame(85);
129 //// m110.GetFrame(85);
130 //// m110.GetFrame(86);
131 //// m110.GetFrame(86);
132 //// m110.GetFrame(86);
133 //// m110.GetFrame(86);
134 //// m110.GetFrame(87);
135 //// m110.GetFrame(87);
136 //
137 //
138 // t110.GetFrame(1000);
139 //// r110.GetFrame(96);
140 //// r110.GetFrame(97);
141 //// r110.GetFrame(95);
142 //// r110.GetFrame(98);
143 //// r110.GetFrame(100);
144 //// r110.GetFrame(101);
145 //// r110.GetFrame(103);
146 // return 0;
147 
148 // for (int y = 600; y < 700; y++) {
149 // cout << y << endl;
150 // int random_frame_number = rand() % 1000;
151 // t110.GetFrame(y);
152 // }
153 
154 // srand (time(NULL));
155 // for (int z = 0; z <= 1; z++)
156 // for (int y = 1000; y < 1300; y++) {
157 // cout << " --> " << y << endl;
158 // int random_frame_number = rand() % 1000;
159 // t110.GetFrame(y);
160 // }
161 
162 // FrameMapper m110(&r110, Fraction(24,1), PULLDOWN_NONE, 22050, 2, LAYOUT_STEREO);
163 // m110.Open();
164 //
165 // Clip c110(&m110);
166 // c110.Open();
167 //
168 // Timeline t10(1280, 720, Fraction(24,1), 22050, 2, LAYOUT_STEREO);
169 // //Clip c20("/home/jonathan/Pictures/DSC00660.JPG");
170 // //c20.End(1000.0);
171 // //c20.Layer(-1);
172 // //c20.scale = SCALE_STRETCH;
173 // //c20.rotation.AddPoint(1, 0.0);
174 // //c20.rotation.AddPoint(1000, 360.0);
175 // Clip c10("/home/jonathan/apps/libopenshot/src/examples/piano-mono.wav");
176 // c10.volume.AddPoint(1, 0.0);
177 // c10.volume.AddPoint(100, 1.0);
178 //// c10.time.AddPoint(1, 1);
179 //// c10.time.AddPoint(300, 900);
180 //// c10.time.AddPoint(600, 300);
181 //// c10.time.PrintValues();
182 //
183 // //Color background((unsigned char)0, (unsigned char)255, (unsigned char)0, (unsigned char)0);
184 // //background.red.AddPoint(1000, 255);
185 // //background.green.AddPoint(1000, 0);
186 // //t10.color = background;
187 //
188 // Color black;
189 // black.red = Keyframe(0);
190 // black.green = Keyframe(0);
191 // black.blue = Keyframe(0);
192 //
193 // Keyframe brightness;
194 // brightness.AddPoint(300, -1.0, BEZIER);
195 // brightness.AddPoint(370, 0.5, BEZIER);
196 // brightness.AddPoint(425, -0.5, BEZIER);
197 // brightness.AddPoint(600, 1.0, BEZIER);
198 //
199 // //Negate e;
200 // //Deinterlace e(false);
201 // //ChromaKey e(black, Keyframe(30));
202 // //QtImageReader mask_reader("/home/jonathan/apps/openshot-qt/src/transitions/extra/big_cross_right_barr.png");
203 // //QtImageReader mask_reader1("/home/jonathan/apps/openshot-qt/src/transitions/extra/big_barr.png");
204 // //Mask e(&mask_reader, brightness, Keyframe(3.0));
205 // //c10.AddEffect(&e);
206 // //Mask e1(&mask_reader1, brightness, Keyframe(3.0));
207 // //c10.AddEffect(&e1);
208 //
209 // // add clip to timeline
210 // t10.AddClip(&c10);
211 // //t10.AddClip(&c20);
212 // t10.Open();
213 
214 // FFmpegReader r9("/home/jonathan/Videos/sintel_trailer-720p.mp4");
215 // r9.Open();
216 // r9.DisplayInfo();
217 
218 
219  // Mapper
220  //FrameMapper map(&r9, Fraction(24,1), PULLDOWN_NONE, 48000, 2, LAYOUT_STEREO);
221  //map.DisplayInfo();
222  //map.Open();
223 
224  /* WRITER ---------------- */
225  FFmpegWriter w9("C:\\Users\\Jonathan\\test-output.avi");
226  //ImageWriter w9("/home/jonathan/output.gif");
227 
228  // Set options
229  //w9.SetVideoOptions(true, "mpeg4", r9.info.fps, r9.info.width, r9.info.height, Fraction(1,1), false, false, 1000000);
230  //w9.SetAudioOptions(true, "mp2", r9.info.sample_rate, r9.info.channels, r9.info.channel_layout, 64000);
231  w9.SetVideoOptions(true, "libx264", r9.info.fps, r9.info.width, r9.info.height, Fraction(1,1), false, false, 1000000);
232  w9.SetAudioOptions(true, "mp2", r9.info.sample_rate, r9.info.channels, r9.info.channel_layout, 64000);
233  //w9.SetAudioOptions(true, "libvorbis", r9.info.sample_rate, r9.info.channels, r9.info.channel_layout, 128000);
234  //w9.SetVideoOptions(true, "libvpx", r9.info.fps, r9.info.width, r9.info.height, Fraction(1,1), false, false, 3000000);
235  //w9.SetAudioOptions(true, "libmp3lame", 22050, r9.info.channels, r9.info.channel_layout, 120000);
236  //w9.SetVideoOptions(true, "libx264", t10.info.fps, t10.info.width, t10.info.height, t10.info.pixel_ratio, false, false, 1500000);
237  //w9.SetVideoOptions(true, "rawvideo", r9.info.fps, 400, 2, r9.info.pixel_ratio, false, false, 20000000);
238  //w9.SetVideoOptions("GIF", r9.info.fps, r9.info.width, r9.info.height, 70, 1, true);
239 
240  // Open writer
241  w9.Open();
242 
243  // Prepare Streams
244  w9.PrepareStreams();
245 
246 // w9.SetOption(VIDEO_STREAM, "qmin", "2" );
247 // w9.SetOption(VIDEO_STREAM, "qmax", "30" );
248 // w9.SetOption(VIDEO_STREAM, "crf", "10" );
249 // w9.SetOption(VIDEO_STREAM, "rc_min_rate", "2000000" );
250 // w9.SetOption(VIDEO_STREAM, "rc_max_rate", "4000000" );
251 // w9.SetOption(VIDEO_STREAM, "max_b_frames", "10" );
252 
253  // Write header
254  w9.WriteHeader();
255  //r9.DisplayInfo();
256 
257  // 147000 frames, 28100 frames
258  //for (int frame = 1; frame <= (r9.info.video_length - 1); frame++)
259  //for (int z = 0; z < 2; z++)
260  for (long int frame = 500; frame <= 750; frame++)
261  //int frame = 1;
262  //while (true)
263  {
264  //int frame_number = (rand() % 750) + 1;
265  int frame_number = frame;
266 
267  cout << "get " << frame << " (frame: " << frame_number << ") " << endl;
268  tr1::shared_ptr<Frame> f = r9.GetFrame(frame_number);
269  //cout << "mapped frame channel layouts: " << f->ChannelsLayout() << endl;
270  //cout << "display it (" << f->number << ", " << f << ")" << endl;
271  //r9.GetFrame(frame_number)->DisplayWaveform();
272  //if (frame >= 495)
273  // f->DisplayWaveform();
274  //f->Display();
275  //f->Save("/home/jonathan/test.png", 1.0);
276  //f->AddColor(r9.info.width, r9.info.height, "blue");
277  w9.WriteFrame(f);
278 
279  //frame++;
280 
281  //if (frame >= 100)
282  // break;
283  }
284 
285  cout << "done looping" << endl;
286 
287  // Write Footer
288  //w9.WriteTrailer();
289 
290  // Close writer & reader
291  w9.Close();
292 
293  // Close timeline
294  r9.Close();
295  //t10.Close();
296  /* ---------------- */
297  cout << "happy ending" << endl;
298 
299  return 0;
300 
301 
302 
303 
304 
305 }
306 
307 //int main(int argc, char* argv[])
308 //{
309 // for (int z = 0; z<10; z++)
310 // main2();
311 //}
tr1::shared_ptr< Frame > GetFrame(long int requested_frame)
tr1::shared_ptr< Frame > GetFrame(long int requested_frame)
Definition: Timeline.cpp:623
ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
Definition: ReaderBase.h:83
int width
The width of the video (in pixesl)
Definition: ReaderBase.h:67
This class uses the FFmpeg libraries, to write and encode video files and audio files.
Definition: FFmpegWriter.h:143
int main(int argc, char *argv[])
Definition: Example.cpp:37
void Open()
Open writer.
void SetVideoOptions(bool has_video, string codec, Fraction fps, int width, int height, Fraction pixel_ratio, bool interlaced, bool top_field_first, int bit_rate)
Set video export options.
This class uses the FFmpeg libraries, to open video files and audio files, and return openshot::Frame...
Definition: FFmpegReader.h:92
void WriteFrame(tr1::shared_ptr< Frame > frame)
Add a frame to the stack waiting to be encoded.
int height
The height of the video (in pixels)
Definition: ReaderBase.h:66
This class represents a fraction.
Definition: Fraction.h:42
void Close()
Close the timeline reader (and any resources it was consuming)
Definition: Timeline.cpp:588
void WriteHeader()
Write the file header (after the options are set). This method is called automatically by the Open() ...
void Close()
Close the writer.
ReaderInfo info
Information about the current media file.
Definition: ReaderBase.h:111
Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
Definition: ReaderBase.h:69
void Open()
Open the reader (and start consuming resources)
Definition: Timeline.cpp:611
This namespace is the default namespace for all code in the openshot library.
void Open()
Open File - which is called by the constructor automatically.
void SetAudioOptions(bool has_audio, string codec, int sample_rate, int channels, ChannelLayout channel_layout, int bit_rate)
Set audio export options.
void PrepareStreams()
Prepare & initialize streams and open codecs. This method is called automatically by the Open() metho...
void SetJson(string value)
Load JSON string into this object.
Definition: Timeline.cpp:892
int channels
The number of audio channels used in the audio stream.
Definition: ReaderBase.h:82
int sample_rate
The number of audio samples per second (44100 is a common sample rate)
Definition: ReaderBase.h:81
This class represents a timeline.
Definition: Timeline.h:145