On 7/2/2025 7:57 AM, Timothee wrote:
Hello,

I am working on a modification toextract per-macroblock prediction modes (H.264 for now). The goal is to make this information available to vf_codecview and print it in a log file (for now).

This are what I have added:

1.

    A new H264MBInfostruct holding the prediction modes.

Isn't this what libavutil/video_enc_params.h is for? Or if needed, what it could be extended to handle?


2.

    An AVBufferRef *mb_info_refis added to the H264Picturestruct to
    store this data for each picture.

3.

    This buffer is allocated with av_buffer_allocz()in
    alloc_picture()and its reference is released with
    av_buffer_unref()in ff_h264_unref_picture().

4.

    A new function, ff_h264_collect_mb_info(), is called after
    macroblock decoding to populate the buffer.

5.

    In output_frame(), a new side data (AV_FRAME_DATA_H264_MB_INFO)
    buffer is allocated, and the contents of srcp->mb_info_ref->dataare
    copied into it.

6. A new function to log the result in vf_codecview.c

This implementation results in a segmentation fault. I guess it is a race condition, but I am struggling to fix it.

The patch provided should result in the same error when running `./ ffmpeg -loglevel debug -i input.mp4 -vf codecview=show_modes=1 -f null -`

Are side data the right thing to use in this context ? Is there a better approach to do it ?

I am new to FFmpeg and, in general, to large open-source projects, but I am willing to learn so please do not hesitate to correct me.

Thank you for your guidance.

Timothée


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Reply via email to