Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Lance Wang <lance.lmwang@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: fix CODECS attribute of H.264
Date: Tue, 30 May 2023 09:03:12 +0800
Message-ID: <CAM=jba9Tinor=+7MtTWss=Y0DYxLCHtupBSXOff-1Wnp5F0uhw@mail.gmail.com> (raw)
In-Reply-To: <tencent_42C1CFBE55722700B8A0160A4D11207DCD07@qq.com>

On Mon, May 29, 2023 at 10:16 PM Zhao Zhili <quinkblack@foxmail.com> wrote:

> From: Zhao Zhili <zhilizhao@tencent.com>
>
> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> ---
>  libavformat/hlsenc.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 871afb571b..1e0848ce3d 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -355,9 +355,19 @@ static void write_codec_attr(AVStream *st,
> VariantStream *vs)
>
>      if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
>          uint8_t *data = st->codecpar->extradata;
> -        if (data && (data[0] | data[1] | data[2]) == 0 && data[3] == 1 &&
> (data[4] & 0x1F) == 7) {
> +        if (data) {
> +            const uint8_t *p;
> +
> +            if (AV_RB32(data) == 0x01 && (data[4] & 0x1F) == 7)
> +                p = &data[5];
> +            else if (AV_RB24(data) == 0x01 && (data[3] & 0x1F) == 7)
> +                p = &data[4];
> +            else if (data[0] == 0x01)  /* avcC */
> +                p = &data[1];
> +            else
> +                goto fail;
>

how to reproduce the issue? I recall mpegts is annex b format and sps/pps
start code is 4 byte always.


>              snprintf(attr, sizeof(attr),
> -                     "avc1.%02x%02x%02x", data[5], data[6], data[7]);
> +                     "avc1.%02x%02x%02x", p[0], p[1], p[2]);
>          } else {
>              goto fail;
>          }
> --
> 2.25.1
>
> _______________________________________________
> 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".
>
_______________________________________________
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".

  parent reply	other threads:[~2023-05-30  1:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-29 22:16 Zhao Zhili
2023-05-29 14:46 ` Anton Khirnov
2023-05-29 15:08   ` Zhao Zhili
2023-05-29 15:16     ` Anton Khirnov
2023-06-08  2:45       ` [FFmpeg-devel] [PATCH v2] " Zhao Zhili
2023-06-09  4:58         ` Lance Wang
2023-05-30  1:03 ` Lance Wang [this message]
2023-05-30  3:09   ` [FFmpeg-devel] [PATCH] " "zhilizhao(赵志立)"
2023-05-30  4:44     ` Lance Wang
2023-05-30  5:28       ` "zhilizhao(赵志立)"

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='CAM=jba9Tinor=+7MtTWss=Y0DYxLCHtupBSXOff-1Wnp5F0uhw@mail.gmail.com' \
    --to=lance.lmwang@gmail.com \
    --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