Spinnaker::Video cannot add converted image to video
In 2.4.x version of the SDK it was possible to do this:
video.Append(images[imageCnt]->Convert(PixelFormat_RGB8, DIRECTIONAL_FILTER));
When I now try to do the following, the application crashes:
Spinnaker::ImagePtr pimg = proc.Convert(image_buffer.get(id), Spinnaker::PixelFormat_RGBa8);
video.Append(pimg);
Spinnaker::ImagePtr pimg = proc.Convert(image_buffer.get(0), Spinnaker::PixelFormat_RGBa8);
Video::H264Option option;
option.frameRate = frameRateToSet;
option.height = static_cast<unsigned int>(pimg->GetHeight());
option.width = static_cast<unsigned int>(pimg->GetWidth());
option.bitrate = 50000000; // fixed 50Mbit
video.Open(file_name.c_str(), option);
-
Hello Toni,
Do you get any error message before the crash? It seems related to unsupported pixel format for creating video file using spinnaker library. Does it work fine in second implementation using pixel format PixelFormat_RGB8 or PixelFormat_BGRa8?
Regards,
Ifeanyi1 -
Hi Ifeanyi,
sorry for the delayed answer. It would not have expected this but your suggestion helps: both PixelFormat_RGB8 and PixelFormatBGRa8 work without issues, while PixelFormat_RGBa8 crashes. Even though the code is within a try/catch block it does not give an exception but crashes somewhere deep down in ucrtbase.dll. The debugger says:
Exception thrown at 0x00007FFBB733BA99 in hsr.exe: Microsoft C++ exception: Spinnaker::Exception at memory location 0x000000E05698DDC0.
Exception thrown at 0x00007FFBB733BA99 in hsr.exe: Microsoft C++ exception: Spinnaker::Exception at memory location 0x000000E05698E2C8.
Exception thrown at 0x00007FFBB733BA99 in hsr.exe: Microsoft C++ exception: Spinnaker::Exception at memory location 0x000000E056988DC0.Below is the stacktrace, maybe this helps somehow.
ucrtbase.dll!00007ffbb789286e() (Unknown Source:0)
ucrtbase.dll!00007ffbb7891f9f() (Unknown Source:0)
vcruntime140.dll!00007ffb967736ed() (Unknown Source:0)
vcruntime140.dll!00007ffb967746ec() (Unknown Source:0)
vcruntime140.dll!00007ffb967804b1() (Unknown Source:0)
ntdll.dll!00007ffbb9af247f() (Unknown Source:0)
ntdll.dll!00007ffbb9aa14b4() (Unknown Source:0)
ntdll.dll!00007ffbb9af0f8e() (Unknown Source:0)
KernelBase.dll!00007ffbb733ba99() (Unknown Source:0)
vcruntime140.dll!00007ffb96776ba7() (Unknown Source:0)
SpinVideo_v140.dll!00007ffb7b745417() (Unknown Source:0)
SpinVideo_v140.dll!00007ffb7b744207() (Unknown Source:0)
SpinVideo_v140.dll!00007ffb7b74a0d0() (Unknown Source:0)
hsr.exe!`flir::bfs::buffer_to_video'::`1'::dtor$2() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b1030() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b4307() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b2cab() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b2f5a() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b6dfb() (Unknown Source:0)
hsr.exe!__GSHandlerCheck_EH4(_EXCEPTION_RECORD * ExceptionRecord, void * EstablisherFrame, _CONTEXT * ContextRecord, _DISPATCHER_CONTEXT * DispatcherContext) Line 73 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\gs\amd64\gshandlereh4.cpp:73)
ntdll.dll!00007ffbb9af24ff() (Unknown Source:0)
ntdll.dll!00007ffbb9a80939() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b6a7f() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b1c1e() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b218b() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b2ec5() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b2f5a() (Unknown Source:0)
vcruntime140_1d.dll!00007ffbb43b6dfb() (Unknown Source:0)
hsr.exe!__GSHandlerCheck_EH4(_EXCEPTION_RECORD * ExceptionRecord, void * EstablisherFrame, _CONTEXT * ContextRecord, _DISPATCHER_CONTEXT * DispatcherContext) Line 73 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\gs\amd64\gshandlereh4.cpp:73)
ntdll.dll!00007ffbb9af247f() (Unknown Source:0)
ntdll.dll!00007ffbb9aa14b4() (Unknown Source:0)
ntdll.dll!00007ffbb9af0f8e() (Unknown Source:0)
KernelBase.dll!00007ffbb733ba99() (Unknown Source:0)
vcruntime140.dll!00007ffb96776ba7() (Unknown Source:0)
Spinnaker_v140.dll!00007ffb54c18f8b() (Unknown Source:0)
vcruntime140.dll!00007ffb96771060() (Unknown Source:0)
vcruntime140.dll!00007ffb96774d38() (Unknown Source:0)
ntdll.dll!00007ffbb9af17e6() (Unknown Source:0)
Spinnaker_v140.dll!00007ffb5412b86a() (Unknown Source:0)
SpinVideo_v140.dll!00007ffb7b744efc() (Unknown Source:0)
SpinVideo_v140.dll!00007ffb7b74a590() (Unknown Source:0)
hsr.exe!flir::bfs::buffer_to_video(std::string file_name, unsigned __int64 id_min, unsigned __int64 id_max, bool compressed) Line 138 (c:\Users\mahon\Documents\CodingProjects\C++\hsr\flir_bfs.cpp:138)
hsr.exe!mylayer::buffer_image_window() Line 107 (c:\Users\mahon\Documents\CodingProjects\C++\hsr\main.cpp:107)
hsr.exe!mylayer::on_draw() Line 32 (c:\Users\mahon\Documents\CodingProjects\C++\hsr\main.cpp:32)
hsr.exe!ibs::app::run() Line 68 (c:\Users\mahon\Documents\CodingProjects\C++\hsr\ibs\app.cpp:68)
hsr.exe!main() Line 168 (c:\Users\mahon\Documents\CodingProjects\C++\hsr\main.cpp:168)
hsr.exe!invoke_main() Line 79 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:79)
hsr.exe!__scrt_common_main_seh() Line 288 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
hsr.exe!__scrt_common_main() Line 331 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331)
hsr.exe!mainCRTStartup(void * __formal) Line 17 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17)
kernel32.dll!00007ffbb8c87344() (Unknown Source:0)
ntdll.dll!00007ffbb9aa26b1() (Unknown Source:0)Thank you very much for your help!
0 -
Hello Toni,
Glad to know I could help. It seems we do not support this pixel format, but I will double check and update here as soon as possible.
Regards,
Ifeanyi
0 -
Hello Toni,
Just for your information and future reference, here is response from our software team regarding this:
SpinVideo recorder will try to convert images into BGR8 before saving, but our image converter currently does not support converting RGBa8 to BGR8. We do support converting from BGRa8 and RGB8 to BGR8, that's why those combination work.
Regards,
Ifeanyi.
0 -
Hi Ifeanyi,
thanks for the clarification.
So for optimal performance the pixel format to add a frame to the recording would be BGR8 as this is obviously written to file and no further conversion should be neccessary. This helps a lot.
It would be nice if SpinVideo would check for pixel type and throw and exception or at least an assert in debug mode. Updating the documentation with this might also be a good idea.
Best regards
Toni
0 -
Hello Toni,
Thanks for sharing the idea with us. Yes, it is a nice feature to include in the sdk, and we have taken note of it.
Best regards,
Ifeanyi
0
Please sign in to leave a comment.
Comments
6 comments