Пример #1
0
    def add_text(self,
                 text,
                 align,
                 frame_start=None,
                 frame_end=None,
                 options=None):
        """
        Adding static text to a filter.

        :param str text: text to apply to the drawtext
        :param enum align: alignment, must use provided enum flags
        :param int frame_start: starting frame for burnins current frame
        :param dict options: recommended to use TextOptions
        """
        if not options:
            options = ffmpeg_burnins.TextOptions(**self.options_init)

        options = options.copy()
        if frame_start is not None:
            options["frame_offset"] = frame_start

        # `frame_end` is only for meassurements of text position
        if frame_end is not None:
            options["frame_end"] = frame_end

        self._add_burnin(text, align, options, DRAWTEXT)
Пример #2
0
    def add_text(self, text, align, options=None):
        """
        Adding static text to a filter.

        :param str text: text to apply to the drawtext
        :param enum align: alignment, must use provided enum flags
        :param dict options: recommended to use TextOptions
        """
        if not options:
            options = ffmpeg_burnins.TextOptions(**self.options_init)
        self._add_burnin(text, align, options, ffmpeg_burnins.DRAWTEXT)
Пример #3
0
    def add_datetime(self, date_format, align, options=None):
        """
        Adding date text to a filter. Using pythons datetime module.

        :param str date_format: format of date (e.g. `%d.%m.%Y`)
        :param enum align: alignment, must use provided enum flags
        :param dict options: recommended to use TextOptions
        """
        if not options:
            options = ffmpeg_burnins.TextOptions(**self.options_init)
        today = datetime.datetime.today()
        text = today.strftime(date_format)
        self._add_burnin(text, align, options, ffmpeg_burnins.DRAWTEXT)