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

Submitted by Antonin Gouzer on May 18, 2019, 11:11 p.m.

Details

Message ID 20190518231131.10327-1-antonin.gouzer@gmail.com
State New
Headers show

Commit Message

Antonin Gouzer May 18, 2019, 11:11 p.m.
---
Add the index of the timecode in case of multiple timecodes values
Limit to 3 the number of timecodes
remove break
Thanks you !
---
 fftools/ffprobe.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Marton Balint May 19, 2019, 5:49 p.m.
On Sun, 19 May 2019, Antonin Gouzer wrote:

> ---
> Add the index of the timecode in case of multiple timecodes values
> Limit to 3 the number of timecodes
> remove break

Am I reading this correctly, you'd get XML like

<side_data side_data_type="SMPTE 12-1 timecode" timecode="00:03:25:03" id="1"/>
<side_data side_data_type="SMPTE 12-1 timecode" timecode="00:03:25:03" id="2"/>
<side_data side_data_type="SMPTE 12-1 timecode" timecode="00:03:25:03" id="3"/>

right? The problem is that your output now looks as if the frame have 3 
instances of SMPTE 12-1 timecode side data.

Maybe it's just me, but I'd prefer something like

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

What do you think?

Thanks,
Marton
Antonin Gouzer May 22, 2019, 9:11 p.m.
Hello sorry for the delay.
Yes you're right.
There is 3 timecodes data for one frame.
One SEI data with 3 timecodes would represented by 3 side data.
As far as I know there is only one timecode in the SEI data.
In order to keep coherence with the schema (No simple element) , we could
implement  this:

            <side_data_list>
                <side_data side_data_type="SMPTE 12-1 timecode">
                 <timecode value="00:03:26:03"/>
                 <timecode value="00:03:26:03"/>
                 <timecode value="10:00:25:03"/>
               </side_data>
            </side_data_list>
        </frame>

Would it be correct ?

Le dim. 19 mai 2019 à 19:50, Marton Balint <cus@passwd.hu> a écrit :

>
>
> On Sun, 19 May 2019, Antonin Gouzer wrote:
>
> > ---
> > Add the index of the timecode in case of multiple timecodes values
> > Limit to 3 the number of timecodes
> > remove break
>
> Am I reading this correctly, you'd get XML like
>
> <side_data side_data_type="SMPTE 12-1 timecode" timecode="00:03:25:03"
> id="1"/>
> <side_data side_data_type="SMPTE 12-1 timecode" timecode="00:03:25:03"
> id="2"/>
> <side_data side_data_type="SMPTE 12-1 timecode" timecode="00:03:25:03"
> id="3"/>
>
> right? The problem is that your output now looks as if the frame have 3
> instances of SMPTE 12-1 timecode side data.
>
> Maybe it's just me, but I'd prefer something like
>
> <side_data side_data_type="SMPTE 12-1 timecode">
> <timecode>00:03:25:03</timecode>
> <timecode>00:03:25:03</timecode>
> <timecode>00:03:25:03</timecode>
> </side_data>
>
> What do you think?
>
> Thanks,
> 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".

Patch hide | download patch | download mbox

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index dea489d02e..b43349f746 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2199,6 +2199,20 @@  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 <= FFMIN(tc[0],3); j++) {
+                    char tcbuf[AV_TIMECODE_STR_SIZE];
+                    av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0);
+                    if (j > 1){
+                        writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA);
+                        print_str("side_data_type", name ? name : "unknown");
+                    }
+                    print_str("timecode", tcbuf);
+                    print_int("id",j);
+                    if (j < tc[0])
+                        writer_print_section_footer(w);
+                }          
             } else if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) {
                 AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata *)sd->data;