diff options
author | Marton Balint <cus@passwd.hu> | 2020-07-20 21:38:21 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-09-13 17:51:57 +0200 |
commit | 00117e28c1133bf702a9adb8fa8cb3a356193bad (patch) | |
tree | 774f7c10f586e98167e011f44e9fb42dfaf6c6fd /libavutil/timecode.h | |
parent | ddc9cce3cd20fdf8d523e4bab3cab55de6b862b0 (diff) | |
download | ffmpeg-00117e28c1133bf702a9adb8fa8cb3a356193bad.tar.gz |
avutil/timecode: fix av_timecode_get_smpte_from_framenum with 50/60 fps
SMPTE 12M timecode can only count frames up to 39, because the tens-of-frames
value is stored in 2 bit. In order to resolve this 50/60 fps SMPTE timecode is
using the field bit (which is the same bit as the phase correction bit) to
signal the least significant bit of a 50/60 fps timecode. See SMPTE ST
12-1:2014 section 12.1.
Therefore we slightly change the format of the return value of
av_timecode_get_smpte_from_framenum and AV_FRAME_DATA_S12M_TIMECODE and start
using the previously unused Phase Correction bit as Field bit. (As the SMPTE
standard suggests)
We add 50/60 fps support to av_timecode_get_smpte_from_framenum by calling the
recently added av_timecode_get_smpte function in it which already handles this
properly.
This change affects the decklink indev and the DV and MXF muxers. MXF has no
fate test for 50/60fps content, DV does, therefore the changes.
MediaInfo (a recent version) confirms that half-frame timecode must be inserted
to DV. MXFInspect confirms valid timecode insertion to the System Item of MXF
files. For MXF, also see EBU R122.
Note that for DV the field flag is not used because in the HDV specs (SMPTE
370M) it is still defined as biphase mark polarity correction flag. So it
should not matter that the DV muxer overrides the field bit.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavutil/timecode.h')
-rw-r--r-- | libavutil/timecode.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libavutil/timecode.h b/libavutil/timecode.h index 5801330921..e54b116e93 100644 --- a/libavutil/timecode.h +++ b/libavutil/timecode.h @@ -66,11 +66,11 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps); * the format description as follows: * bits 0-5: hours, in BCD(6bits) * bits 6: BGF1 - * bits 7: BGF2 (NTSC) or PC (PAL) + * bits 7: BGF2 (NTSC) or FIELD (PAL) * bits 8-14: minutes, in BCD(7bits) * bits 15: BGF0 (NTSC) or BGF2 (PAL) * bits 16-22: seconds, in BCD(7bits) - * bits 23: PC (NTSC) or BGF0 (PAL) + * bits 23: FIELD (NTSC) or BGF0 (PAL) * bits 24-29: frames, in BCD(6bits) * bits 30: drop frame flag (0: non drop, 1: drop) * bits 31: color frame flag (0: unsync mode, 1: sync mode) @@ -78,8 +78,7 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps); * @note Frame number adjustment is automatically done in case of drop timecode, * you do NOT have to call av_timecode_adjust_ntsc_framenum2(). * @note The frame number is relative to tc->start. - * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity - * correction (PC) bits are set to zero. + * @note Color frame (CF) and binary group flags (BGF) bits are set to zero. */ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum); |