Hello Team,

I have a strange issue while trying to run simple transcoding application written in C++ with LibAV usage.
Code is attached as a file.

The application runs totally fine on M1 Macbook.

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.

Valgrind shows that something very bad happens here:

==1== Process terminating with default action of signal 11 (SIGSEGV)
==1==  Access not within mapped region at address 0x6F657265748B
==1==    at 0x1944844: av_vlog (log.c:430)
==1==    by 0x1944901: av_log (log.c:413)
==1==    by 0x8D9F8C: encode_send_frame_internal (encode.c:430)
==1==    by 0x8D9F8C: avcodec_send_frame (encode.c:500)
==1==    by 0x2CF400: encode(AVFormatContext*, AVStream*, AVStream*, AVCodecContext*, int, AVFrame*) (in /live)
==1==    by 0x2CFFA9: main (in /live)

Below you may find the full valgrind output:

==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x2F0F2D: ff_update_link_current_pts (avfilter.c:538)
==1==    by 0x2F2501: consume_update (avfilter.c:1357)
==1==    by 0x2F2501: ff_inlink_consume_frame (avfilter.c:1378)
==1==    by 0x2F27CA: ff_filter_frame_to_filter (avfilter.c:1092)
==1==    by 0x2F27CA: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F27CA: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x1945449: av_rescale_rnd (mathematics.c:74)
==1==    by 0x2F0F4F: ff_update_link_current_pts (avfilter.c:541)
==1==    by 0x2F2501: consume_update (avfilter.c:1357)
==1==    by 0x2F2501: ff_inlink_consume_frame (avfilter.c:1378)
==1==    by 0x2F27CA: ff_filter_frame_to_filter (avfilter.c:1092)
==1==    by 0x2F27CA: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F27CA: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x1945479: av_rescale_rnd (mathematics.c:83)
==1==    by 0x2F0F4F: ff_update_link_current_pts (avfilter.c:541)
==1==    by 0x2F2501: consume_update (avfilter.c:1357)
==1==    by 0x2F2501: ff_inlink_consume_frame (avfilter.c:1378)
==1==    by 0x2F27CA: ff_filter_frame_to_filter (avfilter.c:1092)
==1==    by 0x2F27CA: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F27CA: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x523A15: filter_frame (af_volume.c:376)
==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)
==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)
==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x523777: filter_frame (af_volume.c:379)
==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)
==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)
==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x4E365C: filter_frame (af_aresample.c:204)
==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)
==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)
==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x1945449: av_rescale_rnd (mathematics.c:74)
==1==    by 0x4E36E0: filter_frame (af_aresample.c:205)
==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)
==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)
==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x1945479: av_rescale_rnd (mathematics.c:83)
==1==    by 0x4E36E0: filter_frame (af_aresample.c:205)
==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)
==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)
==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x1920278: swr_next_pts (swresample.c:1036)
==1==    by 0x4E36EB: filter_frame (af_aresample.c:206)
==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)
==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)
==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x4E36FA: filter_frame (af_aresample.c:208)
==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)
==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)
==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x523764: filter_frame (af_volume.c:375)
==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)
==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)
==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x1920288: swr_next_pts (swresample.c:1039)
==1==    by 0x4E36EB: filter_frame (af_aresample.c:206)
==1==    by 0x2F278C: ff_filter_frame_framed (avfilter.c:960)
==1==    by 0x2F278C: ff_filter_frame_to_filter (avfilter.c:1104)
==1==    by 0x2F278C: ff_filter_activate_default (avfilter.c:1153)
==1==    by 0x2F278C: ff_filter_activate (avfilter.c:1312)
==1==    by 0x2F5D68: get_frame_internal (buffersink.c:137)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x302755: ff_framequeue_skip_samples (framequeue.c:141)
==1==    by 0x2F248E: take_samples (avfilter.c:1076)
==1==    by 0x2F248E: ff_inlink_consume_samples (avfilter.c:1395)
==1==    by 0x2F248E: ff_inlink_consume_samples (avfilter.c:1383)
==1==    by 0x2F5D16: get_frame_internal (buffersink.c:125)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x2F0F2D: ff_update_link_current_pts (avfilter.c:538)
==1==    by 0x2F23AE: consume_update (avfilter.c:1357)
==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1398)
==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1383)
==1==    by 0x2F5D16: get_frame_internal (buffersink.c:125)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x1945449: av_rescale_rnd (mathematics.c:74)
==1==    by 0x2F0F4F: ff_update_link_current_pts (avfilter.c:541)
==1==    by 0x2F23AE: consume_update (avfilter.c:1357)
==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1398)
==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1383)
==1==    by 0x2F5D16: get_frame_internal (buffersink.c:125)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x1945479: av_rescale_rnd (mathematics.c:83)
==1==    by 0x2F0F4F: ff_update_link_current_pts (avfilter.c:541)
==1==    by 0x2F23AE: consume_update (avfilter.c:1357)
==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1398)
==1==    by 0x2F23AE: ff_inlink_consume_samples (avfilter.c:1383)
==1==    by 0x2F5D16: get_frame_internal (buffersink.c:125)
==1==    by 0x2CFED3: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x2D0378: std::__cxx11::to_string(int) (in /live)
==1==    by 0x2CFF20: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x2D0473: unsigned int std::__detail::__to_chars_len<unsigned int>(unsigned int, int) (in /live)
==1==    by 0x2D0395: std::__cxx11::to_string(int) (in /live)
==1==    by 0x2CFF20: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x2D0B48: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char) (in /live)
==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)
==1==    by 0x2D03C7: std::__cxx11::to_string(int) (in /live)
==1==    by 0x2CFF20: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x2D0B8E: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char) (in /live)
==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)
==1==    by 0x2D03C7: std::__cxx11::to_string(int) (in /live)
==1==    by 0x2CFF20: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x2D104D: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_assign(char*, unsigned long, char) (in /live)
==1==    by 0x2D0BB2: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char) (in /live)
==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)
==1==    by 0x2D03C7: std::__cxx11::to_string(int) (in /live)
==1==    by 0x2CFF20: main (in /live)
==1== 
==1== Use of uninitialised value of size 8
==1==    at 0x2D01FE: std::char_traits<char>::assign(char&, char const&) (in /live)
==1==    by 0x2D0CE6: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_set_length(unsigned long) (in /live)
==1==    by 0x2D0BC5: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char) (in /live)
==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)
==1==    by 0x2D03C7: std::__cxx11::to_string(int) (in /live)
==1==    by 0x2CFF20: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x2D0822: void std::__detail::__to_chars_10_impl<unsigned int>(char*, unsigned int, unsigned int) (in /live)
==1==    by 0x2D03F9: std::__cxx11::to_string(int) (in /live)
==1==    by 0x2CFF20: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x2D08A1: void std::__detail::__to_chars_10_impl<unsigned int>(char*, unsigned int, unsigned int) (in /live)
==1==    by 0x2D03F9: std::__cxx11::to_string(int) (in /live)
==1==    by 0x2CFF20: main (in /live)
==1== 
==1== Use of uninitialised value of size 8
==1==    at 0x2D08EA: void std::__detail::__to_chars_10_impl<unsigned int>(char*, unsigned int, unsigned int) (in /live)
==1==    by 0x2D03F9: std::__cxx11::to_string(int) (in /live)
==1==    by 0x2CFF20: main (in /live)
==1== 
==1== Conditional jump or move depends on uninitialised value(s)
==1==    at 0x483BCE5: __strlen_sse2 (vg_replace_strmem.c:461)
==1==    by 0x19465B6: av_strdup (mem.c:274)
==1==    by 0x1938078: av_dict_set (dict.c:97)
==1==    by 0x2CFF53: main (in /live)
==1== 
got input frame. sending it to encoder...
==1== Invalid read of size 4
==1==    at 0x1944844: av_vlog (log.c:430)
==1==    by 0x1944901: av_log (log.c:413)
==1==    by 0x8D9F8C: encode_send_frame_internal (encode.c:430)
==1==    by 0x8D9F8C: avcodec_send_frame (encode.c:500)
==1==    by 0x2CF400: encode(AVFormatContext*, AVStream*, AVStream*, AVCodecContext*, int, AVFrame*) (in /live)
==1==    by 0x2CFFA9: main (in /live)
==1==  Address 0x6f657265748b is not stack'd, malloc'd or (recently) free'd
==1== 
==1== 
==1== Process terminating with default action of signal 11 (SIGSEGV)
==1==  Access not within mapped region at address 0x6F657265748B
==1==    at 0x1944844: av_vlog (log.c:430)
==1==    by 0x1944901: av_log (log.c:413)
==1==    by 0x8D9F8C: encode_send_frame_internal (encode.c:430)
==1==    by 0x8D9F8C: avcodec_send_frame (encode.c:500)
==1==    by 0x2CF400: encode(AVFormatContext*, AVStream*, AVStream*, AVCodecContext*, int, AVFrame*) (in /live)
==1==    by 0x2CFFA9: main (in /live)



In both cases I am using FMMPEG 6.0 Release which is compiled with g++.and -std=c++20 flag.

Can you please advise what can be wrong?

Thank you,

Kind Regards,

Igor Serganov 









Attachment: metadata.cpp
Description: Binary data

_______________________________________________
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to