Esempio n. 1
0
def get_preset_defaults():
    return {
        "Standard Profile": Profile(x265=x265Settings()),
        "UHD HDR10 Film": Profile(
            auto_crop=True, x265=x265Settings(crf=18, hdr10=True, hdr10_opt=True, repeat_headers=True, preset="slow")
        ),
        "1080p Film": Profile(auto_crop=True, encoder="AVC (x264)", x264=x264Settings(crf=22, preset="slow")),
    }
Esempio n. 2
0
    def update_video_encoder_settings(self):
        if not self.app.fastflix.current_video:
            return

        x265_params_text = self.widgets.x265_params.text().strip()

        settings = x265Settings(
            preset=self.widgets.preset.currentText(),
            # intra_encoding=self.widgets.intra_encoding.isChecked(),
            intra_refresh=self.widgets.intra_refresh.isChecked(),
            max_muxing_queue_size=self.widgets.max_mux.currentText(),
            pix_fmt=self.widgets.pix_fmt.currentText().split(":")[1].strip(),
            profile=self.widgets.profile.currentText(),
            hdr10=self.widgets.hdr10.isChecked(),
            hdr10_opt=self.widgets.hdr10_opt.isChecked(),
            dhdr10_opt=self.widgets.dhdr10_opt.isChecked(),
            repeat_headers=self.widgets.repeat_headers.isChecked(),
            aq_mode=self.widgets.aq_mode.currentIndex(),
            bframes=self.widgets.bframes.currentIndex(),
            b_adapt=self.widgets.b_adapt.currentIndex(),
            intra_smoothing=self.widgets.intra_smoothing.isChecked(),
            frame_threads=self.widgets.frame_threads.currentIndex(),
            tune=self.widgets.tune.currentText(),
            x265_params=x265_params_text.split(":") if x265_params_text else [],
            hdr10plus_metadata=self.widgets.hdr10plus_metadata.text().strip(),  # .replace("\\", "/"),
            lossless=self.widgets.lossless.isChecked(),
            extra=self.ffmpeg_extras,
            extra_both_passes=self.widgets.extra_both_passes.isChecked(),
        )

        encode_type, q_value = self.get_mode_settings()
        settings.crf = q_value if encode_type == "qp" else None
        settings.bitrate = q_value if encode_type == "bitrate" else None
        self.app.fastflix.current_video.video_settings.video_encoder_settings = settings
Esempio n. 3
0
    def update_video_encoder_settings(self):
        if not self.app.fastflix.current_video:
            return

        x265_params_text = self.widgets.x265_params.text().strip()

        settings = x265Settings(
            preset=self.widgets.preset.currentText(),
            # intra_encoding=self.widgets.intra_encoding.isChecked(),
            intra_refresh=self.widgets.intra_refresh.isChecked(),
            max_muxing_queue_size=self.widgets.max_mux.currentText(),
            pix_fmt=self.widgets.pix_fmt.currentText().split(":")[1].strip(),
            profile=self.widgets.profile.currentText(),
            hdr10=self.widgets.hdr10.isChecked(),
            hdr10_opt=self.widgets.hdr10_opt.isChecked(),
            dhdr10_opt=self.widgets.dhdr10_opt.isChecked(),
            repeat_headers=self.widgets.repeat_headers.isChecked(),
            aq_mode=self.widgets.aq_mode.currentIndex(),
            bframes=self.widgets.bframes.currentIndex(),
            b_adapt=self.widgets.b_adapt.currentIndex(),
            intra_smoothing=self.widgets.intra_smoothing.isChecked(),
            frame_threads=self.widgets.frame_threads.currentIndex(),
            tune=self.widgets.tune.currentText(),
            x265_params=x265_params_text.split(":")
            if x265_params_text else [],
            hdr10plus_metadata=self.widgets.hdr10plus_metadata.text().strip().
            replace("\\", "/"),
            lossless=self.widgets.lossless.isChecked(),
            extra=self.ffmpeg_extras,
        )

        if self.mode == "CRF":
            crf = self.widgets.crf.currentText()
            settings.crf = int(crf.split(" ",
                                         1)[0]) if crf != "Custom" else int(
                                             self.widgets.custom_crf.text())
        else:
            bitrate = self.widgets.bitrate.currentText()
            if bitrate.lower() == "custom":
                settings.bitrate = self.widgets.custom_bitrate.text()
            else:
                settings.bitrate = bitrate.split(" ", 1)[0]

        self.app.fastflix.current_video.video_settings.video_encoder_settings = settings
Esempio n. 4
0
    subtitle_select_preferred_language: bool = True
    subtitle_automatic_burn_in: bool = False
    subtitle_select_first_matching: bool = False

    x265: Optional[x265Settings] = None
    x264: Optional[x264Settings] = None
    rav1e: Optional[rav1eSettings] = None
    svt_av1: Optional[SVTAV1Settings] = None
    vp9: Optional[VP9Settings] = None
    aom_av1: Optional[AOMAV1Settings] = None
    gif: Optional[GIFSettings] = None
    webp: Optional[WebPSettings] = None
    copy_settings: Optional[CopySettings] = None


empty_profile = Profile(x265=x265Settings())


def get_preset_defaults():
    return {
        "Standard Profile":
        Profile(x265=x265Settings()),
        "UHD HDR10 Film":
        Profile(auto_crop=True,
                x265=x265Settings(crf=18,
                                  hdr10=True,
                                  hdr10_opt=True,
                                  repeat_headers=True,
                                  preset="slow")),
        "1080p Film":
        Profile(auto_crop=True,
Esempio n. 5
0
    def __init__(self, app: FastFlixApp, main, *args, **kwargs):
        super().__init__(None, *args, **kwargs)
        self.app = app
        self.main = main
        self.config_file = self.app.fastflix.config.config_path
        self.setWindowTitle(t("New Profile"))
        self.setMinimumSize(500, 600)
        layout = QtWidgets.QGridLayout()

        profile_name_label = QtWidgets.QLabel(t("Profile Name"))
        profile_name_label.setFixedHeight(40)
        self.profile_name = QtWidgets.QLineEdit()
        if self.app.fastflix.config.theme == "onyx":
            self.profile_name.setStyleSheet(
                "background-color: #707070; border-radius: 10px; color: black")
        self.profile_name.setFixedWidth(300)

        self.advanced_options: AdvancedOptions = main.video_options.advanced.get_settings(
        )

        self.encoder = x265Settings(crf=18)

        theme = "QPushButton{ padding: 0 10px; font-size: 14px;  }"
        if self.app.fastflix.config.theme in ("dark", "onyx"):
            theme = """
            QPushButton {
              padding: 0 10px;
              font-size: 14px;
              background-color: #4f4f4f;
              border: none;
              border-radius: 10px;
              color: white; }
            QPushButton:hover {
              background-color: #6b6b6b; }"""

        save_button = QtWidgets.QPushButton(t("Create Profile"))
        save_button.setStyleSheet(theme)
        save_button.clicked.connect(self.save)
        save_button.setMaximumWidth(150)
        save_button.setFixedHeight(60)

        v_flip, h_flip = self.main.get_flips()
        self.main_settings = Box(
            keep_aspect_ratio=self.main.widgets.scale.keep_aspect.isChecked(),
            fast_seek=self.main.fast_time,
            rotate=self.main.widgets.rotate.currentIndex(),
            vertical_flip=v_flip,
            horizontal_flip=h_flip,
            copy_chapters=self.main.copy_chapters,
            remove_metadata=self.main.remove_metadata,
            remove_hdr=self.main.remove_hdr,
        )

        self.tab_area = QtWidgets.QTabWidget()
        self.tab_area.setMinimumWidth(500)
        self.audio_select = AudioSelect(self.app, self, self.main)
        self.subtitle_select = SubtitleSelect(self.app, self)
        self.advanced_tab = AdvancedTab(self.advanced_options)
        self.primary_tab = PrimaryOptions(self.main_settings)
        self.encoder_tab = EncoderOptions(self.app, self)
        self.tab_area.addTab(self.primary_tab, "Primary Settings")
        self.tab_area.addTab(self.encoder_tab, "Video")
        self.tab_area.addTab(self.audio_select, "Audio")
        self.tab_area.addTab(self.subtitle_select, "Subtitles")
        self.tab_area.addTab(self.advanced_tab, "Advanced Options")
        # self.tab_area.addTab(self.subtitle_select, "Subtitles")
        # self.tab_area.addTab(SubtitleSelect(self.app, self, "Subtitle Select", "subtitles"), "Subtitle Select")

        layout.addWidget(profile_name_label, 0, 0)
        layout.addWidget(self.profile_name,
                         0,
                         1,
                         1,
                         2,
                         alignment=QtCore.Qt.AlignCenter)
        # layout.addWidget(self.auto_crop, 1, 0)
        # layout.addWidget(audio_language_label, 2, 0)
        # layout.addWidget(self.audio_language, 2, 1)
        # layout.addWidget(self.audio_first_only, 3, 1)
        # layout.addWidget(self.encoder_label, 7, 0, 1, 2)
        # layout.addWidget(self.encoder_settings, 8, 0, 10, 2)
        layout.addWidget(save_button, 0, 5, alignment=QtCore.Qt.AlignRight)

        layout.addWidget(self.tab_area, 1, 0, 20, 6)

        layout.setColumnStretch(0, 0)
        layout.setColumnStretch(1, 0)
        layout.setColumnStretch(2, 1)
        self.update_settings()

        self.setLayout(layout)