OpenShot Library | libopenshot  0.1.1
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  r10.debug = false;
58 
59  // Open Timeline
60  r10.Open();
61 
62  int frame_number = (rand() % 500) + 1;
63  cout << frame_count << ": reading frame " << frame_number << endl;
64  r10.GetFrame(frame_number);
65 
66  r10.Close();
67 
68  frame_count++;
69 // if (frame_count == 500)
70 // return 0;
71  }
72 
73 
74  cout << " --> 1" << endl;
75  r9.GetFrame(1)->Save("pic1.png", 1.0);
76  cout << " --> 500" << endl;
77  r9.GetFrame(500);
78  cout << "1034" << endl;
79  r9.GetFrame(1034);
80  cout << "1" << endl;
81  r9.GetFrame(1);
82  cout << "1200" << endl;
83  r9.GetFrame(1200)->Save("pic2.png", 1.0);
84 
85 
86  /* WRITER ---------------- */
87  FFmpegWriter w("output1.webm");
88 
89  // Set options
90  w.SetAudioOptions(true, "libvorbis", 44100, 2, LAYOUT_STEREO, 188000);
91  w.SetVideoOptions(true, "libvpx", Fraction(24,1), 1280, 720, Fraction(1,1), false, false, 3000000);
92 
93  // Open writer
94  w.Open();
95 
96  // Prepare Streams
97 // w.PrepareStreams();
98 //
99 // w.SetOption(VIDEO_STREAM, "qmin", "2" );
100 // w.SetOption(VIDEO_STREAM, "qmax", "30" );
101 // w.SetOption(VIDEO_STREAM, "crf", "10" );
102 // w.SetOption(VIDEO_STREAM, "rc_min_rate", "2000000" );
103 // w.SetOption(VIDEO_STREAM, "rc_max_rate", "4000000" );
104 // w.SetOption(VIDEO_STREAM, "max_b_frames", "10" );
105 //
106 // // Write header
107 // w.WriteHeader();
108 
109  // Write some frames
110  w.WriteFrame(&r9, 24, 50);
111 
112  // Close writer & reader
113  w.Close();
114 
115  return 0;
116 //
117 // FFmpegReader r110("/home/jonathan/Videos/PlaysTV/Team Fortress 2/2015_07_06_22_43_16-ses.mp4");
118 // r110.Open();
119 //// r110.debug = false;
120 //// r110.DisplayInfo();
121 //// FrameMapper m110(&r110, Fraction(24,1), PULLDOWN_NONE, 48000, 2, LAYOUT_STEREO);
122 //
123 // Timeline t110(1280, 720, Fraction(24,1), 48000, 2, LAYOUT_STEREO);
124 // Clip c110("/home/jonathan/Videos/PlaysTV/Team Fortress 2/2015_07_06_22_43_16-ses.mp4");
125 // c110.Position(1.0);
126 // t110.AddClip(&c110);
127 // t110.Open();
128 //
129 //// m110.GetFrame(100);
130 //// m110.GetFrame(85);
131 //// m110.GetFrame(85);
132 //// m110.GetFrame(86);
133 //// m110.GetFrame(86);
134 //// m110.GetFrame(86);
135 //// m110.GetFrame(86);
136 //// m110.GetFrame(87);
137 //// m110.GetFrame(87);
138 //
139 //
140 // t110.GetFrame(1000);
141 //// r110.GetFrame(96);
142 //// r110.GetFrame(97);
143 //// r110.GetFrame(95);
144 //// r110.GetFrame(98);
145 //// r110.GetFrame(100);
146 //// r110.GetFrame(101);
147 //// r110.GetFrame(103);
148 // return 0;
149 
150 // for (int y = 600; y < 700; y++) {
151 // cout << y << endl;
152 // int random_frame_number = rand() % 1000;
153 // t110.GetFrame(y);
154 // }
155 
156 // srand (time(NULL));
157 // for (int z = 0; z <= 1; z++)
158 // for (int y = 1000; y < 1300; y++) {
159 // cout << " --> " << y << endl;
160 // int random_frame_number = rand() % 1000;
161 // t110.GetFrame(y);
162 // }
163 
164 // FrameMapper m110(&r110, Fraction(24,1), PULLDOWN_NONE, 22050, 2, LAYOUT_STEREO);
165 // m110.Open();
166 //
167 // Clip c110(&m110);
168 // c110.Open();
169 //
170 // Timeline t10(1280, 720, Fraction(24,1), 22050, 2, LAYOUT_STEREO);
171 // t10.debug = false;
172 // //Clip c20("/home/jonathan/Pictures/DSC00660.JPG");
173 // //c20.End(1000.0);
174 // //c20.Layer(-1);
175 // //c20.scale = SCALE_STRETCH;
176 // //c20.rotation.AddPoint(1, 0.0);
177 // //c20.rotation.AddPoint(1000, 360.0);
178 // Clip c10("/home/jonathan/apps/libopenshot/src/examples/piano-mono.wav");
179 // c10.volume.AddPoint(1, 0.0);
180 // c10.volume.AddPoint(100, 1.0);
181 //// c10.time.AddPoint(1, 1);
182 //// c10.time.AddPoint(300, 900);
183 //// c10.time.AddPoint(600, 300);
184 //// c10.time.PrintValues();
185 //
186 // //Color background((unsigned char)0, (unsigned char)255, (unsigned char)0, (unsigned char)0);
187 // //background.red.AddPoint(1000, 255);
188 // //background.green.AddPoint(1000, 0);
189 // //t10.color = background;
190 //
191 // Color black;
192 // black.red = Keyframe(0);
193 // black.green = Keyframe(0);
194 // black.blue = Keyframe(0);
195 //
196 // Keyframe brightness;
197 // brightness.AddPoint(300, -1.0, BEZIER);
198 // brightness.AddPoint(370, 0.5, BEZIER);
199 // brightness.AddPoint(425, -0.5, BEZIER);
200 // brightness.AddPoint(600, 1.0, BEZIER);
201 //
202 // //Negate e;
203 // //Deinterlace e(false);
204 // //ChromaKey e(black, Keyframe(30));
205 // //QtImageReader mask_reader("/home/jonathan/apps/openshot-qt/src/transitions/extra/big_cross_right_barr.png");
206 // //QtImageReader mask_reader1("/home/jonathan/apps/openshot-qt/src/transitions/extra/big_barr.png");
207 // //Mask e(&mask_reader, brightness, Keyframe(3.0));
208 // //c10.AddEffect(&e);
209 // //Mask e1(&mask_reader1, brightness, Keyframe(3.0));
210 // //c10.AddEffect(&e1);
211 //
212 // // add clip to timeline
213 // t10.AddClip(&c10);
214 // //t10.AddClip(&c20);
215 // t10.Open();
216 
217 // FFmpegReader r9("/home/jonathan/Videos/sintel_trailer-720p.mp4");
218 // r9.Open();
219 // r9.DisplayInfo();
220 
221 
222  // Mapper
223  //FrameMapper map(&r9, Fraction(24,1), PULLDOWN_NONE, 48000, 2, LAYOUT_STEREO);
224  //map.DisplayInfo();
225  //map.debug = true;
226  //map.Open();
227 
228  /* WRITER ---------------- */
229  FFmpegWriter w9("C:\\Users\\Jonathan\\test-output.avi");
230  w9.debug = false;
231  //ImageWriter w9("/home/jonathan/output.gif");
232 
233  // Set options
234  //w9.SetVideoOptions(true, "mpeg4", r9.info.fps, r9.info.width, r9.info.height, Fraction(1,1), false, false, 1000000);
235  //w9.SetAudioOptions(true, "mp2", r9.info.sample_rate, r9.info.channels, r9.info.channel_layout, 64000);
236  w9.SetVideoOptions(true, "libx264", r9.info.fps, r9.info.width, r9.info.height, Fraction(1,1), false, false, 1000000);
237  w9.SetAudioOptions(true, "mp2", r9.info.sample_rate, r9.info.channels, r9.info.channel_layout, 64000);
238  //w9.SetAudioOptions(true, "libvorbis", r9.info.sample_rate, r9.info.channels, r9.info.channel_layout, 128000);
239  //w9.SetVideoOptions(true, "libvpx", r9.info.fps, r9.info.width, r9.info.height, Fraction(1,1), false, false, 3000000);
240  //w9.SetAudioOptions(true, "libmp3lame", 22050, r9.info.channels, r9.info.channel_layout, 120000);
241  //w9.SetVideoOptions(true, "libx264", t10.info.fps, t10.info.width, t10.info.height, t10.info.pixel_ratio, false, false, 1500000);
242  //w9.SetVideoOptions(true, "rawvideo", r9.info.fps, 400, 2, r9.info.pixel_ratio, false, false, 20000000);
243  //w9.SetVideoOptions("GIF", r9.info.fps, r9.info.width, r9.info.height, 70, 1, true);
244 
245  // Open writer
246  w9.Open();
247 
248  // Prepare Streams
249  w9.PrepareStreams();
250 
251 // w9.SetOption(VIDEO_STREAM, "qmin", "2" );
252 // w9.SetOption(VIDEO_STREAM, "qmax", "30" );
253 // w9.SetOption(VIDEO_STREAM, "crf", "10" );
254 // w9.SetOption(VIDEO_STREAM, "rc_min_rate", "2000000" );
255 // w9.SetOption(VIDEO_STREAM, "rc_max_rate", "4000000" );
256 // w9.SetOption(VIDEO_STREAM, "max_b_frames", "10" );
257 
258  // Write header
259  w9.WriteHeader();
260  //r9.DisplayInfo();
261 
262  // 147000 frames, 28100 frames
263  //for (int frame = 1; frame <= (r9.info.video_length - 1); frame++)
264  //for (int z = 0; z < 2; z++)
265  for (long int frame = 500; frame <= 750; frame++)
266  //int frame = 1;
267  //while (true)
268  {
269  //int frame_number = (rand() % 750) + 1;
270  int frame_number = frame;
271 
272  cout << "get " << frame << " (frame: " << frame_number << ") " << endl;
273  tr1::shared_ptr<Frame> f = r9.GetFrame(frame_number);
274  //cout << "mapped frame channel layouts: " << f->ChannelsLayout() << endl;
275  //cout << "display it (" << f->number << ", " << f << ")" << endl;
276  //r9.GetFrame(frame_number)->DisplayWaveform();
277  //if (frame >= 495)
278  // f->DisplayWaveform();
279  //f->Display();
280  //f->Save("/home/jonathan/test.png", 1.0);
281  //f->AddColor(r9.info.width, r9.info.height, "blue");
282  w9.WriteFrame(f);
283 
284  //frame++;
285 
286  //if (frame >= 100)
287  // break;
288  }
289 
290  cout << "done looping" << endl;
291 
292  // Write Footer
293  //w9.WriteTrailer();
294 
295  // Close writer & reader
296  w9.Close();
297 
298  // Close timeline
299  r9.Close();
300  //t10.Close();
301  /* ---------------- */
302  cout << "happy ending" << endl;
303 
304  return 0;
305 
306 
307 
308 
309 
310 }
311 
312 //int main(int argc, char* argv[])
313 //{
314 // for (int z = 0; z<10; z++)
315 // main2();
316 //}
tr1::shared_ptr< Frame > GetFrame(long int requested_frame)
tr1::shared_ptr< Frame > GetFrame(long int requested_frame)
Definition: Timeline.cpp:589
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:142
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:556
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:120
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:577
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:848
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:141