diff options
author | Limin Wang <lance.lmwang@gmail.com> | 2020-06-20 21:09:09 +0800 |
---|---|---|
committer | Limin Wang <lance.lmwang@gmail.com> | 2020-07-09 22:18:42 +0800 |
commit | 10c7745ae9bcd74e1be76acd58583510bc1d93d7 (patch) | |
tree | 98cf68af2067394b8c2f60c44a7401e4ca7b5427 /libavcodec | |
parent | b531216e6af679c2ec4e88e9f22a68dd9455976c (diff) | |
download | ffmpeg-10c7745ae9bcd74e1be76acd58583510bc1d93d7.tar.gz |
avcodec/h264_slice: add timecode metadata
Please test with below command:
./ffplay -vf drawtext="fontfile=/Library/Fonts/Arial.ttf:text=\\'%{metadata\\:timecode}\\'" \
../fate-suite/h264/crew_cif_timecode-2.h264
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h264_slice.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 725390e1a3..c7b2764270 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1306,6 +1306,7 @@ static int h264_export_frame_props(H264Context *h) if (h->sei.picture_timing.timecode_cnt > 0) { uint32_t *tc_sd; + char tcbuf[AV_TIMECODE_STR_SIZE]; AVFrameSideData *tcside = av_frame_new_side_data(out, AV_FRAME_DATA_S12M_TIMECODE, @@ -1324,6 +1325,8 @@ static int h264_export_frame_props(H264Context *h) int ff = h->sei.picture_timing.timecode[i].frame; tc_sd[i + 1] = av_timecode_get_smpte(h->avctx->framerate, drop, hh, mm, ss, ff); + av_timecode_make_smpte_tc_string(tcbuf, tc_sd[i + 1], 0); + av_dict_set(&out->metadata, "timecode", tcbuf, 0); } h->sei.picture_timing.timecode_cnt = 0; } |