Set video export options
| 34 | |
| 35 | // Set video export options |
| 36 | void 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 |
| 79 | void ImageWriter::Open() |
no test coverage detected