[FFmpeg-devel] Add S12M Timecode output as side data with -show_frame option (such as SEI TC)

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

Details

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

Commit Message

Antonin Gouzer May 11, 2019, 7:24 p.m.
From: agouzer <antonin.gouzer@gmail.com>

---
 fftools/ffprobe.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Antonin Gouzer May 11, 2019, 8:05 p.m.
Hello,
Sorry for the first mail which was an error.
This patch just add the SEI Timecode output of H264 files as side data
in ffprobe (-show_frame).
This has been already implemented in the shwoinfo video filter but not
in ffprobe.

Thanks in advance.


Le sam. 11 mai 2019 à 21:24, Antonin Gouzer <antonin.gouzer@gmail.com> a écrit :
>
> From: agouzer <antonin.gouzer@gmail.com>
>
> ---
>  fftools/ffprobe.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 52e9bbf544..4763ce6d98 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -2200,11 +2200,13 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
>                  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_sd;
> -                tc_sd = (uint32_t*)sd->data;
> +                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_sd[1],0);
> +                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;
>
> --
> 2.11.0
>

Patch hide | download patch | download mbox

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 52e9bbf544..4763ce6d98 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2200,11 +2200,13 @@  static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
                 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_sd;
-                tc_sd = (uint32_t*)sd->data;
+                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_sd[1],0);
+                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;