diff mbox

[FFmpeg-devel,DEVEL,v2] fftools/ffprobe: Add S12M Timecode output as side data (such as SEI TC)

Message ID 20190517123225.2224-1-antonin.gouzer@gmail.com
State Superseded
Headers show

Commit Message

Antonin Gouzer May 17, 2019, 12:32 p.m. UTC
Thanks in advance.
---
 fftools/ffprobe.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Marton Balint May 18, 2019, 4:20 p.m. UTC | #1
On Fri, 17 May 2019, Antonin Gouzer wrote:

> Thanks in advance.
> ---
> fftools/ffprobe.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index dea489d02e..4763ce6d98 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -2199,6 +2199,14 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
>                 char tcbuf[AV_TIMECODE_STR_SIZE];
>                 av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));
>                 print_str("timecode", tcbuf);
> +            } else if (sd->type == AV_FRAME_DATA_S12M_TIMECODE && sd->size >= 8) {
> +                uint32_t *tc = (uint32_t*)sd->data;
> +                for (int j = 1; j <= tc[0]; j++) {
> +                char tcbuf[AV_TIMECODE_STR_SIZE];
> +                av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0);
> +                print_str("timecode", tcbuf);
> +                }
> +                break;

A frame can have GOP_TIMECODE and S12M_TIMECODE side data at the same 
time, a separate name (e.g. s12m_timecode) should be used and the ffprobe 
xsd should be extended accordingly.

Regards,
Marton
Antonin Gouzer May 18, 2019, 7:51 p.m. UTC | #2
Thank you for your response,
I don't have any example of such a file.
I was thinking that GOP timecode was reserved to MPEG2 files and S12M
to H265/H264 files ?

In every writer the type of timecode is already an attribute: side_data_type.
With the actual xsd the result should be, with the XML writer:

<side_data_list>
                <side_data side_data_type="SMPTE 12-1 timecode"
timecode="00:03:25:03"/>
                <side_data side_data_type="GOP timecode"
timecode="00:03:25:03"/>
</side_data_list>

That should be ok don't you think ?

Antonin


Le sam. 18 mai 2019 à 18:20, Marton Balint <cus@passwd.hu> a écrit :
>
>
>
> On Fri, 17 May 2019, Antonin Gouzer wrote:
>
> > Thanks in advance.
> > ---
> > fftools/ffprobe.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> > index dea489d02e..4763ce6d98 100644
> > --- a/fftools/ffprobe.c
> > +++ b/fftools/ffprobe.c
> > @@ -2199,6 +2199,14 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
> >                 char tcbuf[AV_TIMECODE_STR_SIZE];
> >                 av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));
> >                 print_str("timecode", tcbuf);
> > +            } else if (sd->type == AV_FRAME_DATA_S12M_TIMECODE && sd->size >= 8) {
> > +                uint32_t *tc = (uint32_t*)sd->data;
> > +                for (int j = 1; j <= tc[0]; j++) {
> > +                char tcbuf[AV_TIMECODE_STR_SIZE];
> > +                av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0);
> > +                print_str("timecode", tcbuf);
> > +                }
> > +                break;
>
> A frame can have GOP_TIMECODE and S12M_TIMECODE side data at the same
> time, a separate name (e.g. s12m_timecode) should be used and the ffprobe
> xsd should be extended accordingly.
>
> Regards,
> Marton
> _______________________________________________
> 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".
Marton Balint May 18, 2019, 9:07 p.m. UTC | #3
On Sat, 18 May 2019, Antonin Gouzer wrote:

> Thank you for your response,
> I don't have any example of such a file.
> I was thinking that GOP timecode was reserved to MPEG2 files and S12M
> to H265/H264 files ?
>
> In every writer the type of timecode is already an attribute: side_data_type.
> With the actual xsd the result should be, with the XML writer:
>
> <side_data_list>
>                <side_data side_data_type="SMPTE 12-1 timecode"
> timecode="00:03:25:03"/>
>                <side_data side_data_type="GOP timecode"
> timecode="00:03:25:03"/>
> </side_data_list>
>
> That should be ok don't you think ?

Ah, OK then.

I see another issue though: what if S12M side data has more than one 
timecode in it? Having the same attirbute multiple times in an XML tag is 
not valid.

>> On Fri, 17 May 2019, Antonin Gouzer wrote:
>>
>> > Thanks in advance.
>> > ---
>> > fftools/ffprobe.c | 8 ++++++++
>> > 1 file changed, 8 insertions(+)
>> >
>> > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
>> > index dea489d02e..4763ce6d98 100644
>> > --- a/fftools/ffprobe.c
>> > +++ b/fftools/ffprobe.c
>> > @@ -2199,6 +2199,14 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
>> >                 char tcbuf[AV_TIMECODE_STR_SIZE];
>> >                 av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));
>> >                 print_str("timecode", tcbuf);
>> > +            } else if (sd->type == AV_FRAME_DATA_S12M_TIMECODE && sd->size >= 8) {
>> > +                uint32_t *tc = (uint32_t*)sd->data;

An assert makes sense here to check if tc[0] <= 3.

>> > +                for (int j = 1; j <= tc[0]; j++) {
>> > +                char tcbuf[AV_TIMECODE_STR_SIZE];
>> > +                av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0);
>> > +                print_str("timecode", tcbuf);
>> > +                }
>> > +                break;

Why the break?

Regards,
Marton
diff mbox

Patch

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index dea489d02e..4763ce6d98 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2199,6 +2199,14 @@  static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
                 char tcbuf[AV_TIMECODE_STR_SIZE];
                 av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));
                 print_str("timecode", tcbuf);
+            } else if (sd->type == AV_FRAME_DATA_S12M_TIMECODE && sd->size >= 8) {
+                uint32_t *tc = (uint32_t*)sd->data;
+                for (int j = 1; j <= tc[0]; j++) {
+                char tcbuf[AV_TIMECODE_STR_SIZE];
+                av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0);
+                print_str("timecode", tcbuf);
+                }
+                break;
             } else if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) {
                 AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata *)sd->data;