Skip to content

Commit f3ba285

Browse files
authored
Merge pull request #3327 from SuslikV/patch-14
Add support for cqp setting in Export dialog
2 parents 57b7d03 + 86d5111 commit f3ba285

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/windows/export.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -668,23 +668,23 @@ def convert_to_bytes(self, BitRateString):
668668
raw_number = locale.atof(raw_number_string)
669669

670670
if "kb" in raw_measurement:
671-
measurement = "kb"
671+
# Kbit to bytes
672672
bit_rate_bytes = raw_number * 1000.0
673673

674674
elif "mb" in raw_measurement:
675-
measurement = "mb"
675+
# Mbit to bytes
676676
bit_rate_bytes = raw_number * 1000.0 * 1000.0
677677

678-
elif "crf" in raw_measurement:
679-
measurement = "crf"
678+
elif ("crf" in raw_measurement) or ("cqp" in raw_measurement):
679+
# Just a number
680680
if raw_number > 63:
681681
raw_number = 63
682682
if raw_number < 0:
683683
raw_number = 0
684684
bit_rate_bytes = raw_number
685685

686686
elif "qp" in raw_measurement:
687-
measurement = "qp"
687+
# Just a number
688688
if raw_number > 255:
689689
raw_number = 255
690690
if raw_number < 0:
@@ -886,11 +886,12 @@ def accept(self):
886886
else:
887887
# Muxing options for mp4/mov
888888
w.SetOption(openshot.VIDEO_STREAM, "muxing_preset", "mp4_faststart")
889-
# Set the quality in case crf was selected
889+
# Set the quality in case crf, cqp or qp was selected
890890
if "crf" in self.txtVideoBitRate.text():
891891
w.SetOption(openshot.VIDEO_STREAM, "crf", str(int(video_settings.get("video_bitrate"))) )
892-
# Set the quality in case qp was selected
893-
if "qp" in self.txtVideoBitRate.text():
892+
elif "cqp" in self.txtVideoBitRate.text():
893+
w.SetOption(openshot.VIDEO_STREAM, "cqp", str(int(video_settings.get("video_bitrate"))) )
894+
elif "qp" in self.txtVideoBitRate.text():
894895
w.SetOption(openshot.VIDEO_STREAM, "qp", str(int(video_settings.get("video_bitrate"))) )
895896

896897

0 commit comments

Comments
 (0)