From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3416640401 for ; Tue, 20 Jun 2023 05:19:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A78CD68BFB0; Tue, 20 Jun 2023 08:19:50 +0300 (EEST) Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6AEDF68AF6B for ; Tue, 20 Jun 2023 08:19:44 +0300 (EEST) Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6b454de554aso542070a34.0 for ; Mon, 19 Jun 2023 22:19:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687238383; x=1689830383; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=p0vjK9kcn8mYvoA+pO/ZoAAjPaiNyomN7+FzOsuvLhc=; b=cKSqLLv7KK5pAuehYB7zOczveg19vxXco2dIycvSTNlB41fGH0oc4id+2zyQmSSkw5 7OtjsUeVqVbPfSjDv88Dnl9UO5BNdworSQneGMRXgzst+RU8+TAHldp+oo709X6EhWhe nb+bQZmloQ6P64XiM0yak3vC5sVIW87n3QkVlqhfRGzbjRtcFajWB5BfUceiaK1hVwpf /JjsXuuVGgBRdOPgpR10M1dClcOapd4XECq6e4RF01MGeCAtrxeMaiCzY8fvzmkY61jj Tzuzn1RgD46XyD6yC/EsGXk55iIWhvEGWLRuSB3KUV8dWzOrObFman032XLcyA0IwwLe jccg== X-Gm-Message-State: AC+VfDyDwButSN4eImKAxZXtcnTXv9POCEcXVeDGZQwFYPfxiTCXCElR zccdgN79FQFDLGo5puU+IEaYYLJgK1gU6g== X-Google-Smtp-Source: ACHHUZ7vKQOTDNtEfS4PYUfQm/rUMDiuXljjYnfAUdB1tcGu7IGNNRdvELfLFWRcMSradJZ+22uq2A== X-Received: by 2002:aca:bbc3:0:b0:3a0:3219:4b46 with SMTP id l186-20020acabbc3000000b003a032194b46mr2092671oif.5.1687238382569; Mon, 19 Jun 2023 22:19:42 -0700 (PDT) Received: from romains-mbp.lan (ip24-252-77-224.no.no.cox.net. [24.252.77.224]) by smtp.gmail.com with ESMTPSA id bk30-20020a0568081a1e00b0039c87230658sm703158oib.36.2023.06.19.22.19.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jun 2023 22:19:41 -0700 (PDT) From: toots@rastageeks.org To: ffmpeg-devel@ffmpeg.org Date: Tue, 20 Jun 2023 00:09:33 -0500 Message-Id: <20230620050932.85936-1-toots@rastageeks.org> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] libavformat/mpegts.c: fix hardcoded 5-bytes skip for metadata streams. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Romain Beauxis Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Romain Beauxis Before the introduction of AV_CODEC_ID_TIMED_ID3 for timed_id3 metadata streams in mpegts (commit 4a4437c0fbc8f7afe0c533070395a42e56b4ee75), AV_CODEC_ID_SMPTE_KLV was the only existing codec for metadata. It seems that this codec has a 5-bytes metadata header[1] that, for some reason, was always skipped when decoding data packets. However, when working with a AV_CODEC_ID_TIMED_ID3 streams, this results in the 5 first bytes of the payload being cut-off, which includes essential informations such as the ID3 tag version. This patch fixes the issue by keeping the 5-bytes skip only for AV_CODEC_ID_SMPTE_KLV streams. To test: 1. download this file: https://www.dropbox.com/s/jy8sih3pe8qskxb/bla.ts?dl=1 This file was download from: http://playertest.longtailvideo.com/adaptive/wowzaid3/playlist.m3u8 2. run this command: ffprobe -show_streams -select_streams 0 -show_packets -show_private_data \ -show_data /path/to/bla.ts Before: [PACKET] codec_type=data stream_index=0 pts=494646418 pts_time=5496.071311 dts=494646418 dts_time=5496.071311 duration=N/A duration_time=N/A size=21 pos=482784 flags=K__ data= 00000000: 0000 0000 1054 4954 3200 0000 0600 0003 .....TIT2....... 00000010: 7465 7374 00 test. After: [PACKET] codec_type=data stream_index=0 pts=494646418 pts_time=5496.071311 dts=494646418 dts_time=5496.071311 duration=N/A duration_time=N/A size=26 pos=482784 flags=K__ data= 00000000: 4944 3304 0000 0000 0010 5449 5432 0000 ID3.......TIT2.. 00000010: 0006 0000 0374 6573 7400 .....test. --- libavformat/mpegts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index fb8b0bf8fd..0b3edda817 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1305,7 +1305,7 @@ skip: p += sl_header_bytes; buf_size -= sl_header_bytes; } - if (pes->stream_type == 0x15 && buf_size >= 5) { + if (pes->st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV && buf_size >= 5) { /* skip metadata access unit header */ pes->pes_header_size += 5; p += 5; -- 2.39.2 (Apple Git-143) _______________________________________________ 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".