Bitstream metadata rewriter¶
Register name used to load filter: bsrw
This filter is not checked during graph resolution and needs explicit loading.
Filters of this class can connect to each-other.
This filter rewrites some metadata of various bitstream formats.
The filter can currently modify the following properties in video bitstreams:
-
MPEG-4 Visual:
- sample aspect ratio
- profile and level
-
AVC|H264, HEVC and VVC:
- sample aspect ratio
- profile, level, profile compatibility
- video format, video fullrange
- color primaries, transfer characteristics and matrix coefficients (or remove all info)
- (AVC|HEVC) timecode- AV1:
- timecode
-
ProRes:
- sample aspect ratio
- color primaries, transfer characteristics and matrix coefficients
Values are by default initialized to -1, implying to keep the related info (present or not) in the bitstream.
A sar value of 0/0 will remove sample aspect ratio info from bitstream if possible.
The filter can currently modify the following properties in the stream configuration but not in the bitstream:
- HEVC: profile IDC, profile space, general compatibility flags
- VVC: profile IDC, general profile and level indication
The filter will work in passthrough mode for all other codecs and media types.
Timecode Manipulation¶
One can optionally set the tcxs and tcxe to define the start and end of timecode manipulation. By default, the filter will process all packets.
Some modes require you to define tcsc. This follows the same format as the timecode itself (- to first to infer the value from the first timecode when timecode manipulation starts. In this case, unless a timecode is found, the filter will not perform any operation./#). The use of negative values is only meaningful in the shift mode. It's also possible to set tcsc to first to infer the value from the first timecode when timecode manipulation starts. In this case, unless a timecode is found, the filter will not perform any operation.
Modes¶
Timecode manipulation has four modes and they all have their own operating nuances.
Remove¶
Remove all timecodes from the bitstream.
Insert¶
Insert timecodes based on the CTS. If tcsc is set, it will be used as timecode offset.
This mode will overwrite existing timecodes (if any).
Shift¶
Shift all timecodes by the value defined in tcsc.
This mode will only modify timecodes if they exists, no new timecode will be inserted.
Constant¶
Set all timecodes to the value defined in tcsc.
Again, this mode wouldn't insert new timecodes.
UTC¶
Uses the SenderNTP property, UTC property on the packet, or the current UTC time to set the timecode.
This mode will overwrite existing timecodes (if any).
Examples¶
Example
gpac -i in.mp4 bsrw:tc=insert [dst]
gpac -i in.mp4 bsrw:tc=insert:tcsc=TC00:00:10:00 [dst]
gpac -i in.mp4 bsrw:tc=shift:tcsc=TC00:00:10:00:tcxs=TC00:01:00:00 [dst]
Options¶
cprim (cprm, default: -1, Enum: reserved0|BT709|undef|reserved3|BT470M|BT470G|SMPTE170|SMPTE240|FILM|BT2020|SMPTE428|SMPTE431|SMPTE432|EBU3213, updatable): color primaries according to ISO/IEC 23001-8 / 23091-2
ctfc (ctfc, default: -1, Enum: reserved0|BT709|undef|reserved3|BT470M|BT470BG|SMPTE170|SMPTE249|Linear|Log100|Log316|IEC61966|BT1361|sRGB|BT2020_10|BT2020_12|SMPTE2084|SMPTE428|STDB67, updatable): color transfer characteristics according to ISO/IEC 23001-8 / 23091-2
cmx (cmxc, default: -1, Enum: GBR|BT709|undef|FCC|BT601|SMPTE170|SMPTE240|YCgCo|BT2020|BT2020cl|YDzDx, updatable): color matrix coefficients according to ISO/IEC 23001-8 / 23091-2
sar (frac, default: -1/-1, updatable): aspect ratio to rewrite
m4vpl (sint, default: -1, updatable): set ProfileLevel for MPEG-4 video part two
fullrange (bool, default: false, updatable): video full range flag
novsi (bool, default: false, updatable): remove video_signal_type from VUI in AVC|H264 and HEVC
novuitiming (bool, default: false, updatable): remove timing_info from VUI in AVC|H264 and HEVC
prof (sint, default: -1, updatable): profile indication for AVC|H264
lev (sint, default: -1, updatable): level indication for AVC|H264, level_idc for VVC
pcomp (sint, default: -1, updatable): profile compatibility for AVC|H264
pidc (sint, default: -1, updatable): profile IDC for HEVC and VVC
pspace (sint, default: -1, updatable): profile space for HEVC
gpcflags (sint, default: -1, updatable): general compatibility flags for HEVC
tcxs (str, updatable): timecode manipulation start
tcxe (str, updatable): timecode manipulation end
tcdf (bool, default: false, updatable): use NTSC drop-frame counting for timecodes
tcsc (str, updatable): timecode constant for use with shift/constant modes
tc (enum, default: none, updatable): timecode manipulation mode
- none: do not change anything
- remove: remove timecodes
- insert: insert timecodes based on cts or
tcsc(if provided) - shift: shift timecodes based by
tcsc - constant: overwrite timecodes with
tcsc - utc: insert timecodes based on the utc time on the packet or the current time
seis (uintl, updatable): list of SEI message types (4,137,144,...). When used with rmsei, this serves as a blacklist. If left empty, all SEIs will be removed. Otherwise, it serves as a whitelist
rmsei (bool, default: false, updatable): remove SEI messages from bitstream for AVC|H264, HEVC and VVC
vidfmt (sint, default: -1, Enum: component|pal|ntsc|secam|mac|undef, updatable): video format for AVC|H264, HEVC and VVC