Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Romain Beauxis <toots@rastageeks.org>
To: FFmpeg development discussions and patches
	<ffmpeg-devel@ffmpeg.org>, Romain Beauxis <toots@rastageeks.org>,
	anton@khirnov.net
Subject: Re: [FFmpeg-devel] [PATCH] libavformat/mpegts.c: fix hardcoded 5-bytes skip for metadata streams.
Date: Thu, 22 Jun 2023 09:19:36 -0500
Message-ID: <CABWZ6ORi2Jj_8Aek64K+bPFiq_tAHr7AhBqaKXyOBMXyR4ZGYQ@mail.gmail.com> (raw)
In-Reply-To: <168733633551.21886.11704774345114900976@lain.khirnov.net>

[-- Attachment #1: Type: text/plain, Size: 3877 bytes --]

Le mer. 21 juin 2023 à 03:32, Anton Khirnov <anton@khirnov.net> a écrit :
>
> Quoting toots@rastageeks.org (2023-06-20 07:09:33)
> > From: Romain Beauxis <toots@rastageeks.org>
> >
> > 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.
>
> A FATE test for this would be nice.

Here's a patch attached, along with the sample that should go into
fate-suite/mpegts/id3.ts

The output has been verified with a local ffprobe build:

packet|codec_type=data|stream_index=0|pts=126000|pts_time=1.400000|dts=126000|dts_time=1.400000|duration=N/A|duration_time=N/A|size=26|pos=564|flags=K__|data=\n00000000:
4944 3304 0000 0000 0010 5449 5432 0000  ID3.......TIT2..\n00000010: 0006
0000 0374 6573 7400
.....test.\n|side_data|side_data_type=MPEGTS Stream ID|id=189

packet|codec_type=data|stream_index=0|pts=577350|pts_time=6.415000|dts=577350|dts_time=6.415000|duration=N/A|duration_time=N/A|size=26|pos=1316|flags=K__|data=\n00000000:
4944 3304 0000 0000 0010 5449 5432 0000  ID3.......TIT2..\n00000010: 0006
0000 0374 6573 7400
.....test.\n|side_data|side_data_type=MPEGTS Stream ID|id=189

stream|index=0|codec_name=timed_id3|profile=unknown|codec_type=data|codec_tag_string=ID3
|codec_tag=0x20334449|ts_packetsize=188|id=0x100|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=126000|start_time=1.400000|duration_ts=451350|duration=5.015000|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=2|extradata=\n|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
format|filename=id3.ts|nb_streams=1|nb_programs=1|format_name=mpegts|start_time=1.400000|duration=5.015000|size=1504|bit_rate=2399|probe_score=2

> --
> Anton Khirnov

[-- Attachment #2: timed_id3_fate_test.patch --]
[-- Type: application/octet-stream, Size: 2459 bytes --]

[-- Attachment #3: id3.ts --]
[-- Type: application/octet-stream, Size: 1504 bytes --]

[-- Attachment #4: 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".

  reply	other threads:[~2023-06-22 14:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20  5:09 toots
2023-06-20  7:09 ` Paul B Mahol
2023-06-20 23:58   ` Romain Beauxis
2023-06-21  0:09     ` James Almer
2023-06-21  8:32 ` Anton Khirnov
2023-06-22 14:19   ` Romain Beauxis [this message]
2023-06-24 10:43     ` Anton Khirnov
2023-06-24 10:51       ` Thilo Borgmann
2023-06-26 15:17         ` Romain Beauxis

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=CABWZ6ORi2Jj_8Aek64K+bPFiq_tAHr7AhBqaKXyOBMXyR4ZGYQ@mail.gmail.com \
    --to=toots@rastageeks.org \
    --cc=anton@khirnov.net \
    --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