Example #1
0
    def __init__(self, parent, main):
        super(VP9, self).__init__(parent)
        self.main = main

        grid = QtWidgets.QGridLayout()

        # grid.addWidget(QtWidgets.QLabel("VP9"), 0, 0)

        self.widgets = Box(
            fps=None,
            remove_hdr=None,
            mode=None)

        self.mode = 'CRF'

        grid.addLayout(self.init_remove_hdr(), 2, 0, 1, 2)
        grid.addLayout(self.init_modes(), 0, 2, 4, 4)
        grid.addLayout(self.init_quality(), 1, 0, 1, 2)
        grid.addLayout(self.init_speed(), 0, 0, 1, 2)

        grid.addLayout(self.init_row_mt(), 4, 0, 1, 2)
        grid.addLayout(self.init_force_420(), 5, 0, 1, 2)
        grid.addLayout(self.init_single_pass(), 6, 0, 1, 2)

        grid.addWidget(QtWidgets.QWidget(), 8, 0)
        grid.setRowStretch(8, 1)
        guide_label = QtWidgets.QLabel(f"<a href='https://trac.ffmpeg.org/wiki/Encode/VP9'>FFMPEG VP9 Encoding Guide</a>")
        guide_label.setAlignment(QtCore.Qt.AlignBottom)
        guide_label.setOpenExternalLinks(True)
        grid.addWidget(guide_label, 9, 0, -1, 1)
        self.setLayout(grid)
        self.hide()
Example #2
0
 def update_commands(self, commands):
     if not commands:
         return
     self.inner_widget = QtWidgets.QWidget()
     sp = QtWidgets.QSizePolicy()
     sp.setHorizontalPolicy(QtWidgets.QSizePolicy.Policy.Maximum)
     self.inner_widget.setSizePolicy(sp)
     layout = QtWidgets.QVBoxLayout()
     layout.setSpacing(5)
     for index, item in enumerate(commands, 1):
         if item.item == "command":
             new_item = Command(self.scroll_area,
                                item.command,
                                index,
                                name=item.name)
             layout.addWidget(new_item)
         elif item.item == "loop":
             new_item = Loop(self.scroll_area,
                             item.condition,
                             item.commands,
                             index,
                             name=item.name)
             layout.addWidget(new_item)
     layout.addStretch()
     self.inner_widget.setLayout(layout)
     self.scroll_area.setWidget(self.inner_widget)
     self.scroll_area.setHorizontalScrollBarPolicy(
         QtCore.Qt.ScrollBarAlwaysOff)
     self.inner_widget.setFixedWidth(self.scroll_area.width() - 3)
Example #3
0
    def __init__(self, parent, main):
        super(AV1, self).__init__(parent)
        self.main = main

        grid = QtWidgets.QGridLayout()

        # grid.addWidget(QtWidgets.QLabel("FFMPEG libaom-av1"), 0, 0)

        self.widgets = Box(fps=None, remove_hdr=None, mode=None)

        self.mode = 'CRF'

        grid.addLayout(self.init_remove_hdr(), 0, 0, 1, 2)
        grid.addLayout(self.init_modes(), 0, 2, 3, 3)

        grid.addWidget(QtWidgets.QWidget(), 5, 0)
        grid.setRowStretch(5, 1)
        guide_label = QtWidgets.QLabel(
            f"<a href='https://trac.ffmpeg.org/wiki/Encode/AV1'>FFMPEG AV1 Encoding Guide</a>"
        )
        guide_label.setAlignment(QtCore.Qt.AlignBottom)
        guide_label.setOpenExternalLinks(True)
        grid.addWidget(guide_label, 9, 0, -1, 1)

        self.setLayout(grid)
        self.hide()
Example #4
0
    def init_conversion(self):
        layout = QtWidgets.QHBoxLayout()
        self.widgets.convert_to = QtWidgets.QComboBox()

        self.update_codecs(self.codecs)

        self.widgets.convert_bitrate = QtWidgets.QComboBox()

        self.widgets.convert_bitrate.addItems([
            f'{x}k' for x in range(32 * self.channels, (256 * self.channels) +
                                   1, 32 * int(self.channels))
        ])
        self.widgets.convert_bitrate.setCurrentIndex(3)

        self.widgets.convert_bitrate.currentIndexChanged.connect(
            lambda: self.page_update())
        self.widgets.convert_to.currentIndexChanged.connect(
            lambda: self.page_update())
        layout.addWidget(QtWidgets.QLabel("Conversion: "))
        layout.addWidget(self.widgets.convert_to)

        layout.addWidget(QtWidgets.QLabel("Bitrate: "))
        layout.addWidget(self.widgets.convert_bitrate)

        return layout
Example #5
0
    def __init__(self, parent, main):
        super(AV1, self).__init__(parent)
        self.main = main
        grid = QtWidgets.QGridLayout()

        self.widgets = Box(fps=None,
                           remove_hdr=None,
                           mode=None,
                           segment_size=None)

        self.mode = 'QP'

        grid.addLayout(self.init_remove_hdr(), 1, 0, 1, 2)
        grid.addLayout(self.init_speed(), 0, 0, 1, 2)

        grid.addLayout(self.init_modes(), 0, 2, 4, 4)
        grid.addLayout(self.init_segment_size(), 3, 0, 1, 2)

        grid.addWidget(QtWidgets.QWidget(), 5, 0)
        grid.setRowStretch(5, 1)
        guide_label = QtWidgets.QLabel(
            f"<a href='https://github.com/OpenVisualCloud/SVT-AV1'>SVT-AV1 Github</a>"
        )
        guide_label.setAlignment(QtCore.Qt.AlignBottom)
        guide_label.setOpenExternalLinks(True)
        grid.addWidget(guide_label, 9, 0, -1, 1)
        self.setLayout(grid)
        self.hide()
Example #6
0
    def init_crop(self):
        crop_box = QtWidgets.QGroupBox()
        crop_box.setStyleSheet("QGroupBox{padding-top:17px; margin-top:-18px}")
        crop_layout = QtWidgets.QVBoxLayout()
        self.widgets.crop.top, crop_top_layout = self.build_hoz_int_field(
            "Top  ")
        self.widgets.crop.left, crop_hz_layout = self.build_hoz_int_field(
            "Left  ", right_stretch=False)
        self.widgets.crop.right, crop_hz_layout = self.build_hoz_int_field(
            "    Right  ", left_stretch=False, layout=crop_hz_layout)
        self.widgets.crop.bottom, crop_bottom_layout = self.build_hoz_int_field(
            "Bottom  ", right_stretch=True)

        self.widgets.crop.top.textChanged.connect(lambda: self.page_update())
        self.widgets.crop.left.textChanged.connect(lambda: self.page_update())
        self.widgets.crop.right.textChanged.connect(lambda: self.page_update())
        self.widgets.crop.bottom.textChanged.connect(
            lambda: self.page_update())

        label = QtWidgets.QLabel("Crop",
                                 alignment=(Qt.AlignBottom | Qt.AlignRight))
        label.setStyleSheet("QLabel{color:#777}")
        label.setMaximumHeight(40)
        crop_bottom_layout.addWidget(label)

        crop_layout.addLayout(crop_top_layout)
        crop_layout.addLayout(crop_hz_layout)
        crop_layout.addLayout(crop_bottom_layout)

        crop_box.setLayout(crop_layout)

        return crop_box
Example #7
0
 def init_force_420(self):
     layout = QtWidgets.QHBoxLayout()
     layout.addWidget(QtWidgets.QLabel('Force 4:2:0 chroma subsampling'))
     self.widgets.force_420 = QtWidgets.QCheckBox()
     self.widgets.force_420.setChecked(True)
     self.widgets.force_420.toggled.connect(lambda: self.main.page_update())
     layout.addWidget(self.widgets.force_420)
     return layout
Example #8
0
 def init_row_mt(self):
     layout = QtWidgets.QHBoxLayout()
     layout.addWidget(QtWidgets.QLabel('Row multithreading'))
     self.widgets.row_mt = QtWidgets.QCheckBox()
     self.widgets.row_mt.setChecked(False)
     self.widgets.row_mt.toggled.connect(lambda: self.main.page_update())
     layout.addWidget(self.widgets.row_mt)
     return layout
Example #9
0
 def init_single_pass(self):
     layout = QtWidgets.QHBoxLayout()
     layout.addWidget(QtWidgets.QLabel('Single Pass (CRF)'))
     self.widgets.single_pass = QtWidgets.QCheckBox()
     self.widgets.single_pass.setChecked(False)
     self.widgets.single_pass.toggled.connect(lambda: self.main.page_update())
     layout.addWidget(self.widgets.single_pass)
     return layout
Example #10
0
 def init_speed(self):
     layout = QtWidgets.QHBoxLayout()
     layout.addWidget(QtWidgets.QLabel('Speed'))
     self.widgets.speed = QtWidgets.QComboBox()
     self.widgets.speed.addItems([str(x) for x in range(6)])
     self.widgets.speed.setCurrentIndex(0)
     self.widgets.speed.currentIndexChanged.connect(lambda: self.main.page_update())
     layout.addWidget(self.widgets.speed)
     return layout
Example #11
0
 def init_quality(self):
     layout = QtWidgets.QHBoxLayout()
     layout.addWidget(QtWidgets.QLabel('Quality'))
     self.widgets.quality = QtWidgets.QComboBox()
     self.widgets.quality.addItems(['realtime', 'good', 'best'])
     self.widgets.quality.setCurrentIndex(1)
     self.widgets.quality.currentIndexChanged.connect(lambda: self.main.page_update())
     layout.addWidget(self.widgets.quality)
     return layout
Example #12
0
 def init_remove_hdr(self):
     layout = QtWidgets.QHBoxLayout()
     layout.addWidget(QtWidgets.QLabel('Remove HDR'))
     self.widgets.remove_hdr = QtWidgets.QComboBox()
     self.widgets.remove_hdr.addItems(['No', 'Yes'])
     self.widgets.remove_hdr.setCurrentIndex(0)
     self.widgets.remove_hdr.setDisabled(True)
     self.widgets.remove_hdr.currentIndexChanged.connect(lambda: self.main.page_update())
     layout.addWidget(self.widgets.remove_hdr)
     return layout
Example #13
0
 def init_fps(self):
     layout = QtWidgets.QHBoxLayout()
     layout.addWidget(QtWidgets.QLabel("FPS"))
     self.widgets.fps = QtWidgets.QComboBox()
     self.widgets.fps.addItems([str(x) for x in range(1, 31)])
     self.widgets.fps.setCurrentIndex(14)
     self.widgets.fps.currentIndexChanged.connect(
         lambda: self.main.build_commands())
     layout.addWidget(self.widgets.fps)
     return layout
Example #14
0
 def init_video_track_select(self):
     layout = QtWidgets.QHBoxLayout()
     self.widgets.video_track = QtWidgets.QComboBox()
     self.widgets.video_track.addItems([])
     self.widgets.video_track.currentIndexChanged.connect(
         lambda: self.page_update())
     layout.addWidget(QtWidgets.QLabel("Video Track "), stretch=0)
     layout.addWidget(self.widgets.video_track, stretch=1)
     layout.setSpacing(10)
     return layout
Example #15
0
 def init_segment_size(self):
     layout = QtWidgets.QHBoxLayout()
     layout.addWidget(QtWidgets.QLabel('Segment Size (seconds)'))
     self.widgets.segment_size = QtWidgets.QComboBox()
     self.widgets.segment_size.addItems(
         ["10", "30", "60", "90", "120", "240"])
     self.widgets.segment_size.setCurrentIndex(2)
     self.widgets.segment_size.currentIndexChanged.connect(
         lambda: self.main.page_update())
     layout.addWidget(self.widgets.segment_size)
     return layout
Example #16
0
    def init_output_type(self):
        layout = QtWidgets.QHBoxLayout()
        self.widgets.convert_to = QtWidgets.QComboBox()
        self.widgets.convert_to.addItems(list(self.plugins.keys()))
        layout.addWidget(QtWidgets.QLabel("Output: "), stretch=0)
        layout.addWidget(self.widgets.convert_to, stretch=1)
        layout.setSpacing(10)
        self.widgets.convert_to.currentTextChanged.connect(
            self.video_options.change_conversion)

        return layout
Example #17
0
    def __init__(self, parent, audio, number, enabled=True):
        super(Subtitle, self).__init__(parent)
        self.audio = audio
        self.widget = QtWidgets.QLineEdit()
        self.widget.setText(audio)
        self.widget.setDisabled(not enabled)
        self.setFixedHeight(60)

        grid = QtWidgets.QGridLayout()
        grid.addWidget(QtWidgets.QLabel(f"Track {number}"), 0, 0, 1, 2)
        grid.addWidget(self.widget, 1, 0, 1, 2)
        self.setLayout(grid)
Example #18
0
    def __init__(self, parent, condition, commands, number, name=""):
        super(Loop, self).__init__(parent)
        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(QtWidgets.QLabel(f"Loop: {name}"))
        self.condition = condition
        self.number = number
        self.setStyleSheet("QGroupBox{padding-top:15px; margin-top:-18px}")

        for index, item in enumerate(commands, 1):
            new_item = Command(parent, item.command, index, item.name)
            layout.addWidget(new_item)
        self.setLayout(layout)
Example #19
0
 def init_dither(self):
     layout = QtWidgets.QHBoxLayout()
     layout.addWidget(QtWidgets.QLabel('Dither'))
     self.widgets.dither = QtWidgets.QComboBox()
     self.widgets.dither.addItems([
         'sierra2_4a', 'floyd_steinberg', 'sierra2', 'bayer:bayer_scale=1',
         'bayer:bayer_scale=2', 'bayer:bayer_scale=3', 'none'
     ])
     self.widgets.dither.setCurrentIndex(0)
     self.widgets.dither.currentIndexChanged.connect(
         lambda: self.main.build_commands())
     layout.addWidget(self.widgets.dither)
     return layout
Example #20
0
 def init_input_file(self):
     layout = QtWidgets.QHBoxLayout()
     self.widgets.input_file = QtWidgets.QLineEdit("")
     self.widgets.input_file.setReadOnly(True)
     open_input_file = QtWidgets.QPushButton("...")
     open_input_file.setFixedWidth(50)
     open_input_file.setMaximumHeight(22)
     open_input_file.setDefault(True)
     layout.addWidget(QtWidgets.QLabel("Source File:"))
     layout.addWidget(self.widgets.input_file)
     layout.addWidget(open_input_file)
     layout.setSpacing(10)
     open_input_file.clicked.connect(lambda: self.open_file())
     return layout
Example #21
0
    def __init__(self, parent):
        super(CommandList, self).__init__(parent)

        layout = QtWidgets.QGridLayout()
        layout.addWidget(QtWidgets.QLabel('Commands to execute'))

        self.inner_widget = QtWidgets.QWidget()

        self.scroll_area = QtWidgets.QScrollArea(self)
        self.scroll_area.setMinimumHeight(200)

        layout.addWidget(self.scroll_area)

        self.setLayout(layout)
Example #22
0
    def __init__(self, parent):
        super(SubtitleList, self).__init__(parent)

        layout = QtWidgets.QGridLayout()
        layout.addWidget(QtWidgets.QLabel('Subtitle Tracks'))

        self.inner_widget = QtWidgets.QWidget()

        self.scroll_area = QtWidgets.QScrollArea(self)
        self.scroll_area.setMinimumHeight(200)

        layout.addWidget(self.scroll_area)

        self.setLayout(layout)
Example #23
0
    def __init__(self, parent, command, number, name="", enabled=True):
        super(Command, self).__init__(parent)
        self.command = command
        self.widget = QtWidgets.QLineEdit()
        self.widget.setReadOnly(True)
        self.widget.setText(command)
        self.widget.setDisabled(not enabled)
        self.setFixedHeight(60)

        grid = QtWidgets.QGridLayout()
        grid.addWidget(
            QtWidgets.QLabel(f"Command {number}" if not name else name), 0, 0,
            1, 2)
        grid.addWidget(self.widget, 1, 0, 1, 2)
        self.setLayout(grid)
Example #24
0
 def init_scale_and_crop(self):
     layout = QtWidgets.QVBoxLayout()
     layout.addWidget(self.init_scale())
     layout.addWidget(self.init_crop())
     layout.addWidget(self.init_start_time())
     layout.addStretch()
     self.grid.addLayout(layout, 0, 6, 5, 4)
Example #25
0
    def __init__(self, parent, main):
        super(GIF, self).__init__(parent)
        self.main = main

        grid = QtWidgets.QGridLayout()

        # grid.addWidget(QtWidgets.QLabel("GIF"), 0, 0)

        self.widgets = Box(fps=None, remove_hdr=None, dither=None)

        grid.addLayout(self.init_fps(), 1, 0)
        grid.addLayout(self.init_remove_hdr(), 2, 0)
        grid.addLayout(self.init_dither(), 0, 0)

        grid.addWidget(QtWidgets.QWidget(), 5, 0, 5, 2)
        self.setLayout(grid)
Example #26
0
 def update_audio(self, subtitles):
     self.inner_widget = QtWidgets.QWidget()
     sp = QtWidgets.QSizePolicy()
     sp.setHorizontalPolicy(QtWidgets.QSizePolicy.Policy.Maximum)
     self.inner_widget.setSizePolicy(sp)
     layout = QtWidgets.QVBoxLayout()
     layout.setSpacing(5)
     for index, track in enumerate(subtitles, 1):
         new_item = Subtitle(self.scroll_area, track, index)
         layout.addWidget(new_item)
     layout.addStretch()
     self.inner_widget.setLayout(layout)
     self.scroll_area.setWidget(self.inner_widget)
     self.scroll_area.setHorizontalScrollBarPolicy(
         QtCore.Qt.ScrollBarAlwaysOff)
     self.inner_widget.setFixedWidth(self.scroll_area.width() - 3)
Example #27
0
 def init_inner(self):
     sp = QtWidgets.QSizePolicy()
     sp.setHorizontalPolicy(QtWidgets.QSizePolicy.Policy.Maximum)
     self.inner_widget.setSizePolicy(sp)
     self.scroll_area.setWidget(self.inner_widget)
     self.scroll_area.setHorizontalScrollBarPolicy(
         QtCore.Qt.ScrollBarAlwaysOff)
     self.inner_widget.setFixedWidth(self.scroll_area.width() - 3)
Example #28
0
    def init_modes(self):
        layout = QtWidgets.QGridLayout()
        crf_group_box = QtWidgets.QGroupBox()
        crf_group_box.setFixedHeight(40)
        crf_group_box.setStyleSheet(
            "QGroupBox{padding-top:5px; margin-top:-18px}")
        crf_box_layout = QtWidgets.QHBoxLayout()
        bitrate_group_box = QtWidgets.QGroupBox()
        bitrate_group_box.setFixedHeight(40)
        bitrate_group_box.setStyleSheet(
            "QGroupBox{padding-top:5px; margin-top:-18px}")
        bitrate_box_layout = QtWidgets.QHBoxLayout()
        # rotation_dir = Path(base_path, 'data', 'rotations')
        # group_box.setStyleSheet("QGroupBox{padding-top:15px; margin-top:-15px; padding-bottom:-5px}")
        self.widgets.mode = QtWidgets.QButtonGroup()
        self.widgets.mode.buttonClicked.connect(self.set_mode)

        bitrate_radio = QtWidgets.QRadioButton("Bitrate")
        self.widgets.mode.addButton(bitrate_radio)
        self.widgets.bitrate = QtWidgets.QComboBox()
        self.widgets.bitrate.addItems(recommended_bitrates)
        self.widgets.bitrate.currentIndexChanged.connect(
            lambda: self.main.build_commands())
        self.widgets.bitrate.setCurrentIndex(6)
        bitrate_box_layout.addWidget(bitrate_radio)
        bitrate_box_layout.addWidget(self.widgets.bitrate)

        crf_radio = QtWidgets.QRadioButton("CRF")
        crf_radio.setChecked(True)
        self.widgets.mode.addButton(crf_radio)

        self.widgets.crf = QtWidgets.QComboBox()
        self.widgets.crf.addItems(recommended_crfs)
        self.widgets.crf.setCurrentIndex(30)
        self.widgets.crf.currentIndexChanged.connect(
            lambda: self.main.build_commands())

        crf_box_layout.addWidget(crf_radio)
        crf_box_layout.addWidget(self.widgets.crf)

        bitrate_group_box.setLayout(bitrate_box_layout)
        crf_group_box.setLayout(crf_box_layout)

        layout.addWidget(crf_group_box, 0, 0)
        layout.addWidget(bitrate_group_box, 1, 0)
        return layout
Example #29
0
    def init_video_area(self):
        layout = QtWidgets.QVBoxLayout()
        layout.addLayout(self.init_button_menu())
        layout.addLayout(self.init_video_track_select())

        layout.addWidget(self.init_rotate())
        layout.addStretch()
        self.grid.addLayout(layout, 0, 0, 5, 6)
Example #30
0
 def init_button_menu(self):
     layout = QtWidgets.QHBoxLayout()
     open_input_file = QtWidgets.QPushButton("🎞 Source")
     open_input_file.setFixedSize(100, 50)
     open_input_file.setDefault(True)
     open_input_file.clicked.connect(lambda: self.open_file())
     open_input_file.setStyleSheet('background: blue')
     convert = QtWidgets.QPushButton("Convert 🎥")
     convert.setFixedSize(100, 50)
     convert.setStyleSheet('background: green')
     convert.clicked.connect(lambda: self.create_video())
     self.widgets.convert_button = convert
     layout.addWidget(open_input_file)
     layout.addStretch()
     layout.addLayout(self.init_output_type(), alignment=Qt.AlignRight)
     layout.addStretch()
     layout.addWidget(convert)
     return layout