Code Duplication    Length = 28-29 lines in 2 locations

ffmpeg_streaming/_format.py 2 locations

@@ 61-89 (lines=29) @@
58
        pass
59
60
61
class H264(Format):
62
    def __init__(self, video: str = "libx264", audio: str = 'aac', **codec_options):
63
        """
64
        @TODO: add documentation
65
        """
66
        videos = ['libx264', 'h264', 'h264_afm']
67
        audios = ['copy', 'aac', 'libvo_aacenc', 'libfaac', 'libmp3lame', 'libfdk_aac']
68
69
        super(H264, self).__init__(_verify_codecs(video, videos), _verify_codecs(audio, audios), **codec_options)
70
71
    def multiply(self) -> int:
72
        return MULTIPLY_BY_TWO
73
74
    def get_codec_options(self) -> dict:
75
        """
76
        set the default value of h264 codec options and update the value with the specified value by user
77
        see https://ffmpeg.org/ffmpeg-codecs.html#Options-28 for more information about options
78
        :return: dict
79
        """
80
        h264_codec_options = {
81
            'bf':           1,
82
            'keyint_min':   25,
83
            'g':            250,
84
            'sc_threshold': 40
85
        }
86
87
        h264_codec_options.update(self.codec_options)
88
89
        return h264_codec_options
90
91
92
class HEVC(Format):
@@ 92-119 (lines=28) @@
89
        return h264_codec_options
90
91
92
class HEVC(Format):
93
    """
94
    @TODO: add documentation
95
    """
96
    def __init__(self, video: str = "libx265", audio: str = 'aac', **codec_options):
97
        videos = ['libx265', 'h265']
98
        audios = ['copy', 'aac', 'libvo_aacenc', 'libfaac', 'libmp3lame', 'libfdk_aac']
99
100
        super(HEVC, self).__init__(_verify_codecs(video, videos), _verify_codecs(audio, audios), **codec_options)
101
102
    def multiply(self) -> int:
103
        return MULTIPLY_BY_TWO
104
105
    def get_codec_options(self) -> dict:
106
        """
107
        set the default value of hevc(h265) codec options and update the value with the specified value by user
108
        see https://ffmpeg.org/ffmpeg-codecs.html#Options-29 for more information about options
109
        :return: dict
110
        """
111
        h265_codec_options = {
112
            'keyint_min':   25,
113
            'g':            250,
114
            'sc_threshold': 40
115
        }
116
117
        h265_codec_options.update(self.codec_options)
118
119
        return h265_codec_options
120
121
122
class VP9(Format):