diff --git a/src/main.cpp b/src/main.cpp index 8f3a346..7c2aeb9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,7 +48,7 @@ int main() { mgs::ffmpeg::AVCodec avcodec{::AVCodecID::AV_CODEC_ID_MJPEG}; auto cam_frame_format = cam.frame_size(); - auto decoder{avcodec.make_decoder(cam_frame_format.width, cam_frame_format.height, ::AVPixelFormat::AV_PIX_FMT_RGB24)}; + auto decoder{avcodec.make_decoder(cam_frame_format.width, cam_frame_format.height, ::AVPixelFormat::AV_PIX_FMT_GRAY8)}; print_supported_frame_formats(cam); cam.start_streaming(); @@ -67,7 +67,7 @@ int main() { std::cout << "Decoded buffer size: " << out_data_size << '\n'; std::ofstream rgb_file_wr("rgb.data", std::ios::binary | std::ios::out); - rgb_file_wr.write(reinterpret_cast(buff.data()), buff.size()); + rgb_file_wr.write(reinterpret_cast(buff.data()), out_data_size); } catch (const std::runtime_error& err) { std::cerr << "Unhandled exception: " << err.what() << '\n';