From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [FEATURE PROPOSAL] Extracting codec-level data to binary files
Date: Fri, 23 May 2025 13:55:38 +0200
Message-ID: <20250523115538.GZ29660@pb2> (raw)
In-Reply-To: <40377d44-4323-4427-9455-076c983cceda@mail.infomaniak.com>
[-- Attachment #1.1: Type: text/plain, Size: 4371 bytes --]
On Fri, May 23, 2025 at 11:33:40AM +0200, Timothée wrote:
> On 2025-05-23T02:57:36.000+02:00, Michael Niedermayer
> <michael@niedermayer.cc> wrote:
>
> > On Fri, May 23, 2025 at 02:45:59AM +0200, Michael Niedermayer wrote:
> >
> >> Hi Ronald On Thu, May 22, 2025 at 07:59:06AM -0400, Ronald S.
> >> Bultje wrote:
> >>
> >>> Hi, On Wed, May 21, 2025 at 9:34 AM Timothée <
> >>> timothee.informatique@regaud-chapuy.fr> wrote:
> >>>
> >>>> Hello, I am interested in expanding ffmpeg's capabilities to
> >>>> extract low-level data from video codecs. Specifically, I'd
> >>>> like to implement functionality that would allow exporting
> >>>> frame data, macroblock information, quantization tables, and
> >>>> similar codec-specific elements to binary files for further
> >>>> analysis. After searching through the documentation and
> >>>> existing features, I haven't found similar functionality,
> >>>> though I may have missed something. Has this been implemented
> >>>> before, or are there related features I should examine?
> >>>
> >>> Some older codecs implement minor variants for this, e.g. grep
> >>> for AV_FRAME_DATA_MOTION_VECTORS, which attaches a frame's
> >>> motion vectors to the picture data. I believe there's an example
> >>> app and possibly a filter to overlay MVs on top of the video
> >>> frame based on this concept. You could extend this to cover
> >>> other (macro)block info. There used to be a variant of this for
> >>> quant-tables also but I can't find it, maybe it was removed.
> >>
> >> For motion vectors: ./ffplay -flags2 +export_mvs -i
> >> matrixbench_mpeg2.mpg -vf codecview=mv=pf+bf+bb For macroblock
> >> segmentation and type vissualization + also motion vectors:
> >> ffplay-3.4.13 -debug vis_mb_type matrixbench_mpeg2.mpg -vf
> >> codecview=mv=pf+bf+bb For QP vissualization + also motion vectors:
> >> ffplay-3.4.13 -debug vis_qp matrixbench_mpeg2.mpg -vf
> >> codecview=mv=pf+bf+bb For qp values dumped on the console ./ffplay
> >> -debug qp -i matrixbench_mpeg2.mpg
> >
> > And this can easily be extended to other codecs, ATM it should work
> > with all 16x16 MB based codecs like
> > msmpeg4*/wmv*/mpeg1/2/4/h263/h264 mbtype and qp vissualization need
> > codecview to be extended or versions around 3.4 which implemented it
> > differently Implementing vissualization as done currently with
> > sidedata and codecview is simple and efficient. It also would allow
> > exporting the data to json by writing a codec2json filter in place
> > of codecview Also all decoders already have all this data parsed and
> > available so its simpler than trying to do it in a decoder
> > independant way I would thus suggest implementations of this for
> > modern codecs to follow the same path as the existing code. thx
>
> Thanks for the helpful pointers!
>
> I will work on the codec2json filter.
>
> Looking at the code, I see where I can access sidedata but extracting
> qb table seems to fail. (in codecview.c l.233: ff_qp_table_extract()
> return 0 and qp_table is empty) (I use ./ffmpeg -flags2 +export_mvs -i
> input.mp4 -vf codecview=qp=1 output.mp4 -y)
>
> Is is qp extraction not implemented yet? Or is it because I have h264
> video? If it's not implemented, I'm curious why there’s already code
> that appears to handle it.
look at ff_print_debug_info2()
theres probably something missing
The QP and MB type code was changed from being inside arrays of pictures
to sidedata. Something likely was lost/forgotten in the process
-debug qp
works with h264 so likely teh export into sidedata is not fully
implemented
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2025-05-23 11:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 13:34 Timothée
2025-05-22 11:59 ` Ronald S. Bultje
2025-05-22 12:32 ` Ramiro Polla
2025-05-22 17:02 ` Timothée
2025-05-22 17:43 ` Ramiro Polla
2025-05-22 20:27 ` Ronald S. Bultje
2025-05-23 0:45 ` Michael Niedermayer
2025-05-23 0:57 ` Michael Niedermayer
2025-05-23 9:33 ` Timothée
2025-05-23 11:55 ` Michael Niedermayer [this message]
2025-05-26 18:09 ` Timothée
2025-05-26 18:57 ` Ronald S. Bultje
2025-06-06 19:32 ` Tomas Härdin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250523115538.GZ29660@pb2 \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git