Commit 092d39a2 authored by Thibault Saunier's avatar Thibault Saunier

render: Remove exception forcing x264enc to work with Y444

This forces the encoder to output high-4:4:4 which is not well supported
by hw decoders and youtube will force reencoding when using that profile.

Closes #2182
parent 2cd5792b
......@@ -62,17 +62,6 @@ from pitivi.utils.widgets import FractionWidget
DEFAULT_NAME = _("New Project")
# This is a dictionary to allow adding special restrictions when using a specific
# encoder element.
# For example x264enc can't encode frame with odd size if its input format is not Y444
# so in that case we make sure to force Y444 as x264enc input format.
ENCODERS_RESTRICTIONS_SETTER = {
# To avoid restriction of size in x264enc, make sure that the encoder
# input color space is Y444 so that we do not have any restriction
"x264enc": lambda project, profile: project._set_restriction(
profile, "format", "Y444")
}
ALL_RAW_VIDEO_FORMATS = []
# Starting at 2 as 0 is UNKNOWN and 1 is ENCODED.
# We want to make sure we do not try to force ENCODED
......@@ -933,14 +922,6 @@ class Project(Loggable, GES.Project):
self.audio_profile.set_preset(None)
self._emit_change("aencoder")
def _enforce_video_encoder_restrictions(self, encoder, profile=None):
"""Enforces @encoder specific restrictions."""
if not profile:
profile = self.video_profile
restriction_setter = ENCODERS_RESTRICTIONS_SETTER.get(encoder)
if restriction_setter:
restriction_setter(self, profile)
@property
def vencoder(self):
return self.video_profile.get_preset_name()
......@@ -954,7 +935,6 @@ class Project(Loggable, GES.Project):
self.video_profile.set_preset_name(value)
# Gst.Preset can be set exclusively through EncodingTagets for now.
self.video_profile.set_preset(None)
self._enforce_video_encoder_restrictions(value)
self._emit_change("vencoder")
@property
......@@ -1713,7 +1693,6 @@ class Project(Loggable, GES.Project):
profile.set_restriction(restriction)
profile.set_preset_name(preset_name)
self._enforce_video_encoder_restrictions(preset_name, profile)
self.info("Fully set restriction: %s", profile.get_restriction().to_string())
def _ensureVideoRestrictions(self, profile=None):
......
......@@ -839,12 +839,20 @@ class RenderDialog(Loggable):
self.dialog.ok_btn.connect(
"clicked", self._okButtonClickedCb, settings_attr)
def __additional_debug_info(self, error):
if self.project.vencoder == 'x264enc':
if self.project.videowidth % 2 or self.project.videoheight % 2:
return "\n\n%s\n\n" % _("<b>Make sure your rendering size is even, "
"x264enc might not be able to render otherwise.</b>\n\n")
return ""
def _showRenderErrorDialog(self, error, unused_details):
primary_message = _("Sorry, something didn’t work right.")
secondary_message = _("An error occurred while trying to render your "
"project. You might want to check our "
"troubleshooting guide or file a bug report. "
"The GStreamer error was:") + "\n\n<i>" + str(error) + "</i>"
"project.") + self.__additional_debug_info(str(error)) + (
"You might want to check our troubleshooting guide or file a bug report. "
"The GStreamer error was:") + "\n\n<i>" + str(error) + "</i>"
dialog = Gtk.MessageDialog(transient_for=self.window, modal=True,
message_type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK,
......
......@@ -151,8 +151,6 @@ class TestRender(BaseTestMediaLibrary):
Gst.ElementFactory.find("matroskamux")))
self.assertTrue(set_combo_value(dialog.video_encoder_combo,
Gst.ElementFactory.find("x264enc")))
self.assertEqual(project.video_profile.get_restriction()[0]["format"],
"Y444")
# Set encoding profile
if getattr(GstPbutils.EncodingProfile, "copy"): # Available only in > 1.11
......@@ -161,8 +159,6 @@ class TestRender(BaseTestMediaLibrary):
if isinstance(p, GstPbutils.EncodingVideoProfile)]
vprofile.set_restriction(Gst.Caps("video/x-raw"))
project.set_container_profile(profile)
self.assertEqual(project.video_profile.get_restriction()[0]["format"],
"Y444")
@skipUnless(*factory_exists("vorbisenc", "theoraenc", "oggmux",
"opusenc", "vp8enc"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment