diff --git a/mpegize.py b/mpegize.py index 3f72044..a9464e5 100755 --- a/mpegize.py +++ b/mpegize.py @@ -263,6 +263,13 @@ def gst_convert(mega_dir, out_file, use_jpeg): movie.start_time = tm audio.start_time = tm + def pipeline_264enc(): + if Gst.Registry.get().find_plugin("x264"): + s = "x264enc bitrate=3072 speed-preset=ultrafast" + else: + s = "openh264enc bitrate=3145728 ! h264parse" + return s + def pipeline_video(): if True: s = "appsrc name=source" @@ -277,7 +284,7 @@ def gst_convert(mega_dir, out_file, use_jpeg): elif True: s += " ! videoconvert ! autovideosink" else: - s += " ! videoconvert ! x264enc bitrate=3072 speed-preset=ultrafast ! matroskamux ! filesink location=" + out_file + s += " ! videoconvert ! " + pipeline_264enc() + " ! matroskamux ! filesink location=" + out_file pipeline = Gst.parse_launch(s) @@ -331,7 +338,7 @@ def gst_convert(mega_dir, out_file, use_jpeg): s += "videotestsrc" s += " ! video/x-raw,width=(int)640,height=(int)480,format=(string)RGB " - s += " ! videoconvert ! x264enc bitrate=3072 speed-preset=ultrafast ! matroskamux name=mux" + s += " ! videoconvert ! " + pipeline_264enc() + " ! matroskamux name=mux" if False: s += " ! decodebin ! playsink" else: