<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hello Team,<div><br></div><div>I have a strange issue while trying to run simple transcoding application written in C++ with LibAV usage.</div><div>Code is attached as a file.</div><div><br></div><div>The application runs totally fine on M1 Macbook.</div><div><br></div><div>Though when I run the same code in docker using linux/amd64 Debian or Ubuntu container it fails inside `avcodec_send_frame` with Segmentation fault.</div><div><br></div><div>Valgrind shows that something very bad happens here:</div><div><br></div><div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">==1== Process terminating with default action of signal 11 (SIGSEGV)</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">==1==  Access not within mapped region at address 0x6F657265748B</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">==1==    at 0x1944844: av_vlog (log.c:430)</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">==1==    by 0x1944901: av_log (log.c:413)</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">==1==    by 0x8D9F8C: encode_send_frame_internal (encode.c:430)</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">==1==    by 0x8D9F8C: avcodec_send_frame (encode.c:500)</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">==1==    by 0x2CF400: encode(AVFormatContext*, AVStream*, AVStream*, AVCodecContext*, int, AVFrame*) (in /live)</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">==1==    by 0x2CFFA9: main (in /live)</div></div><div><br></div><div>Below you may find the full valgrind output:</div><div><br></div><div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x2F0F2D: ff_update_link_current_pts (avfilter.c:538)</div><div>==1==    by 0x2F2501: consume_update (avfilter.c:1357)</div><div>==1==    by 0x2F2501: ff_inlink_consume_frame (avfilter.c:1378)</div><div>==1==    by 0x2F27CA: ff_filter_frame_to_filter (avfilter.c:1092)</div><div>==1==    by 0x2F27CA: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F27CA: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x1945449: av_rescale_rnd (mathematics.c:74)</div><div>==1==    by 0x2F0F4F: ff_update_link_current_pts (avfilter.c:541)</div><div>==1==    by 0x2F2501: consume_update (avfilter.c:1357)</div><div>==1==    by 0x2F2501: ff_inlink_consume_frame (avfilter.c:1378)</div><div>==1==    by 0x2F27CA: ff_filter_frame_to_filter (avfilter.c:1092)</div><div>==1==    by 0x2F27CA: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F27CA: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x1945479: av_rescale_rnd (mathematics.c:83)</div><div>==1==    by 0x2F0F4F: ff_update_link_current_pts (avfilter.c:541)</div><div>==1==    by 0x2F2501: consume_update (avfilter.c:1357)</div><div>==1==    by 0x2F2501: ff_inlink_consume_frame (avfilter.c:1378)</div><div>==1==    by 0x2F27CA: ff_filter_frame_to_filter (avfilter.c:1092)</div><div>==1==    by 0x2F27CA: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F27CA: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x523A15: filter_frame (af_volume.c:376)</div><div>==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)</div><div>==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)</div><div>==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x523777: filter_frame (af_volume.c:379)</div><div>==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)</div><div>==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)</div><div>==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x4E365C: filter_frame (af_aresample.c:204)</div><div>==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)</div><div>==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)</div><div>==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x1945449: av_rescale_rnd (mathematics.c:74)</div><div>==1==    by 0x4E36E0: filter_frame (af_aresample.c:205)</div><div>==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)</div><div>==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)</div><div>==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x1945479: av_rescale_rnd (mathematics.c:83)</div><div>==1==    by 0x4E36E0: filter_frame (af_aresample.c:205)</div><div>==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)</div><div>==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)</div><div>==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x1920278: swr_next_pts (swresample.c:1036)</div><div>==1==    by 0x4E36EB: filter_frame (af_aresample.c:206)</div><div>==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)</div><div>==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)</div><div>==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x4E36FA: filter_frame (af_aresample.c:208)</div><div>==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)</div><div>==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)</div><div>==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x523764: filter_frame (af_volume.c:375)</div><div>==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)</div><div>==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)</div><div>==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x1920288: swr_next_pts (swresample.c:1039)</div><div>==1==    by 0x4E36EB: filter_frame (af_aresample.c:206)</div><div>==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)</div><div>==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)</div><div>==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)</div><div>==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)</div><div>==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x302755: ff_framequeue_skip_samples (framequeue.c:141)</div><div>==1==    by 0x2F248E: take_samples (avfilter.c:1076)</div><div>==1==    by 0x2F248E: ff_inlink_consume_samples (avfilter.c:1395)</div><div>==1==    by 0x2F248E: ff_inlink_consume_samples (avfilter.c:1383)</div><div>==1==    by 0x2F5D16: get_frame_internal (buffersink.c:125)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x2F0F2D: ff_update_link_current_pts (avfilter.c:538)</div><div>==1==    by 0x2F23AE: consume_update (avfilter.c:1357)</div><div>==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1398)</div><div>==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1383)</div><div>==1==    by 0x2F5D16: get_frame_internal (buffersink.c:125)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x1945449: av_rescale_rnd (mathematics.c:74)</div><div>==1==    by 0x2F0F4F: ff_update_link_current_pts (avfilter.c:541)</div><div>==1==    by 0x2F23AE: consume_update (avfilter.c:1357)</div><div>==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1398)</div><div>==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1383)</div><div>==1==    by 0x2F5D16: get_frame_internal (buffersink.c:125)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x1945479: av_rescale_rnd (mathematics.c:83)</div><div>==1==    by 0x2F0F4F: ff_update_link_current_pts (avfilter.c:541)</div><div>==1==    by 0x2F23AE: consume_update (avfilter.c:1357)</div><div>==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1398)</div><div>==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1383)</div><div>==1==    by 0x2F5D16: get_frame_internal (buffersink.c:125)</div><div>==1==    by 0x2CFED3: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x2D0378: std::__cxx11::to_string(int) (in /live)</div><div>==1==    by 0x2CFF20: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x2D0473: unsigned int std::__detail::__to_chars_len<unsigned int>(unsigned int, int) (in /live)</div><div>==1==    by 0x2D0395: std::__cxx11::to_string(int) (in /live)</div><div>==1==    by 0x2CFF20: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x2D0B48: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char) (in /live)</div><div>==1==    by 0x2D0797: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >(unsigned long, char, std::allocator<char> const&) (in /live)</div><div>==1==    by 0x2D03C7: std::__cxx11::to_string(int) (in /live)</div><div>==1==    by 0x2CFF20: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x2D0B8E: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char) (in /live)</div><div>==1==    by 0x2D0797: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >(unsigned long, char, std::allocator<char> const&) (in /live)</div><div>==1==    by 0x2D03C7: std::__cxx11::to_string(int) (in /live)</div><div>==1==    by 0x2CFF20: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x2D104D: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_assign(char*, unsigned long, char) (in /live)</div><div>==1==    by 0x2D0BB2: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char) (in /live)</div><div>==1==    by 0x2D0797: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >(unsigned long, char, std::allocator<char> const&) (in /live)</div><div>==1==    by 0x2D03C7: std::__cxx11::to_string(int) (in /live)</div><div>==1==    by 0x2CFF20: main (in /live)</div><div>==1== </div><div>==1== Use of uninitialised value of size 8</div><div>==1==    at 0x2D01FE: std::char_traits<char>::assign(char&, char const&) (in /live)</div><div>==1==    by 0x2D0CE6: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_set_length(unsigned long) (in /live)</div><div>==1==    by 0x2D0BC5: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char) (in /live)</div><div>==1==    by 0x2D0797: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >(unsigned long, char, std::allocator<char> const&) (in /live)</div><div>==1==    by 0x2D03C7: std::__cxx11::to_string(int) (in /live)</div><div>==1==    by 0x2CFF20: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x2D0822: void std::__detail::__to_chars_10_impl<unsigned int>(char*, unsigned int, unsigned int) (in /live)</div><div>==1==    by 0x2D03F9: std::__cxx11::to_string(int) (in /live)</div><div>==1==    by 0x2CFF20: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x2D08A1: void std::__detail::__to_chars_10_impl<unsigned int>(char*, unsigned int, unsigned int) (in /live)</div><div>==1==    by 0x2D03F9: std::__cxx11::to_string(int) (in /live)</div><div>==1==    by 0x2CFF20: main (in /live)</div><div>==1== </div><div>==1== Use of uninitialised value of size 8</div><div>==1==    at 0x2D08EA: void std::__detail::__to_chars_10_impl<unsigned int>(char*, unsigned int, unsigned int) (in /live)</div><div>==1==    by 0x2D03F9: std::__cxx11::to_string(int) (in /live)</div><div>==1==    by 0x2CFF20: main (in /live)</div><div>==1== </div><div>==1== Conditional jump or move depends on uninitialised value(s)</div><div>==1==    at 0x483BCE5: __strlen_sse2 (vg_replace_strmem.c:461)</div><div>==1==    by 0x19465B6: av_strdup (mem.c:274)</div><div>==1==    by 0x1938078: av_dict_set (dict.c:97)</div><div>==1==    by 0x2CFF53: main (in /live)</div><div>==1== </div><div>got input frame. sending it to encoder...</div><div>==1== Invalid read of size 4</div><div>==1==    at 0x1944844: av_vlog (log.c:430)</div><div>==1==    by 0x1944901: av_log (log.c:413)</div><div>==1==    by 0x8D9F8C: encode_send_frame_internal (encode.c:430)</div><div>==1==    by 0x8D9F8C: avcodec_send_frame (encode.c:500)</div><div>==1==    by 0x2CF400: encode(AVFormatContext*, AVStream*, AVStream*, AVCodecContext*, int, AVFrame*) (in /live)</div><div>==1==    by 0x2CFFA9: main (in /live)</div><div>==1==  Address 0x6f657265748b is not stack'd, malloc'd or (recently) free'd</div><div>==1== </div><div>==1== </div><div>==1== Process terminating with default action of signal 11 (SIGSEGV)</div><div>==1==  Access not within mapped region at address 0x6F657265748B</div><div>==1==    at 0x1944844: av_vlog (log.c:430)</div><div>==1==    by 0x1944901: av_log (log.c:413)</div><div>==1==    by 0x8D9F8C: encode_send_frame_internal (encode.c:430)</div><div>==1==    by 0x8D9F8C: avcodec_send_frame (encode.c:500)</div><div>==1==    by 0x2CF400: encode(AVFormatContext*, AVStream*, AVStream*, AVCodecContext*, int, AVFrame*) (in /live)</div><div>==1==    by 0x2CFFA9: main (in /live)</div></div><div><br></div><div><br></div><div><br></div><div>In both cases I am using FMMPEG 6.0 Release which is compiled with g++.and <span style="color: rgb(64, 64, 64); font-family: Menlo, Monaco, "Courier New", monospace; white-space: pre; background-color: rgb(255, 255, 255);">-std=c++20 flag.</span></div><div><br></div><div>Can you please advise what can be wrong?</div><div><br></div><div>Thank you,</div><div><br></div><div>Kind Regards,</div><div><br></div><div>Igor Serganov </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div></div></body></html>