MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / SetVideoOptions

Method SetVideoOptions

src/ImageWriter.cpp:36–76  ·  view source on GitHub ↗

Set video export options

Source from the content-addressed store, hash-verified

34
35// Set video export options
36void ImageWriter::SetVideoOptions(
37 std::string format, Fraction fps, int width, int height,
38 int quality, int loops, bool combine)
39{
40 // Set frames per second (if provided)
41 info.fps = fps;
42
43 // Set image magic properties
44 image_quality = quality;
45 number_of_loops = loops;
46 combine_frames = combine;
47 info.vcodec = format;
48
49 // Set the timebase (inverse of fps)
50 info.video_timebase = fps.Reciprocal();
51
52 info.width = std::max(1, width);
53 info.height = std::max(1, height);
54
55 info.video_bit_rate = quality;
56
57 // Calculate the DAR (display aspect ratio)
58 Fraction size(
59 info.width * info.pixel_ratio.num,
60 info.height * info.pixel_ratio.den);
61
62 // Reduce size fraction
63 size.Reduce();
64
65 // Set the ratio based on the reduced fraction
66 info.display_ratio = size;
67
68 ZmqLogger::Instance()->AppendDebugMethod(
69 "ImageWriter::SetVideoOptions (" + format + ")",
70 "width", width,
71 "height", height,
72 "size.num", size.num,
73 "size.den", size.den,
74 "fps.num", fps.num,
75 "fps.den", fps.den);
76}
77
78// Open the writer
79void ImageWriter::Open()

Callers 8

WriteFrameMethod · 0.45
FFmpegWriter.cppFile · 0.45
ImageWriter.cppFile · 0.45
mainFunction · 0.45
ExampleHtml.pyFile · 0.45
mainFunction · 0.45
Example.pyFile · 0.45

Calls 3

ReciprocalMethod · 0.80
ReduceMethod · 0.80
AppendDebugMethodMethod · 0.80

Tested by

no test coverage detected