Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Nicolas Gaullier <nicolas.gaullier@cji.paris>
To: ffmpeg-devel@ffmpeg.org
Cc: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Subject: [FFmpeg-devel] [PATCH 0/1] avcodec/h264_parser: fix start of packet for some broken
Date: Tue, 26 Mar 2024 16:09:45 +0100
Message-ID: <20240326150946.314054-1-nicolas.gaullier@cji.paris> (raw)

This is a patch from my patch serie https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10999
Maybe it is easier to review it this way, independantly.
This patch shows some benefits by itself, but most importantly, it is required for my patch serie to avoid any regression with some invalid streams.

This patch is active in mpegts/h264 when the NAL Access Unit Delimiter is missing the zero_byte (= a invalid stream case).
In such a case, if it happens that the last data byte from the previous frame is a null byte, this byte is "kidnaped" to form the full NAL_AUD...
This is not good, but even worser, with my patch serie above applied, it means that the start of the editunit is in the previous frame,
which means the pts has to be taken in it, which is not the expected behaviour in such a missleading scenario.

Michael sent me a sample from the wild but it can't be shared, so here it is:
I have another sample of my own with NAL_AUD missing zero_byte similarly, but it is missing the ending null byte,
so I have patched/inserted the null byte (I shrinked the adaptation field) to show how the code behave.

Sample original (invalid NAL_AUDs):
https://0x0.st/Xs9Q.ts
Same sample modified to exhibit the issue (invalid NAL_AUDs + an available null ending byte at 0x291F):
https://0x0.st/Xs9j.ts

I use this simple command line and then compare the xml, it seems quite clear:
ffprobe xxx.ts -show_packets -show_data -print_format xml

Nicolas Gaullier (1):
  avcodec/h264_parser: fix start of packet for some broken streams

 libavcodec/h264_parser.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

-- 
2.30.2

_______________________________________________
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".

             reply	other threads:[~2024-03-26 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 15:09 Nicolas Gaullier [this message]
2024-03-26 15:09 ` [FFmpeg-devel] [PATCH 1/1] avcodec/h264_parser: fix start of packet for some broken streams Nicolas Gaullier
2024-05-24 15:10 ` [FFmpeg-devel] [PATCH 0/1] avcodec/h264_parser: fix start of packet for some broken Nicolas Gaullier

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=20240326150946.314054-1-nicolas.gaullier@cji.paris \
    --to=nicolas.gaullier@cji.paris \
    --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